Back to index

radiance  4R0+20100331
Functions | Variables
build_utils.load_plat Namespace Reference

Functions

def read_plat
def load_plat

Variables

string _platdir = 'platform'

Function Documentation

def build_utils.load_plat.load_plat (   env,
  args,
  platform = None 
)

Definition at line 60 of file load_plat.py.

00060 
00061 def load_plat(env, args, platform=None):
00062        if platform == None: # override
00063               p = sys.platform
00064        else: p = platform
00065        if p == 'win32' and 'gcc' in env['TOOLS']:
00066               # we don't really want to know this here...
00067               p = 'mingw'
00068        pl = []
00069        print 'Detected platform "%s" (%s).' % (sys.platform, os.name)
00070        for i in [len(p), -1, -2]:
00071               pfn = os.path.join(_platdir, p[:i] + '_custom.cfg')
00072               if os.path.isfile(pfn):
00073                      print 'Reading configuration "%s"' % pfn
00074                      read_plat(env, args, pfn)
00075                      return 1
00076               pfn = os.path.join(_platdir, p[:i] + '.cfg')
00077               if os.path.isfile(pfn):
00078                      print 'Reading configuration "%s"' % pfn
00079                      read_plat(env, args, pfn)
00080                      return 1
00081               
00082        if os.name == 'posix':
00083               pfn = os.path.join(_platdir, 'posix.cfg')
00084               if os.path.isfile(pfn):
00085                      print 'Reading generic configuration "%s".' % pfn
00086                      read_plat(env, args, pfn)
00087                      return 1
00088 
00089        print 'Platform "%s/%s" not supported yet' % (os.name, sys.platform)
00090        sys.exit(2)
00091 
00092        
00093        

Here is the call graph for this function:

def build_utils.load_plat.read_plat (   env,
  args,
  fn 
)

Definition at line 10 of file load_plat.py.

00010 
00011 def read_plat(env, args, fn):
00012        cfig = ConfigParser.ConfigParser(env.Dictionary())
00013        cfig.read(fn)
00014        buildvars = [['CC',
00015                      'TIFFINCLUDE', # where to find preinstalled tifflib headers
00016                      'TIFFLIB',     # where to find a preinstalled tifflib library
00017                      ], # replace
00018                      ['CPPPATH', 'CPPDEFINES', 'CPPFLAGS', 'CCFLAGS',
00019                      'LIBPATH', 'LINKFLAGS',
00020                      'EZXML_CPPDEFINES', # build flags specific to ezxml.c
00021                      ]] # append
00022        vars = [
00023               ['install',
00024                      ['RAD_BASEDIR', 'RAD_BINDIR', 'RAD_RLIBDIR', 'RAD_MANDIR'],
00025                      []],
00026               ['code',
00027                      [   # replace
00028                      ],
00029                      [   # append
00030                      'RAD_COMPAT',     # theoretically obsolete (src/common/strcmp.c)
00031                      'RAD_MATHCOMPAT', # erf.c floating point error function
00032                      'RAD_ARGSCOMPAT', # fixargv0.c for Windows
00033                      'RAD_NETCOMPAT',  # [win_]netproc.c for ranimate
00034                      'RAD_MLIB',       # usually 'm', or any fastlib available
00035                      'RAD_SOCKETLIB',  # ws_2_32 on Windows (VC links it automatically)
00036                      'RAD_PROCESS',    # our process abstraction and win_popen()
00037                      'RAD_PCALLS',     # more custom process abstraction
00038                      ]],
00039        ]
00040        if args.get('RAD_DEBUG',0):
00041               vars.insert(0, ['debug'] + buildvars)
00042        else: vars.insert(0, ['build'] + buildvars)
00043        for section in vars:
00044               if cfig.has_section(section[0]):
00045                      for p in section[1]: # single items to replace
00046                             try: v = cfig.get(section[0], p)
00047                             except ConfigParser.NoOptionError: continue
00048                             env[p] = v
00049                             #print '%s: %s' % (p, env[p])
00050                      for p in section[2]: # multiple items to append
00051                             try: v = cfig.get(section[0], p)
00052                             except ConfigParser.NoOptionError: continue
00053                             apply(env.Append,[],{p:env.Split(v)})
00054        # XXX Check that basedir exists.
00055        for k in ['RAD_BINDIR', 'RAD_RLIBDIR', 'RAD_MANDIR']:
00056               if (env.has_key('RAD_BASEDIR') and env.has_key(k)
00057                             and not os.path.isabs(env[k])):
00058                      env[k] = os.path.join(env['RAD_BASEDIR'],env[k])
00059 

Here is the caller graph for this function:


Variable Documentation

Definition at line 7 of file load_plat.py.