/[escript]/branches/scons_revamp_from_3210/site_scons/site_init.py
ViewVC logotype

Diff of /branches/scons_revamp_from_3210/site_scons/site_init.py

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

trunk/scons/scons_extensions.py revision 3194 by jfenwick, Tue Jun 29 01:31:31 2010 UTC branches/scons_revamp_from_3210/site_scons/site_init.py revision 3212 by caltinay, Tue Sep 28 01:06:07 2010 UTC
# Line 23  import sys, os, time, glob, fnmatch, typ Line 23  import sys, os, time, glob, fnmatch, typ
23    
24  from SCons.Script.SConscript import SConsEnvironment  from SCons.Script.SConscript import SConsEnvironment
25    
26    def findLibWithHeader(env, libs, header, paths, lang='c'):
27        inc_path=''
28        lib_path=''
29        # 'paths' may be a prefix, so look for lib and include subdirectories
30        if type(paths)==str:
31            # find the header file first
32            for i in 'include','include64','include32','inc':
33                inc=os.path.join(paths, i)
34                if os.path.isfile(os.path.join(inc, header)):
35                    inc_path=inc
36                    break
37            if inc_path=='':
38                raise RuntimeError('%s not found under %s'%(header,paths))
39    
40            # now try to find a lib directory
41            for l in 'lib','lib64','lib32':
42                lp=os.path.join(paths, l)
43                if os.path.isdir(lp):
44                    lib_path=lp
45                    break
46            if lib_path=='':
47                raise RuntimeError('No lib directory found under %s'%paths)
48        else:
49            if os.path.isfile(os.path.join(paths[0], header)):
50                inc_path=paths[0]
51            else:
52                raise RuntimeError('%s not found under %s'%(header,paths[0]))
53            if os.path.isdir(paths[1]):
54                lib_path=paths[1]
55            else:
56                raise RuntimeError('%s is not a valid path.'%paths[1])
57    
58        # now try the library
59        conf=Configure(env)
60        conf.env.AppendUnique(CPPPATH = [inc_path])
61        conf.env.AppendUnique(LIBPATH = [lib_path])
62        if type(libs)==str: libs=[libs]
63        for lib in libs:
64            if not conf.CheckLibWithHeader(lib, header, lang):
65                conf.Finish()
66                raise RuntimeError('%s not found in %s, %s'%(lib,inc_path,lib_path))
67    
68        conf.Finish()
69        return inc_path, lib_path
70    
71  # Code to build .pyc from .py  # Code to build .pyc from .py
72  def build_py(target, source, env):  def build_py(target, source, env):
73      py_compile.compile(str(source[0]), str(target[0]))      py_compile.compile(str(source[0]), str(target[0]))

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

  ViewVC Help
Powered by ViewVC 1.1.26