-
Notifications
You must be signed in to change notification settings - Fork 70
/
Copy pathconfigure.py
63 lines (47 loc) · 1.67 KB
/
configure.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
""" Script to configure build_config.py
== Build everything, including pys60 ==
configure.py pys60_ce_src=\projects\pys60ce\trunk\src
== Use existing python sis ==
configure.py build_python=False pys60_sis=python.sisx pythondll=python222.dll
"""
import os, sys
def start():
try:
import build_config as defaults
except:
import default_build_config as defaults
args = [x.split("=") for x in sys.argv if "=" in x]
vars = [ x for x in dir(defaults) if not x.startswith("_") ]
values = [ getattr( defaults, x ) for x in vars ]
oldvalues = zip( vars, values )
print "=" * 79
result = {}
for name,value in args:
if name not in vars:
print "Error: no such configuration '%s'" % name
print "Possible configuration values are:\n", " | ".join( vars )
raise SystemExit( )
old = getattr(defaults, name )
try:
# Evaluate booleans and integers
result[name] = eval(value)
except:
result[name] = value
print name, "reconfigured '%s' => '%s'" % ( str(old), str( value ))
for name, value in oldvalues:
if name not in result:
result[name] = value
# Create the module
print
print "-" * 79
f=open("build_config.py",'w');
keys = result.keys();keys.sort()
for name in keys:
value = result[name]
line = "%-15s = %s\n" % ( name, repr(value))
print line.strip()
f.write(line)
f.close()
print "=" * 79
if __name__ == "__main__":
start()