ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/build_utils/load_plat.py
(Generate patch)

Comparing ray/build_utils/load_plat.py (file contents):
Revision 1.1 by schorsch, Tue Oct 21 19:27:28 2003 UTC vs.
Revision 1.8 by schorsch, Tue Jun 6 22:32:05 2006 UTC

# Line 1 | Line 1
1  
2   import os
3   import sys
4 import string
4   import ConfigParser
5  
6  
7   _platdir = 'platform'
8  
9  
10 < def POSIX_setup(env):
12 <    # common stuff for all posix systems
13 <    env['RAD_PROCESS'] = string.split('unix_process.c')
14 <
15 <
16 < def read_plat(env, fn):
10 > def read_plat(env, args, fn):
11          cfig = ConfigParser.ConfigParser(env.Dictionary())
12          cfig.read(fn)
13 +        buildvars = [['CC'], # replace
14 +                        ['CPPPATH', 'CPPDEFINES', 'CPPFLAGS', 'CCFLAGS',
15 +                        'LIBPATH', 'LINKFLAGS']] # append
16          vars = [
20                ['build',
21                        ['CC'], # replace
22                        ['CPPFLAGS', 'CCFLAGS', 'CPPPATH', 'LIBPATH']], # append
17                  ['install',
18                          ['RAD_BASEDIR', 'RAD_BINDIR', 'RAD_RLIBDIR', 'RAD_MANDIR'],
19                          []],
20                  ['code',
21 <                        ['RAD_SPEED'],
22 <                        ['RAD_COMPAT', 'RAD_MLIB', 'RAD_PROCESS']],
21 >                        [], # replace
22 >                        [   # append
23 >                        'RAD_COMPAT',    # currently obsolete
24 >                        'RAD_MATHCOMPAT', # erf.c floating point error function
25 >                        'RAD_ARGSCOMPAT', # fixargv0.c for Windows
26 >                        'RAD_NETCOMPAT',  # [win_]netproc.c for ranimate
27 >                        'RAD_MLIB',       # usually 'm', or any fastlib available
28 >                        'RAD_SOCKETLIB',  # ws_2_32 on Windows (VC links it automatically)
29 >                        'RAD_PROCESS']],  # our process abstraction and win_popen()
30          ]
31 +        if args.get('RAD_DEBUG',0):
32 +                vars.insert(0, ['debug'] + buildvars)
33 +        else: vars.insert(0, ['build'] + buildvars)
34          for section in vars:
35                  if cfig.has_section(section[0]):
36 <                        for p in section[1]:
36 >                        for p in section[1]: # single items to replace
37                                  try: v = cfig.get(section[0], p)
38                                  except ConfigParser.NoOptionError: continue
39                                  env[p] = v
40                                  #print '%s: %s' % (p, env[p])
41 <                        for p in section[2]:
41 >                        for p in section[2]: # multiple items to append
42                                  try: v = cfig.get(section[0], p)
43                                  except ConfigParser.NoOptionError: continue
44 <                                apply(env.Append,[],{p:string.split(v)})
44 >                                apply(env.Append,[],{p:`v`.split()})
45                                  #print '%s: %s' % (p, env[p])
46          # XXX Check that basedir exists.
47          for k in ['RAD_BINDIR', 'RAD_RLIBDIR', 'RAD_MANDIR']:
# Line 46 | Line 50 | def read_plat(env, fn):
50                          env[k] = os.path.join(env['RAD_BASEDIR'],env[k])
51  
52  
53 < def load_plat(env, platform=None):
50 <        if os.name == 'posix':
51 <                POSIX_setup(env)
53 > def load_plat(env, args, platform=None):
54          if platform == None: # override
55                  p = sys.platform
56          else: p = platform
57 +        if p == 'win32' and 'gcc' in env['TOOLS']:
58 +                # we don't really want to know this here...
59 +                p = 'mingw'
60          pl = []
61          print 'Detected platform "%s" (%s).' % (sys.platform, os.name)
62          for i in [len(p), -1, -2]:
63                  pfn = os.path.join(_platdir, p[:i] + '_custom.cfg')
64                  if os.path.isfile(pfn):
65                          print 'Reading configuration "%s"' % pfn
66 <                        read_plat(env, pfn)
66 >                        read_plat(env, args, pfn)
67                          return 1
68                  pfn = os.path.join(_platdir, p[:i] + '.cfg')
69                  if os.path.isfile(pfn):
70                          print 'Reading configuration "%s"' % pfn
71 <                        read_plat(env, pfn)
71 >                        read_plat(env, args, pfn)
72                          return 1
73                  
74          if os.name == 'posix':
75                  pfn = os.path.join(_platdir, 'posix.cfg')
76                  if os.path.isfile(pfn):
77                          print 'Reading generic configuration "%s".' % pfn
78 <                        read_plat(env, pfn)
78 >                        read_plat(env, args, pfn)
79                          return 1
80  
81          print 'Platform "%s/%s" not supported yet' % (os.name, sys.platform)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines