/[escript]/trunk/site_scons/site_init.py
ViewVC logotype

Diff of /trunk/site_scons/site_init.py

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

revision 4154 by jfenwick, Tue Jan 22 09:30:23 2013 UTC revision 4295 by caltinay, Fri Mar 8 04:42:01 2013 UTC
# Line 21  http://www.opensource.org/licenses/osl-3 Line 21  http://www.opensource.org/licenses/osl-3
21  __url__="https://launchpad.net/escript-finley"  __url__="https://launchpad.net/escript-finley"
22    
23  import sys, os, time, py_compile, re, subprocess  import sys, os, time, py_compile, re, subprocess
24    from SCons.Defaults import Chmod
25    from grouptest import *
26    
27  def findLibWithHeader(env, libs, header, paths, lang='c'):  def findLibWithHeader(env, libs, header, paths, lang='c'):
28      from SCons.Script.SConscript import Configure      from SCons.Script.SConscript import Configure
# Line 75  def detectModule(env, module): Line 77  def detectModule(env, module):
77          try:          try:
78              __import__(module)              __import__(module)
79          except ImportError:          except ImportError:
80                env[module] = False
81              return False              return False
82      else:      else:
83          p=subprocess.call([env['pythoncmd'],'-c','import %s'%module])          p=subprocess.call([env['pythoncmd'],'-c','import %s'%module])
84          if p!=0:          if p!=0:
85                env[module] = False
86              return False              return False
87        env[module] = True
88      return True      return True
89    
90    def write_buildvars(env):
91        buildvars=open(os.path.join(env['libinstall'], 'buildvars'), 'w')
92        for k,v in sorted(env['buildvars'].items()):
93            buildvars.write("%s=%s\n"%(k,v))
94        buildvars.close()
95    
96    def generateTestScripts(env, TestGroups):
97        try:
98            utest=open('utest.sh','w')
99            utest.write(GroupTest.makeHeader(env['PLATFORM'], env['prefix'], False))
100            for tests in TestGroups:
101                utest.write(tests.makeString())
102            utest.close()
103            env.Execute(Chmod('utest.sh', 0o755))
104            print("Generated utest.sh.")
105            # This version contains only python tests - I want this to be usable
106            # from a binary only install if you have the test files
107            utest=open('itest.sh','w')
108            utest.write(GroupTest.makeHeader(env['PLATFORM'], env['prefix'], True))
109            for tests in TestGroups:
110              if tests.exec_cmd=='$PYTHONRUNNER ':
111                utest.write(tests.makeString())
112            utest.close()
113            env.Execute(Chmod('itest.sh', 0o755))
114            print("Generated itest.sh.")        
115        except IOError:
116            env['warnings'].append("Error attempting to write unit test script(s).")
117    
118        # delete scripts upon cleanup
119        env.Clean('target_init', 'utest.sh')
120        env.Clean('target_init', 'itest.sh')
121    
122        # Make sure that the escript wrapper is in place
123        if not os.path.isfile(os.path.join(env['bininstall'], 'run-escript')):
124            print("Copying escript wrapper.")
125            Execute(Copy(os.path.join(env['bininstall'],'run-escript'), 'bin/run-escript'))
126    
127  # Code to build .pyc from .py  # Code to build .pyc from .py
128  def build_py(target, source, env):  def build_py(target, source, env):
129      try:      try:
# Line 90  def build_py(target, source, env): Line 132  def build_py(target, source, env):
132      except py_compile.PyCompileError, e:      except py_compile.PyCompileError, e:
133         print e         print e
134         return 1         return 1
135          
136    
137  # Code to run unit_test executables  # Code to run unit_test executables
138  def runUnitTest(target, source, env):  def runUnitTest(target, source, env):

Legend:
Removed from v.4154  
changed lines
  Added in v.4295

  ViewVC Help
Powered by ViewVC 1.1.26