/[escript]/branches/postrelease-csirofixes/site_scons/site_init.py
ViewVC logotype

Diff of /branches/postrelease-csirofixes/site_scons/site_init.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3212 by caltinay, Tue Sep 28 01:06:07 2010 UTC revision 3214 by caltinay, Tue Sep 28 03:26:24 2010 UTC
# Line 21  __url__="https://launchpad.net/escript-f Line 21  __url__="https://launchpad.net/escript-f
21    
22  import sys, os, time, glob, fnmatch, types, py_compile, re  import sys, os, time, glob, fnmatch, types, py_compile, re
23    
 from SCons.Script.SConscript import SConsEnvironment  
   
24  def findLibWithHeader(env, libs, header, paths, lang='c'):  def findLibWithHeader(env, libs, header, paths, lang='c'):
25        from SCons.Script.SConscript import Configure
26      inc_path=''      inc_path=''
27      lib_path=''      lib_path=''
28      # 'paths' may be a prefix, so look for lib and include subdirectories      # 'paths' may be a prefix, so look for lib and include subdirectories
# Line 56  def findLibWithHeader(env, libs, header, Line 55  def findLibWithHeader(env, libs, header,
55              raise RuntimeError('%s is not a valid path.'%paths[1])              raise RuntimeError('%s is not a valid path.'%paths[1])
56    
57      # now try the library      # now try the library
58      conf=Configure(env)      conf=Configure(clone_env(env))
59      conf.env.AppendUnique(CPPPATH = [inc_path])      conf.env.AppendUnique(CPPPATH = [inc_path])
60      conf.env.AppendUnique(LIBPATH = [lib_path])      conf.env.AppendUnique(LIBPATH = [lib_path])
61      if type(libs)==str: libs=[libs]      if type(libs)==str: libs=[libs]
62      for lib in libs:      # we can't check for each library by itself since they may depend on each
63          if not conf.CheckLibWithHeader(lib, header, lang):      # other, so we add all libraries to the link line and check only for one
64              conf.Finish()      conf.env.AppendUnique(LIBS = libs)
65              raise RuntimeError('%s not found in %s, %s'%(lib,inc_path,lib_path))      if not conf.CheckLibWithHeader(libs[0], header, lang):
66            conf.Finish()
67            raise RuntimeError('Unable to link against %s (paths: %s, %s)'%(libs,inc_path,lib_path))
68    
69      conf.Finish()      conf.Finish()
70      return inc_path, lib_path      return inc_path, lib_path
71    
72    # Make a copy of an environment
73    # scons <= 0.98: env.Copy()
74    # scons >  0.98: env.Clone()
75    def clone_env(env):
76        if 'Clone' in dir(env):
77            return env.Clone()
78        else:
79            return env.Copy()
80    
81  # Code to build .pyc from .py  # Code to build .pyc from .py
82  def build_py(target, source, env):  def build_py(target, source, env):
83      py_compile.compile(str(source[0]), str(target[0]))      py_compile.compile(str(source[0]), str(target[0]))

Legend:
Removed from v.3212  
changed lines
  Added in v.3214

  ViewVC Help
Powered by ViewVC 1.1.26