/[escript]/branches/4.0fordebian/site_scons/site_init.py
ViewVC logotype

Diff of /branches/4.0fordebian/site_scons/site_init.py

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

branches/domexper/site_scons/site_init.py revision 3251 by jfenwick, Thu Oct 7 04:02:30 2010 UTC trunk/site_scons/site_init.py revision 3975 by caltinay, Thu Sep 20 01:54:06 2012 UTC
# Line 1  Line 1 
1    
2  ########################################################  ########################################################
3  #  #
4  # Copyright (c) 2003-2010 by University of Queensland  # Copyright (c) 2003-2012 by University of Queensland
5  # Earth Systems Science Computational Center (ESSCC)  # Earth Systems Science Computational Center (ESSCC)
6  # http://www.uq.edu.au/esscc  # http://www.uq.edu.au/esscc
7  #  #
# Line 11  Line 11 
11  #  #
12  ########################################################  ########################################################
13    
14  __copyright__="""Copyright (c) 2003-2010 by University of Queensland  __copyright__="""Copyright (c) 2003-2012 by University of Queensland
15  Earth Systems Science Computational Center (ESSCC)  Earth Systems Science Computational Center (ESSCC)
16  http://www.uq.edu.au/esscc  http://www.uq.edu.au/esscc
17  Primary Business: Queensland, Australia"""  Primary Business: Queensland, Australia"""
# Line 19  __license__="""Licensed under the Open S Line 19  __license__="""Licensed under the Open S
19  http://www.opensource.org/licenses/osl-3.0.php"""  http://www.opensource.org/licenses/osl-3.0.php"""
20  __url__="https://launchpad.net/escript-finley"  __url__="https://launchpad.net/escript-finley"
21    
22  import sys, os, time, glob, fnmatch, types, py_compile, re  import sys, os, time, py_compile, re, subprocess
23    
24  def findLibWithHeader(env, libs, header, paths, lang='c'):  def findLibWithHeader(env, libs, header, paths, lang='c'):
25      from SCons.Script.SConscript import Configure      from SCons.Script.SConscript import Configure
# Line 69  def findLibWithHeader(env, libs, header, Line 69  def findLibWithHeader(env, libs, header,
69      conf.Finish()      conf.Finish()
70      return inc_path, lib_path      return inc_path, lib_path
71    
72    def detectModule(env, module):
73        if env['pythoncmd']=='python':
74            try:
75                __import__(module)
76            except ImportError:
77                return False
78        else:
79            p=subprocess.call([env['pythoncmd'],'-c','import %s'%module])
80            if p!=0:
81                return False
82        return True
83    
84  # Code to build .pyc from .py  # Code to build .pyc from .py
85  def build_py(target, source, env):  def build_py(target, source, env):
86      py_compile.compile(str(source[0]), str(target[0]))      try:
87      return 0         py_compile.compile(str(source[0]), str(target[0]), doraise=True)
88           return 0
89        except py_compile.PyCompileError, e:
90           print e
91           return 1
92          
93    
94  # Code to run unit_test executables  # Code to run unit_test executables
95  def runUnitTest(target, source, env):  def runUnitTest(target, source, env):
# Line 80  def runUnitTest(target, source, env): Line 97  def runUnitTest(target, source, env):
97    app = str(source[0].abspath)    app = str(source[0].abspath)
98    pn, sn= os.path.split(app)    pn, sn= os.path.split(app)
99    if not os.name== "nt":    if not os.name== "nt":
100       app = "cd "+pn+"; "+os.path.join(env['bininstall'],"escript")+" -bv "+os.path.join('.',sn)       app = "cd "+pn+"; "+os.path.join(env['bininstall'], "run-escript")+" -bv "+os.path.join('.',sn)
101    else:    else:
102        if env['usempi']:        if env['usempi']:
103            app = "cd %s & mpiexec -np %s -genvlist PYTHONPATH,OMP_NUM_THREADS,"\            app = "cd %s & mpiexec -np %s -genvlist PYTHONPATH,OMP_NUM_THREADS,"\
# Line 108  def runPyUnitTest(target, source, env): Line 125  def runPyUnitTest(target, source, env):
125         else:         else:
126             app = "cd "+ pn +" & "+sys.executable + " " + sn             app = "cd "+ pn +" & "+sys.executable + " " + sn
127     else:     else:
128       app = "cd "+pn+"; "+os.path.join(env['bininstall'],"escript")+" -ov "+sn       app = "cd "+pn+"; "+os.path.join(env['bininstall'], "run-escript")+" -ov "+sn
129     print "Executing test: ",app     print "Executing test: ",app
130     if env.Execute(app) == 0:     if env.Execute(app) == 0:
131        open(str(target[0]),'w').write("PASSED\n")        open(str(target[0]),'w').write("PASSED\n")
# Line 119  def runPyUnitTest(target, source, env): Line 136  def runPyUnitTest(target, source, env):
136    
137  def eps2pdf(target, source, env):  def eps2pdf(target, source, env):
138  #   if env.Execute("epstopdf "+str(source[0].abspath)+" -o "+str(target[0].abspath))!=0:  #   if env.Execute("epstopdf "+str(source[0].abspath)+" -o "+str(target[0].abspath))!=0:
139     if env.Execute("ps2pdf "+str(source[0].abspath)+" "+str(target[0].abspath))!=0:     if env.Execute("ps2pdf -dEPSCrop "+str(source[0].abspath)+" "+str(target[0].abspath))!=0:
140         return 1         return 1
141     return None     return None
142    

Legend:
Removed from v.3251  
changed lines
  Added in v.3975

  ViewVC Help
Powered by ViewVC 1.1.26