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

Annotation of /trunk/doc/SConscript

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4045 - (hide annotations)
Tue Oct 30 03:57:22 2012 UTC (6 years, 11 months ago) by caltinay
File size: 7525 byte(s)
Imported inversion cookbook.

1 ksteube 1811
2 jfenwick 3982 ##############################################################################
3 cochrane 369 #
4 jfenwick 3911 # Copyright (c) 2003-2012 by University of Queensland
5 jfenwick 3982 # http://www.uq.edu.au
6 elspeth 643 #
7 ksteube 1811 # Primary Business: Queensland, Australia
8     # Licensed under the Open Software License version 3.0
9     # http://www.opensource.org/licenses/osl-3.0.php
10 ksteube 1705 #
11 jfenwick 3982 # Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12     # Development since 2012 by School of Earth Sciences
13     #
14     ##############################################################################
15 cochrane 369
16 gross 707 import os
17     Import('*')
18 jfenwick 2648
19 jfenwick 3892 from subprocess import PIPE, Popen
20    
21 jfenwick 3259 haveMPL=False # do we have matplotlib?
22     haveGD=False # does matplotlib have griddata?
23 jfenwick 2648
24 jfenwick 2674 mplmagicversion='0.98.5'
25    
26 jfenwick 3259 # check for matplotlib
27 jfenwick 3892 if env['pythoncmd']=='python':
28     try:
29 caltinay 3463 import matplotlib
30     haveMPL=True
31     mplversion=matplotlib.__version__
32     from matplotlib.mlab import griddata
33     haveGD=True
34 jfenwick 3892 except ImportError:
35 caltinay 3463 pass
36 jfenwick 3892 else:
37     # we need to fire up the external command
38     p=Popen([env['pythoncmd'], '-c', 'from __future__ import print_function;import matplotlib;print(matplotlib.__version__);from matplotlib.mlab import griddata;print("1")'], stdout=PIPE)
39     try:
40     mplversion=p.stdout.readline().strip()
41     haveMPL=True
42     hgd=p.stdout.readline().strip()
43     haveGD=True
44     except IOError:
45     pass
46     p.wait()
47 jfenwick 2578
48 jfenwick 2667 if not haveMPL:
49 jfenwick 3259 print("matplotlib not found, skipping some tests")
50 jfenwick 2667 else:
51 jfenwick 3259 if mplversion<mplmagicversion:
52     print("matplotlib found, but version too early. Some tests skipped.")
53 jfenwick 2667
54 jfenwick 3259 example_files_allow_mpi = []
55     example_files_no_mpi = []
56     example_deps = []
57 caltinay 3595 skipped_tests = []
58 jfenwick 2667
59 gross 2950 def sortOutExample(name, needsGMSH=False, needsMPL=False, needsMagicMPL=False, needsGD=False, allowsMPI=True):
60 jfenwick 3259 if needsMagicMPL: needsMPL=True
61     if needsGD: needsMPL=True
62     if needsGMSH: allowsMPI=False
63 jfenwick 2667
64 caltinay 3595 if needsGMSH and not env['gmsh']:
65     skipped_tests.append(name)
66     return
67    
68 caltinay 3463 if (not needsGMSH or env['gmsh']) and (not needsMPL or haveMPL) and (not needsMagicMPL or mplversion>=mplmagicversion) and (not needsGD or haveGD):
69 jfenwick 3259 if allowsMPI:
70     example_files_allow_mpi.append(name)
71     else:
72     example_files_no_mpi.append(name)
73     else:
74     example_deps.append(name)
75    
76     # these are the release examples in example subdirectory:
77 gross 2950 #
78     #_deps is for files which end in .py and are required for
79     # testing but should not be invoked directly themselves
80 jfenwick 2667
81 caltinay 3328 sortOutExample('usersguide/lid_driven_cavity.py')
82 jfenwick 3259 sortOutExample('usersguide/mount.py')
83     sortOutExample('usersguide/heatedblock.py')
84     sortOutExample('usersguide/helmholtz.py')
85     sortOutExample('usersguide/fluid.py')
86     sortOutExample('usersguide/poisson.py')
87     sortOutExample('usersguide/diffusion.py')
88     sortOutExample('usersguide/poisson_vtk.py')
89 gross 3629 sortOutExample('usersguide/darcy.py')
90 jfenwick 3259 sortOutExample('usersguide/slip.py')
91     sortOutExample('usersguide/int_save.py')
92     sortOutExample('usersguide/wave.py', needsMPL=True)
93 jfenwick 3940 sortOutExample('usersguide/trapezoid.py', needsGMSH=True, allowsMPI=False)
94 jfenwick 3259 sortOutExample('usersguide/quad.py', needsGMSH=True)
95     sortOutExample('usersguide/brick.py', needsGMSH=True)
96     sortOutExample('usersguide/refine.py', needsGMSH=True)
97     sortOutExample('usersguide/poisson_matplotlib.py', needsGD=True, allowsMPI=False)
98 gross 2950
99 jfenwick 3259 sortOutExample('geotutorial/steadystate_variablek.py')
100     sortOutExample('geotutorial/steadystate.py')
101     sortOutExample('geotutorial/forward_euler.py')
102     sortOutExample('geotutorial/myfirstscript.py')
103     sortOutExample('geotutorial/backward_euler.py')
104 gross 2950
105     example_deps.append('cookbook/cblib.py')
106     sortOutExample('cookbook/example01a.py')
107     sortOutExample('cookbook/example01b.py', needsMPL=True)
108     sortOutExample('cookbook/example01c.py', needsMPL=True, allowsMPI=False)
109     sortOutExample('cookbook/example02.py', needsMPL=True, allowsMPI=False)
110     sortOutExample('cookbook/example03a.py', needsGD=True, allowsMPI=False)
111     sortOutExample('cookbook/example03b.py')
112 gross 2951 sortOutExample('cookbook/example04a.py', needsGMSH=True)
113     sortOutExample('cookbook/example04b.py', needsGMSH=True, needsGD=True)
114 gross 2952 sortOutExample('cookbook/example05a.py', needsGMSH=True, needsGD=True)
115     sortOutExample('cookbook/example05b.py', needsGMSH=True, needsGD=True)
116 artak 2973 sortOutExample('cookbook/example05c.py', needsGMSH=True, needsGD=True, needsMagicMPL=True)
117 artak 2974 sortOutExample('cookbook/example06.py', needsGMSH=True, needsGD=True, needsMagicMPL=True)
118 jfenwick 3208 sortOutExample('cookbook/example07a.py', needsMagicMPL=True, allowsMPI=False)
119     sortOutExample('cookbook/example07b.py', needsMagicMPL=True, allowsMPI=False)
120     sortOutExample('cookbook/example08a.py', needsMagicMPL=True, allowsMPI=False)
121     sortOutExample('cookbook/example08b.py', needsMagicMPL=True, allowsMPI=False)
122     sortOutExample('cookbook/example08c.py', needsMagicMPL=True, needsGMSH=True, allowsMPI=False)
123 ahallam 3385 sortOutExample('cookbook/example09m.py', needsMagicMPL=True, needsGMSH=True, allowsMPI=False)
124     sortOutExample('cookbook/example09a.py', needsMagicMPL=True, needsGMSH=True, allowsMPI=False)
125 ahallam 3405 #sortOutExample('cookbook/example09b.py', needsMagicMPL=True, needsGMSH=True, allowsMPI=False)
126 ahallam 3425 sortOutExample('cookbook/example10a.py', needsMagicMPL=True, allowsMPI=False)
127     sortOutExample('cookbook/example10b.py', needsMagicMPL=True, allowsMPI=False)
128     sortOutExample('cookbook/example10m.py', needsMagicMPL=True, needsGMSH=True, allowsMPI=False)
129 ahallam 3447 #sortOutExample('cookbook/example10c_0.py', needsMagicMPL=True, needsGMSH=True, allowsMPI=False)
130     #sortOutExample('cookbook/example10c_1.py', needsMagicMPL=True, needsGMSH=True, allowsMPI=False)
131 ahallam 3425 sortOutExample('cookbook/example11a.py', needsMagicMPL=True, allowsMPI=False)
132     sortOutExample('cookbook/example11b.py', needsMagicMPL=True, allowsMPI=False)
133 gross 2950
134 caltinay 3595 if len(skipped_tests)>0:
135 jfenwick 3892 print("gmsh not available. Skipping tests %s!"%' '.join(skipped_tests))
136 ahallam 3425
137 jfenwick 3259 example_files = example_files_allow_mpi + example_files_no_mpi + example_deps
138 gross 2502
139 jfenwick 3259 ex2=[os.path.join("examples", str(x)) for x in example_files]
140 jfenwick 2503
141 jfenwick 3259 #=============================================================================
142 jfenwick 2503
143 jfenwick 3259 local_env = env.Clone()
144 jfenwick 2402 src_dir = local_env.Dir('.').srcnode().abspath
145 caltinay 3277 release_dir=os.path.join(env['prefix'],'release','doc')
146     Export('release_dir')
147 ksteube 1215
148 jfenwick 2923 dir_cmd = "cd "+src_dir+" && "
149    
150 caltinay 3277 # Need to use explicit tar/zip rather than the builder due to problems getting
151     # it not to put unwanted path components in the archive file
152 jfenwick 3259 # --transform on tar is not supported on savanna
153 caltinay 3277 zip_path=os.path.join(release_dir, 'escript_examples.zip')
154     zip = local_env.Command(zip_path, None, dir_cmd+"zip "+zip_path+" "+" ".join(ex2))
155     env.Alias('examples_zipfile', zip)
156 jfenwick 2405
157 caltinay 3277 tar_path=os.path.join(release_dir, 'escript_examples.tar.gz')
158     tar = local_env.Command(tar_path, None, dir_cmd+"tar -czf "+tar_path+" "+" ".join(ex2))
159     env.Alias('examples_tarfile', tar)
160    
161 jfenwick 2405 #env=Environment(TARFLAGS = "-c -z",chdir=src_dir)
162 caltinay 3277 #if 'Tar' in dir(env):
163     # tar=env.Tar(tar_path, example_files, chdir=src_dir)
164     # env.Alias('examples_tarfile', tar)
165 jfenwick 2405
166 caltinay 4045 local_env.SConscript(dirs = ['#/doc/cookbook'], variant_dir='cookbook', duplicate=1)
167     local_env.SConscript(dirs = ['#/doc/user'], variant_dir='user', duplicate=1)
168     local_env.SConscript(dirs = ['#/doc/inversion'], variant_dir='inversion', duplicate=1)
169     local_env.SConscript(dirs = ['#/doc/epydoc'], variant_dir='epydoc', duplicate=1)
170     local_env.SConscript(dirs = ['#/doc/doxygen'], variant_dir='doxygen', duplicate=1)
171     local_env.SConscript(dirs = ['#/doc/install'], variant_dir='install', duplicate=1)
172     local_env.SConscript(dirs = ['#/doc/examples'], variant_dir='examples', duplicate=1, exports=['example_files_allow_mpi', 'example_files_no_mpi', 'example_deps'])
173 ksteube 1705

  ViewVC Help
Powered by ViewVC 1.1.26