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

Contents of /branches/doubleplusgood/doc/SConscript

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4345 - (show annotations)
Fri Mar 29 07:09:41 2013 UTC (5 years, 11 months ago) by jfenwick
File size: 8810 byte(s)
Spelling fixes
1
2 ##############################################################################
3 #
4 # Copyright (c) 2003-2013 by University of Queensland
5 # http://www.uq.edu.au
6 #
7 # 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 #
11 # Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 # Development since 2012 by School of Earth Sciences
13 #
14 ##############################################################################
15
16 import os
17 Import('*')
18
19 from subprocess import PIPE, Popen
20
21 haveMPL=False # do we have matplotlib?
22 haveGD=False # does matplotlib have griddata?
23
24 mplmagicversion='0.98.5'
25
26 # check for matplotlib
27 if env['pythoncmd']=='python':
28 try:
29 import matplotlib
30 haveMPL=True
31 mplversion=matplotlib.__version__
32 from matplotlib.mlab import griddata
33 haveGD=True
34 except ImportError:
35 pass
36 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
48 if not haveMPL:
49 env['warnings'].append("matplotlib not found, will skip some unit tests")
50 else:
51 if mplversion<mplmagicversion:
52 env['warnings'].append("matplotlib found, but version too early. Some unit tests will be skipped.")
53
54 example_files_allow_mpi = []
55 example_files_no_mpi = []
56 example_deps = []
57 skipped_tests = []
58
59 def sortOutExample(name, needsGMSH=False, needsMPL=False, needsMagicMPL=False, needsGD=False, allowsMPI=True):
60 if needsMagicMPL: needsMPL=True
61 if needsGD: needsMPL=True
62 if needsGMSH: allowsMPI=False
63
64 if needsGMSH and not env['gmsh']:
65 skipped_tests.append(name)
66 return
67
68 if (not needsGMSH or env['gmsh']) and (not needsMPL or haveMPL) and (not needsMagicMPL or mplversion>=mplmagicversion) and (not needsGD or haveGD):
69 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 #
78 #_deps is for files which end in .py and are required for
79 # testing but should not be invoked directly themselves
80
81 sortOutExample('usersguide/lid_driven_cavity.py')
82 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 sortOutExample('usersguide/darcy.py')
90 sortOutExample('usersguide/slip.py')
91 sortOutExample('usersguide/int_save.py')
92 sortOutExample('usersguide/wave.py', needsMPL=True)
93 sortOutExample('usersguide/trapezoid.py', needsGMSH=True, allowsMPI=False)
94 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
99 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
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 sortOutExample('cookbook/example04a.py', needsGMSH=True)
113 sortOutExample('cookbook/example04b.py', needsGMSH=True, needsGD=True)
114 sortOutExample('cookbook/example05a.py', needsGMSH=True, needsGD=True)
115 sortOutExample('cookbook/example05b.py', needsGMSH=True, needsGD=True)
116 sortOutExample('cookbook/example05c.py', needsGMSH=True, needsGD=True, needsMagicMPL=True)
117 sortOutExample('cookbook/example06.py', needsGMSH=True, needsGD=True, needsMagicMPL=True)
118 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 sortOutExample('cookbook/example09m.py', needsMagicMPL=True, needsGMSH=True, allowsMPI=False)
124 sortOutExample('cookbook/example09a.py', needsMagicMPL=True, needsGMSH=True, allowsMPI=False)
125 #sortOutExample('cookbook/example09b.py', needsMagicMPL=True, needsGMSH=True, allowsMPI=False)
126 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 #sortOutExample('cookbook/example10c_0.py', needsMagicMPL=True, needsGMSH=True, allowsMPI=False)
130 #sortOutExample('cookbook/example10c_1.py', needsMagicMPL=True, needsGMSH=True, allowsMPI=False)
131 sortOutExample('cookbook/example11a.py', needsMagicMPL=True, allowsMPI=False)
132 sortOutExample('cookbook/example11b.py', needsMagicMPL=True, allowsMPI=False)
133
134 sortOutExample('inversion/create_netcdf.py')
135 sortOutExample('inversion/grav_ermapper.py')
136 sortOutExample('inversion/grav_netcdf.py')
137 sortOutExample('inversion/gravmag_netcdf.py')
138 sortOutExample('inversion/gravmag_nodriver.py')
139 sortOutExample('inversion/mag_netcdf.py')
140 sortOutExample('inversion/plot_ermapper.py', needsMPL=True, allowsMPI=False)
141 sortOutExample('inversion/plot_netcdf.py', needsMPL=True, allowsMPI=False)
142 example_deps.append('inversion/content.txt')
143 example_deps.append('inversion/data/GravitySmall')
144 example_deps.append('inversion/data/MagneticSmall')
145 example_deps.append('inversion/data/QLDWestGravity')
146 example_deps.append('inversion/data/QLDWestMagnetic')
147 example_deps.append('inversion/data/GravitySmall.ers')
148 example_deps.append('inversion/data/MagneticSmall.ers')
149 example_deps.append('inversion/data/QLDWestGravity.ers')
150 example_deps.append('inversion/data/QLDWestMagnetic.ers')
151 example_deps.append('inversion/data/GravitySmall.nc')
152 example_deps.append('inversion/data/MagneticSmall.nc')
153 example_deps.append('inversion/data/QLDWestGravity.nc')
154 example_deps.append('inversion/data/QLDWestMagnetic.nc')
155
156
157 if len(skipped_tests)>0:
158 env['warnings'].append("gmsh not available. Skipping tests %s!"%' '.join(skipped_tests))
159
160 example_files = example_files_allow_mpi + example_files_no_mpi + example_deps
161
162 ex2=[os.path.join("examples", str(x)) for x in example_files]
163
164 #=============================================================================
165
166 local_env = env.Clone()
167 src_dir = local_env.Dir('.').srcnode().abspath
168 release_dir=os.path.join(env['prefix'],'release','doc')
169 Export('release_dir')
170
171 dir_cmd = "cd "+src_dir+" && "
172
173 # Need to use explicit tar/zip rather than the builder due to problems getting
174 # it not to put unwanted path components in the archive file
175 # --transform on tar is not supported on savanna
176 zip_path=os.path.join(release_dir, 'escript_examples.zip')
177 zip = local_env.Command(zip_path, None, dir_cmd+"zip "+zip_path+" "+" ".join(ex2))
178 env.Alias('examples_zipfile', zip)
179
180 tar_path=os.path.join(release_dir, 'escript_examples.tar.gz')
181 tar = local_env.Command(tar_path, None, dir_cmd+"tar -czf "+tar_path+" "+" ".join(ex2))
182 env.Alias('examples_tarfile', tar)
183
184 #env=Environment(TARFLAGS = "-c -z",chdir=src_dir)
185 #if 'Tar' in dir(env):
186 # tar=env.Tar(tar_path, example_files, chdir=src_dir)
187 # env.Alias('examples_tarfile', tar)
188
189 local_env.SConscript(dirs = ['#/doc/cookbook'], variant_dir='cookbook', duplicate=1)
190 local_env.SConscript(dirs = ['#/doc/user'], variant_dir='user', duplicate=1)
191 local_env.SConscript(dirs = ['#/doc/inversion'], variant_dir='inversion', duplicate=1)
192 local_env.SConscript(dirs = ['#/doc/epydoc'], variant_dir='epydoc', duplicate=1)
193 local_env.SConscript(dirs = ['#/doc/sphinx_api'], variant_dir='sphinx_api', duplicate=1)
194 local_env.SConscript(dirs = ['#/doc/doxygen'], variant_dir='doxygen', duplicate=1)
195 local_env.SConscript(dirs = ['#/doc/install'], variant_dir='install', duplicate=1)
196 local_env.SConscript(dirs = ['#/doc/examples'], variant_dir='examples', duplicate=1, exports=['example_files_allow_mpi', 'example_files_no_mpi', 'example_deps'])
197

  ViewVC Help
Powered by ViewVC 1.1.26