/[escript]/trunk/doc/SConscript
ViewVC logotype

Diff of /trunk/doc/SConscript

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

revision 2949 by gross, Thu Feb 25 05:23:11 2010 UTC revision 3328 by caltinay, Fri Oct 29 02:21:42 2010 UTC
# Line 11  Line 11 
11  #  #
12  ########################################################  ########################################################
13    
   
14  import os  import os
15  Import('*')  Import('*')
16    
17  #_deps is for files which end in .py and are required for  haveGMSH=False  # do we have gmsh?
18  # testing but should not be invoked directly themselves  haveMPL=False   # do we have matplotlib?
19  example_deps = ['cookbook/cblib.py',  haveGD=False    # does matplotlib have griddata?
   'cookbook/heatrefraction_mesher001.py',  
   'cookbook/heatrefraction_mesher002.py',  
   'cookbook/heatrefraction001.py',  
   'cookbook/heatrefraction002.py',  
 ]  
20    
21  #  # check for gmsh
22  # these are the release examples in example sub directory:  try:
23  #      import subprocess
24  example_files_allow_mpi = [      p=subprocess.Popen(['gmsh', '-version'], stderr=subprocess.PIPE)
25   'geotutorial/steadystate_variablek.py',      p.poll()
26   'geotutorial/steadystate.py',      haveGMSH=True
27   'geotutorial/forward_euler.py',  except OSError:
28   'geotutorial/myfirstscript.py',      print("gmsh not found")
  'geotutorial/backward_euler.py',  
  'usersguide/lit_driven_cavity.py',  
  'usersguide/mount.py',  
  'usersguide/heatedblock.py',  
  'usersguide/helmholtz.py',  
  'usersguide/fluid.py',  
  'usersguide/poisson.py',  
  'usersguide/diffusion.py',  
  'usersguide/poisson_vtk.py',  
  'usersguide/slip.py',  
  'usersguide/int_save.py',  
 ]  
   
 example_files_no_mpi = [  
 ]  
   
 haveGMSH=(os.system("gmsh -version")/256==0)    #Do we have gmsh installed?  
 haveMPL=False                   #Do we have matplotlib?  
 haveGD=False                    #Does the matplotlib have griddata?  
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 64  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.")
47    
48  if not haveGMSH:  example_files_allow_mpi = []
49     print "gmsh not found"  example_files_no_mpi = []
50    example_deps = []
51  example_files_allow_mpi.append('cookbook/example01a.py')  
52  example_files_allow_mpi.append('cookbook/twodheatdiffvtk.py')  def sortOutExample(name, needsGMSH=False, needsMPL=False, needsMagicMPL=False, needsGD=False, allowsMPI=True):
53  example_files_no_mpi.append('cookbook/wavesolver2d001.py')      if needsMagicMPL: needsMPL=True
54  example_files_no_mpi.append('cookbook/wavesolver2d002.py')      if needsGD: needsMPL=True
55        if needsGMSH: allowsMPI=False
56    
57  if haveMPL:      if (not needsGMSH or haveGMSH) and (not needsMPL or haveMPL) and (not needsMagicMPL or mplversion>=mplmagicversion) and (not needsGD or haveGD):
58     example_files_no_mpi.append('cookbook/example01b.py')          if allowsMPI:
59     example_files_no_mpi.append('cookbook/example01c.py')              example_files_allow_mpi.append(name)
60     example_files_no_mpi.append('cookbook/example02.py')          else:
61     if mplversion>=mplmagicversion:              example_files_no_mpi.append(name)
62      example_files_no_mpi.append('cookbook/twodheatdiff001.py')      else:
63      example_files_no_mpi.append('usersguide/poisson_matplotlib.py')          example_deps.append(name)
     example_files_allow_mpi.append('usersguide/wave.py')  
     if haveGMSH:  
         example_files_no_mpi.append('cookbook/run_heatrefraction.py')  
 if haveGMSH:  
   example_files_no_mpi.append('usersguide/trapezoid.py')  
   example_files_no_mpi.append('usersguide/quad.py')  
   example_files_no_mpi.append('usersguide/brick.py')  
   example_files_no_mpi.append('usersguide/refine.py')  
   example_files_no_mpi.append('cookbook/simple_mesher001.py')  
   example_files_no_mpi.append('cookbook/simple_solver001.py')  
   example_files_no_mpi.append('cookbook/twodheatdiff001.py')  
   
 # we want to make sure these are still added to the examples bundle even if we can't run them  
 if not haveGMSH:  
    example_deps.append('cookbook/run_heatrefraction.py')  
    example_deps.append('usersguide/trapezoid.py')  
    example_deps.append('usersguide/quad.py')  
    example_deps.append('usersguide/brick.py')  
    example_deps.append('usersguide/refine.py')  
    example_deps.append('cookbook/simple_mesher001.py')  
    example_deps.append('cookbook/simple_solver001.py')  
    example_deps.append('cookbook/twodheatdiff001.py')  
 if not haveGD:  
    example_deps.append('cookbook/twodheatdiff001.py')  
    example_deps.append('usersguide/poisson_matplotlib.py')  
    example_deps.append('usersguide/wave.py')  
 if not haveMPL:  
    example_deps.append('cookbook/example01b.py')  
    example_deps.append('cookbook/example01c.py')  
    example_deps.append('cookbook/example02.py')  
64    
65    # these are the release examples in example subdirectory:
66    #
67    #_deps is for files which end in .py and are required for
68    # testing but should not be invoked directly themselves
69    
70  example_files= example_files_allow_mpi + example_files_no_mpi + example_deps  sortOutExample('usersguide/lid_driven_cavity.py')
71    sortOutExample('usersguide/mount.py')
72    sortOutExample('usersguide/heatedblock.py')
73    sortOutExample('usersguide/helmholtz.py')
74    sortOutExample('usersguide/fluid.py')
75    sortOutExample('usersguide/poisson.py')
76    sortOutExample('usersguide/diffusion.py')
77    sortOutExample('usersguide/poisson_vtk.py')
78    sortOutExample('usersguide/slip.py')
79    sortOutExample('usersguide/int_save.py')
80    sortOutExample('usersguide/wave.py', needsMPL=True)
81    sortOutExample('usersguide/trapezoid.py', needsGMSH=True)
82    sortOutExample('usersguide/quad.py', needsGMSH=True)
83    sortOutExample('usersguide/brick.py', needsGMSH=True)
84    sortOutExample('usersguide/refine.py', needsGMSH=True)
85    sortOutExample('usersguide/poisson_matplotlib.py', needsGD=True, allowsMPI=False)
86    
87    sortOutExample('geotutorial/steadystate_variablek.py')
88    sortOutExample('geotutorial/steadystate.py')
89    sortOutExample('geotutorial/forward_euler.py')
90    sortOutExample('geotutorial/myfirstscript.py')
91    sortOutExample('geotutorial/backward_euler.py')
92    
93    example_deps.append('cookbook/cblib.py')
94    sortOutExample('cookbook/example01a.py')
95    sortOutExample('cookbook/example01b.py', needsMPL=True)
96    sortOutExample('cookbook/example01c.py', needsMPL=True, allowsMPI=False)
97    sortOutExample('cookbook/example02.py', needsMPL=True, allowsMPI=False)
98    sortOutExample('cookbook/example03a.py', needsGD=True, allowsMPI=False)
99    sortOutExample('cookbook/example03b.py')
100    sortOutExample('cookbook/example04a.py', needsGMSH=True)
101    sortOutExample('cookbook/example04b.py', needsGMSH=True, needsGD=True)
102    sortOutExample('cookbook/example05a.py', needsGMSH=True, needsGD=True)
103    sortOutExample('cookbook/example05b.py', needsGMSH=True, needsGD=True)
104    sortOutExample('cookbook/example05c.py', needsGMSH=True, needsGD=True, needsMagicMPL=True)
105    sortOutExample('cookbook/example06.py', needsGMSH=True, needsGD=True, needsMagicMPL=True)
106    sortOutExample('cookbook/example07a.py', needsMagicMPL=True, allowsMPI=False)
107    sortOutExample('cookbook/example07b.py', needsMagicMPL=True, allowsMPI=False)
108    sortOutExample('cookbook/example08a.py', needsMagicMPL=True, allowsMPI=False)
109    sortOutExample('cookbook/example08b.py', needsMagicMPL=True, allowsMPI=False)
110    sortOutExample('cookbook/example08c.py', needsMagicMPL=True, needsGMSH=True, allowsMPI=False)
111    #sortOutExample('cookbook/example09m.py', needsMagicMPL=True, needsGMSH=True, allowsMPI=False)
112    #sortOutExample('cookbook/example09a.py', needsMagicMPL=True, needsGMSH=True, allowsMPI=False)
113    #sortOutExample('cookbook/example09b.py', needsMagicMPL=True, needsGMSH=True, allowsMPI=False)
114    
115    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]  ex2=[os.path.join("examples", str(x)) for x in example_files]
118    
119  #==========================================================================================  #=============================================================================
120    
121  local_env = clone_env(env)  local_env = env.Clone()
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=os.path.join(env['prefix'],'release','doc')
124    Export('release_dir')
125    
126  dir_cmd = "cd "+src_dir+" && "  dir_cmd = "cd "+src_dir+" && "
127    
128  tmp1 = local_env.Command("#/release/doc/escript_examples.zip", None,  # Need to use explicit tar/zip rather than the builder due to problems getting
129  dir_cmd+"zip "+os.path.join(release_dir,"escript_examples.zip ") +" ".join(ex2),  # it not to put unwanted path components in the archive file
130  #chdir=src_dir  # --transform on tar is not supported on savanna
131  )  zip_path=os.path.join(release_dir, 'escript_examples.zip')
132  env.Alias('examples_zipfile', tmp1)  zip = local_env.Command(zip_path, None, dir_cmd+"zip "+zip_path+" "+" ".join(ex2))
133    env.Alias('examples_zipfile', zip)
134    
135  #Need to use explicit tar rather than the tar builder due to problems getting it not to put  tar_path=os.path.join(release_dir, 'escript_examples.tar.gz')
136  #unwanted path components in the tar file  tar = local_env.Command(tar_path, None, dir_cmd+"tar -czf "+tar_path+" "+" ".join(ex2))
137  #--transform on tar is not supported on savanna  env.Alias('examples_tarfile', tar)
 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  
 )  
 env.Alias('examples_tarfile',tmp2)  
138    
139  #env=Environment(TARFLAGS = "-c -z",chdir=src_dir)  #env=Environment(TARFLAGS = "-c -z",chdir=src_dir)
140  #if 'Tar' in dir(env): env.Tar('#/release/doc/escript_examples.tar.gz', example_files,chdir=src_dir)  #if 'Tar' in dir(env):
141  #env.Alias('examples_tarfile', '#release/doc/escript_examples.tar.gz')  # tar=env.Tar(tar_path, example_files, chdir=src_dir)
142    # env.Alias('examples_tarfile', tar)
143  local_env.SConscript(dirs = ['#/doc/cookbook'], build_dir='#/build/$PLATFORM/doc/cookbook', duplicate=1)  
144  local_env.SConscript(dirs = ['#/doc/user'], build_dir='#/build/$PLATFORM/doc/user', duplicate=1)  local_env.SConscript(dirs = ['#/doc/cookbook'], variant_dir='#/build/$PLATFORM/doc/cookbook', duplicate=1)
145  local_env.SConscript(dirs = ['#/doc/epydoc'], build_dir='#/build/$PLATFORM/doc/epydoc', duplicate=1)  local_env.SConscript(dirs = ['#/doc/user'], variant_dir='#/build/$PLATFORM/doc/user', duplicate=1)
146  local_env.SConscript(dirs = ['#/doc/doxygen'], build_dir='#/build/$PLATFORM/doc/doxygen', duplicate=1)  local_env.SConscript(dirs = ['#/doc/epydoc'], variant_dir='#/build/$PLATFORM/doc/epydoc', duplicate=1)
147  local_env.SConscript(dirs = ['#/doc/install'], build_dir='#/build/$PLATFORM/doc/install', duplicate=1)  local_env.SConscript(dirs = ['#/doc/doxygen'], variant_dir='#/build/$PLATFORM/doc/doxygen', duplicate=1)
148  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' ])  local_env.SConscript(dirs = ['#/doc/install'], variant_dir='#/build/$PLATFORM/doc/install', duplicate=1)
149    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'])
150    

Legend:
Removed from v.2949  
changed lines
  Added in v.3328

  ViewVC Help
Powered by ViewVC 1.1.26