Mercurial > parpg-core
annotate waf_paths.py @ 71:2168d761d865
Backed out changeset: ee350343b69b
Didn't work as expected
author | KarstenBock@gmx.net |
---|---|
date | Tue, 06 Sep 2011 18:14:42 +0200 |
parents | feceb6130570 |
children |
rev | line source |
---|---|
16
927f2cf75357
Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
1 #! /usr/bin/env python |
927f2cf75357
Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
2 # encoding: utf-8 |
20
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
3 import os |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
4 import platform |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
5 import re |
16
927f2cf75357
Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
6 |
20
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
7 from waflib import Utils, Options, Context, Logs, Errors |
16
927f2cf75357
Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
8 |
20
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
9 try: |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
10 from collections import OrderedDict |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
11 except ImportError: |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
12 # Python 2.6 doesn't have an OrderedDict, so we'll provide one. |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
13 from ordereddict import OrderedDict |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
14 |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
15 prefix_values = OrderedDict( |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
16 [ |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
17 ('prefix', ['installation prefix', '/usr/local']), |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
18 ('exec_prefix', |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
19 ['installation prefix for platform-dependent binary files', |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
20 '${PREFIX}']) |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
21 ] |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
22 ) |
16
927f2cf75357
Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
23 |
20
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
24 option_values = OrderedDict( |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
25 [ |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
26 ('bindir', ['user executables', '${EXEC_PREFIX}/bin']), |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
27 ('sbindir', ['system admin executables', '${EXEC_PREFIX}/sbin']), |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
28 ('libexecdir', ['program executables', '${EXEC_PREFIX}/libexec']), |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
29 ('sharedstatedir', ['modifiable architecture-independent data', |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
30 '${PREFIX}/com']), |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
31 ('localstatedir', ['modifiable single-machine data', '${PREFIX}/var']), |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
32 ('libdir', ['object code libraries', '${EXEC_PREFIX}/lib']), |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
33 ('includedir', ['C header files', '${PREFIX}/include']), |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
34 ('oldincludedir', ['C header files for non-gcc', '/usr/include']), |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
35 ('datarootdir', ['read-only arch.-independent data root', |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
36 '${PREFIX}/share']), |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
37 # datadir and sysconfdir definitions deviate from GNU standards by |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
38 # appending the ${APPNAME}, but it makes the install script simpler |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
39 # since we don't have to redefine install paths on Windows. |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
40 ('datadir', ['read-only architecture-independent data', |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
41 '${DATAROOTDIR}/${APPNAME}']), |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
42 ('sysconfdir', ['read-only single-machine data', |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
43 '${PREFIX}/etc/${APPNAME}']), |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
44 ('infodir', ['info documentation', '${DATAROOTDIR}/info']), |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
45 ('localedir', ['locale-dependent data', '${DATAROOTDIR}/locale']), |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
46 ('mandir', ['man documentation', '${DATAROOTDIR}/man']), |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
47 ('docdir', ['documentation root', '${DATAROOTDIR}/doc/${APPNAME}']), |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
48 ('htmldir', ['html documentation', '${DOCDIR}']), |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
49 ('dvidir', ['dvi documentation', '${DOCDIR}']), |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
50 ('pdfdir', ['pdf documentation', '${DOCDIR}']), |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
51 ('psdir', ['ps documentation', '${DOCDIR}']), |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
52 ] |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
53 ) |
16
927f2cf75357
Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
54 |
20
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
55 if platform.system() == 'Windows': |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
56 prefix_values['prefix'][1] = '${PROGRAMFILES}/${APPNAME}' |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
57 |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
58 option_values['bindir'][1] = '${EXEC_PREFIX}' |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
59 option_values['sysconfdir'][1] = '${PREFIX}' |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
60 option_values['datarootdir'][1] = '${PREFIX}' |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
61 option_values['datadir'][1] = '${DATAROOTDIR}/data' |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
62 option_values['docdir'][1] = '${DATAROOTDIR}/doc' |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
63 del option_values['oldincludedir'] |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
64 del option_values['mandir'] |
16
927f2cf75357
Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
65 |
927f2cf75357
Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
66 def options(opt): |
927f2cf75357
Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
67 inst_dir = opt.add_option_group( |
927f2cf75357
Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
68 'Installation directories', |
927f2cf75357
Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
69 'By default, "waf install" will install all files into their ' |
927f2cf75357
Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
70 'appropriate directories under ${PREFIX}. The installation prefix can ' |
927f2cf75357
Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
71 'be specified using the "--prefix" option, for example ' |
927f2cf75357
Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
72 '"--prefix=$HOME"' |
927f2cf75357
Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
73 ) |
20
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
74 help_template = '{0} [Default: %default]' |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
75 for prefix_name in prefix_values.keys(): |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
76 # Remove any of the core WAF options if they conflict with our options. |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
77 if opt.parser.get_option(prefix_name): |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
78 opt.parser.remove_option(prefix_name) |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
79 help, default = prefix_values[prefix_name] |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
80 option_name = '--' + prefix_name |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
81 inst_dir.add_option(option_name, help=help_template.format(help), |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
82 default=default, dest=prefix_name) |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
83 |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
84 # Move the --destdir option to the inst_dir group for consistency. |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
85 destdir_option = opt.parser.get_option('destdir') |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
86 if destdir_option: |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
87 opt.parser.remove_option('destdir') |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
88 inst_dir.add_option(destdir_option) |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
89 |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
90 predef_dirs = opt.add_option_group( |
16
927f2cf75357
Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
91 'Pre-defined installation directories', |
927f2cf75357
Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
92 '' |
927f2cf75357
Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
93 ) |
927f2cf75357
Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
94 for name in option_values: |
927f2cf75357
Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
95 help, default = option_values[name] |
927f2cf75357
Changed build system from SCons to WAF.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
96 option_name = '--' + name |
20
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
97 predef_dirs.add_option(option_name, help=help_template.format(help), |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
98 default=default, dest=name) |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
99 |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
100 def configure(conf): |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
101 def set_env_paths(path_values): |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
102 errors_raised = False |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
103 index = 0 |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
104 for option_name in path_values.keys(): |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
105 help, default = path_values[option_name] |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
106 upper_option_name = option_name.upper() |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
107 try: |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
108 env[upper_option_name] = Utils.subst_vars( |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
109 getattr(conf.options, option_name), |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
110 env, |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
111 ) |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
112 except TypeError: |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
113 errors_raised = True |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
114 env['INSTALL_PATHS'].append(upper_option_name) |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
115 if errors_raised: |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
116 failed_path_names = [name for name in option_values if |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
117 upper_option_name not in env] |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
118 else: |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
119 failed_path_names = [] |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
120 return failed_path_names |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
121 |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
122 env = conf.env |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
123 if platform.system() == 'Windows': |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
124 try: |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
125 env['PROGRAMFILES'] = os.environ['PROGRAMFILES'] |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
126 except KeyError: |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
127 Logs.warn('PROGRAMFILES environmental variable is not set') |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
128 if re.search(r'\$\{PROGRAMFILES\}', conf.options.prefix): |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
129 Logs.error( |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
130 'unable to find path to Program Files direcotry, please ' |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
131 'set the PROGRAMFILES environmental variable or ' |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
132 'override installation prefix with --prefix' |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
133 ) |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
134 if 'APPNAME' not in env: |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
135 env['APPNAME'] = Context.g_module.APPNAME |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
136 env['INSTALL_PATHS'] = [] |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
137 failed_path_names = [] |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
138 failed_path_names.extend(set_env_paths(prefix_values)) |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
139 failed_path_names.extend(set_env_paths(option_values)) |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
140 if failed_path_names: |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
141 error_message = 'failed to expand install paths {0!r}' |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
142 raise Errors.ConfigurationError( |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
143 error_message.format(failed_path_names) |
07ff8cf8a0f1
Fixed WAF install paths issue on Windows.
M. George Hansen <technopolitica@gmail.com>
parents:
17
diff
changeset
|
144 ) |