/[escript]/branches/domexper/doc/SConscript
ViewVC logotype

Diff of /branches/domexper/doc/SConscript

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

revision 3250 by jfenwick, Mon Oct 4 05:22:56 2010 UTC revision 3251 by jfenwick, Thu Oct 7 04:02:30 2010 UTC
# Line 11  Line 11 
11  #  #
12  ########################################################  ########################################################
13    
   
14  import os  import os
15  Import('*')  Import('*')
16    
17    haveGMSH=False  # do we have gmsh?
18    haveMPL=False   # do we have matplotlib?
19    haveGD=False    # does matplotlib have griddata?
20    
21  haveGMSH=(os.system("gmsh -version")/256==0)    #Do we have gmsh installed?  # check for gmsh
22  haveMPL=False                   #Do we have matplotlib?  try:
23  haveGD=False                    #Does the matplotlib have griddata?      import subprocess
24        p=subprocess.Popen(['gmsh', '-version'], stderr=subprocess.PIPE)
25        p.poll()
26        haveGMSH=True
27    except OSError:
28        print("gmsh not found")
29    
30  mplmagicversion='0.98.5'  mplmagicversion='0.98.5'
31    
32    # check for matplotlib
33  try:  try:
34     import matplotlib     import matplotlib
35     haveMPL=True     haveMPL=True
# Line 32  except ImportError: Line 40  except ImportError:
40     pass     pass
41    
42  if not haveMPL:  if not haveMPL:
43     print "matplotlib not found skipping some tests"      print("matplotlib not found, skipping some tests")
44  else:  else:
45     if mplversion<mplmagicversion:      if mplversion<mplmagicversion:
46      print "matplotlib found but version too early. Some tests skipped."          print("matplotlib found, but version too early. Some tests skipped.")
   
 if not haveGMSH:  
    print "gmsh not found"  
47    
48  example_files_allow_mpi = [ ]  example_files_allow_mpi = []
49  example_files_no_mpi = [ ]  example_files_no_mpi = []
50  example_deps = [ ]  example_deps = []
51    
52  def sortOutExample(name, needsGMSH=False, needsMPL=False, needsMagicMPL=False, needsGD=False, allowsMPI=True):  def sortOutExample(name, needsGMSH=False, needsMPL=False, needsMagicMPL=False, needsGD=False, allowsMPI=True):
53       if needsMagicMPL: needsMPL=True      if needsMagicMPL: needsMPL=True
54       if needsGD: needsMPL=True      if needsGD: needsMPL=True
55       if needsGMSH: allowsMPI=False      if needsGMSH: allowsMPI=False
56    
57       if (not needsGMSH or haveGMSH) and (not needsMPL or haveMPL) and (not needsMagicMPL or mplversion>=mplmagicversion) and (not needsGD or haveGD):      if (not needsGMSH or haveGMSH) and (not needsMPL or haveMPL) and (not needsMagicMPL or mplversion>=mplmagicversion) and (not needsGD or haveGD):
58            if allowsMPI:          if allowsMPI:
59                example_files_allow_mpi.append(name)              example_files_allow_mpi.append(name)
60            else:          else:
61                example_files_no_mpi.append(name)              example_files_no_mpi.append(name)
62       else:      else:
63            example_deps.append(name)          example_deps.append(name)
64  #  
65  # these are the release examples in example sub directory:  # these are the release examples in example subdirectory:
66  #  #
67  #_deps is for files which end in .py and are required for  #_deps is for files which end in .py and are required for
68  # testing but should not be invoked directly themselves  # testing but should not be invoked directly themselves
69    
70  sortOutExample( 'usersguide/heatedblock.py')  sortOutExample('usersguide/lit_driven_cavity.py')
71  sortOutExample( 'usersguide/helmholtz.py')  sortOutExample('usersguide/mount.py')
72  sortOutExample( 'usersguide/fluid.py')  sortOutExample('usersguide/heatedblock.py')
73  sortOutExample( 'usersguide/poisson.py')  sortOutExample('usersguide/helmholtz.py')
74  sortOutExample( 'usersguide/diffusion.py')  sortOutExample('usersguide/fluid.py')
75  sortOutExample( 'usersguide/poisson_vtk.py')  sortOutExample('usersguide/poisson.py')
76  sortOutExample( 'usersguide/slip.py')  sortOutExample('usersguide/diffusion.py')
77  sortOutExample( 'usersguide/int_save.py')  sortOutExample('usersguide/poisson_vtk.py')
78  sortOutExample( 'usersguide/wave.py', needsMPL=True)  sortOutExample('usersguide/slip.py')
79  sortOutExample( 'usersguide/trapezoid.py', needsGMSH=True)  sortOutExample('usersguide/int_save.py')
80  sortOutExample( 'usersguide/quad.py', needsGMSH=True)  sortOutExample('usersguide/wave.py', needsMPL=True)
81  sortOutExample( 'usersguide/brick.py', needsGMSH=True)  sortOutExample('usersguide/trapezoid.py', needsGMSH=True)
82  sortOutExample( 'usersguide/refine.py', needsGMSH=True)  sortOutExample('usersguide/quad.py', needsGMSH=True)
83  sortOutExample( 'usersguide/poisson_matplotlib.py',  needsGD=True, allowsMPI=False)  sortOutExample('usersguide/brick.py', needsGMSH=True)
84    sortOutExample('usersguide/refine.py', needsGMSH=True)
85  sortOutExample( 'geotutorial/steadystate_variablek.py')  sortOutExample('usersguide/poisson_matplotlib.py', needsGD=True, allowsMPI=False)
86  sortOutExample( 'geotutorial/steadystate.py')  
87  sortOutExample( 'geotutorial/forward_euler.py')  sortOutExample('geotutorial/steadystate_variablek.py')
88  sortOutExample( 'geotutorial/myfirstscript.py')  sortOutExample('geotutorial/steadystate.py')
89  sortOutExample( 'geotutorial/backward_euler.py')  sortOutExample('geotutorial/forward_euler.py')
90    sortOutExample('geotutorial/myfirstscript.py')
91    sortOutExample('geotutorial/backward_euler.py')
92    
93  example_deps.append('cookbook/cblib.py')  example_deps.append('cookbook/cblib.py')
94  sortOutExample('cookbook/example01a.py')  sortOutExample('cookbook/example01a.py')
# Line 105  sortOutExample('cookbook/example08c.py', Line 112  sortOutExample('cookbook/example08c.py',
112  #sortOutExample('cookbook/example09a.py', needsMagicMPL=True, needsGMSH=True, allowsMPI=False)  #sortOutExample('cookbook/example09a.py', needsMagicMPL=True, needsGMSH=True, allowsMPI=False)
113  #sortOutExample('cookbook/example09b.py', needsMagicMPL=True, needsGMSH=True, allowsMPI=False)  #sortOutExample('cookbook/example09b.py', needsMagicMPL=True, needsGMSH=True, allowsMPI=False)
114    
115  example_files= example_files_allow_mpi + example_files_no_mpi + example_deps  example_files = example_files_allow_mpi + example_files_no_mpi + example_deps
116    
117    ex2=[os.path.join("examples", str(x)) for x in example_files]
118    
119  ex2=[ os.path.join("examples",str(x)) for x in example_files]  #=============================================================================
120    
121  #==========================================================================================  local_env = env.Clone()
   
 local_env = clone_env(env)  
122  src_dir = local_env.Dir('.').srcnode().abspath  src_dir = local_env.Dir('.').srcnode().abspath
123  release_dir=local_env.Dir('#/release/doc/').srcnode().abspath  release_dir=local_env.Dir('#/release/doc/').srcnode().abspath
124    
125  dir_cmd = "cd "+src_dir+" && "  dir_cmd = "cd "+src_dir+" && "
126    
127  tmp1 = local_env.Command("#/release/doc/escript_examples.zip", None,  tmp1 = local_env.Command("#/release/doc/escript_examples.zip", None, dir_cmd+"zip "+os.path.join(release_dir,"escript_examples.zip ") +" ".join(ex2))
 dir_cmd+"zip "+os.path.join(release_dir,"escript_examples.zip ") +" ".join(ex2),  
 #chdir=src_dir  
 )  
128  env.Alias('examples_zipfile', tmp1)  env.Alias('examples_zipfile', tmp1)
129    
130    # Need to use explicit tar rather than the tar builder due to problems getting
131  #Need to use explicit tar rather than the tar builder due to problems getting it not to put  # it not to put unwanted path components in the tar file
132  #unwanted path components in the tar file  # --transform on tar is not supported on savanna
133  #--transform on tar is not supported on savanna  tmp2 = local_env.Command("#/release/doc/escript_examples.tar.gz", None, dir_cmd+"tar -czf "+os.path.join(release_dir,"escript_examples.tar.gz ")+"  ".join(ex2))
 tmp2 = local_env.Command("#/release/doc/escript_examples.tar.gz", None, dir_cmd+"tar -czf "+os.path.join(release_dir,"escript_examples.tar.gz ")+"  ".join(ex2),  
 # chdir=src_dir  
 )  
134  env.Alias('examples_tarfile',tmp2)  env.Alias('examples_tarfile',tmp2)
135    
136  #env=Environment(TARFLAGS = "-c -z",chdir=src_dir)  #env=Environment(TARFLAGS = "-c -z",chdir=src_dir)
137  #if 'Tar' in dir(env): env.Tar('#/release/doc/escript_examples.tar.gz', example_files,chdir=src_dir)  #if 'Tar' in dir(env): env.Tar('#/release/doc/escript_examples.tar.gz', example_files,chdir=src_dir)
138  #env.Alias('examples_tarfile', '#release/doc/escript_examples.tar.gz')  #env.Alias('examples_tarfile', '#release/doc/escript_examples.tar.gz')
139    
140  CallSConscript(local_env, dirs = ['#/doc/cookbook'], variant_dir='#/build/$PLATFORM/doc/cookbook', duplicate=1)  local_env.SConscript(dirs = ['#/doc/cookbook'], variant_dir='#/build/$PLATFORM/doc/cookbook', duplicate=1)
141  CallSConscript(local_env, dirs = ['#/doc/user'], variant_dir='#/build/$PLATFORM/doc/user', duplicate=1)  local_env.SConscript(dirs = ['#/doc/user'], variant_dir='#/build/$PLATFORM/doc/user', duplicate=1)
142  CallSConscript(local_env, dirs = ['#/doc/epydoc'], variant_dir='#/build/$PLATFORM/doc/epydoc', duplicate=1)  local_env.SConscript(dirs = ['#/doc/epydoc'], variant_dir='#/build/$PLATFORM/doc/epydoc', duplicate=1)
143  CallSConscript(local_env, dirs = ['#/doc/doxygen'], variant_dir='#/build/$PLATFORM/doc/doxygen', duplicate=1)  local_env.SConscript(dirs = ['#/doc/doxygen'], variant_dir='#/build/$PLATFORM/doc/doxygen', duplicate=1)
144  CallSConscript(local_env, dirs = ['#/doc/install'], variant_dir='#/build/$PLATFORM/doc/install', duplicate=1)  local_env.SConscript(dirs = ['#/doc/install'], variant_dir='#/build/$PLATFORM/doc/install', duplicate=1)
145    local_env.SConscript(dirs = ['#/doc/examples'], variant_dir='#/build/$PLATFORM/doc/examples', duplicate=1, exports=['example_files_allow_mpi', 'example_files_no_mpi', 'example_deps'])
146    
   
 #For some reason my CallSConscript wrapper fails when you want to use the exports= keyword  
 if cantusevariantdir:  
     local_env.SConscript(dirs = ['#/doc/examples'], build_dir='#/build/$PLATFORM/doc/examples', duplicate=1, exports=[ 'example_files_allow_mpi' , 'example_files_no_mpi', 'example_deps' ])  
 else:  
     local_env.SConscript(dirs = ['#/doc/examples'], variant_dir='#/build/$PLATFORM/doc/examples', duplicate=1, exports=[ 'example_files_allow_mpi' , 'example_files_no_mpi', 'example_deps' ])  

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

  ViewVC Help
Powered by ViewVC 1.1.26