51 |
|
for p in section[1]: # single items to replace |
52 |
|
try: v = cfig.get(section[0], p) |
53 |
|
except ConfigParser.NoOptionError: continue |
54 |
+ |
if section[0] == 'install' and '{' in v: |
55 |
+ |
try: |
56 |
+ |
vv = v.format(**os.environ) |
57 |
+ |
except KeyError: vv = v |
58 |
+ |
else: v = vv |
59 |
|
env[p] = v |
60 |
< |
#print '%s: %s' % (p, env[p]) |
60 |
> |
#print('%s: %s' % (p, env[p])) |
61 |
|
for p in section[2]: # multiple items to append |
62 |
|
try: v = cfig.get(section[0], p) |
63 |
|
except ConfigParser.NoOptionError: continue |
69 |
|
env[k] = os.path.join(env['RAD_BASEDIR'],env[k]) |
70 |
|
|
71 |
|
|
72 |
< |
def load_plat(env, args, ourplat=None): |
73 |
< |
if ourplat == None: # override |
74 |
< |
p = sys.platform |
75 |
< |
else: p = ourplat |
76 |
< |
# if p == 'win32' and platform.architecture()[0] == '64bit': |
77 |
< |
# p = 'win64' |
78 |
< |
if p == 'win32' and 'gcc' in env['TOOLS']: |
79 |
< |
# we don't really want to know this here... |
80 |
< |
p = 'mingw' |
81 |
< |
pl = [] |
82 |
< |
print 'Detected platform "%s" (%s).' % (sys.platform, os.name) |
83 |
< |
for i in [len(p), -1, -2]: |
84 |
< |
pfn = os.path.join(_platdir, p[:i] + '_custom.cfg') |
85 |
< |
if os.path.isfile(pfn): |
86 |
< |
print 'Reading configuration "%s"' % pfn |
87 |
< |
read_plat(env, args, pfn) |
88 |
< |
return 1 |
89 |
< |
pfn = os.path.join(_platdir, p[:i] + '.cfg') |
90 |
< |
if os.path.isfile(pfn): |
91 |
< |
print 'Reading configuration "%s"' % pfn |
92 |
< |
read_plat(env, args, pfn) |
88 |
< |
return 1 |
89 |
< |
|
72 |
> |
def load_plat(env, args, arch=None): |
73 |
> |
cfgname = 'posix' |
74 |
> |
memmodel, binformat = platform.architecture() |
75 |
> |
platsys = platform.system() |
76 |
> |
print 'Detected platform "%s" (%s).' % (platsys, memmodel) |
77 |
> |
cfgname = platsys + '_' + memmodel[:2] |
78 |
> |
env['RAD_BUILDBIN'] = os.path.join('#scbuild', cfgname, 'bin') |
79 |
> |
env['RAD_BUILDLIB'] = os.path.join('#scbuild', cfgname, 'lib') |
80 |
> |
env['RAD_BUILDOBJ'] = os.path.join('#scbuild', cfgname, 'obj') |
81 |
> |
|
82 |
> |
pfn = os.path.join(_platdir, cfgname + '_custom.cfg') |
83 |
> |
if os.path.isfile(pfn): |
84 |
> |
print 'Reading configuration "%s"' % pfn |
85 |
> |
read_plat(env, args, pfn) |
86 |
> |
return 1 |
87 |
> |
pfn = os.path.join(_platdir, cfgname + '.cfg') |
88 |
> |
if os.path.isfile(pfn): |
89 |
> |
print 'Reading configuration "%s"' % pfn |
90 |
> |
read_plat(env, args, pfn) |
91 |
> |
return 1 |
92 |
> |
|
93 |
|
if os.name == 'posix': |
94 |
|
pfn = os.path.join(_platdir, 'posix.cfg') |
95 |
|
if os.path.isfile(pfn): |
97 |
|
read_plat(env, args, pfn) |
98 |
|
return 1 |
99 |
|
|
100 |
< |
print 'Platform "%s/%s" not supported yet' % (os.name, sys.platform) |
100 |
> |
print 'Platform "%s", system "%s" not supported yet' % (os.name, sys.platform) |
101 |
|
sys.exit(2) |
102 |
|
|
103 |
|
|