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

Contents of /trunk/doc/SConscript

Parent Directory Parent Directory | Revision Log Revision Log


Revision 6751 - (show annotations)
Wed Nov 21 02:35:29 2018 UTC (10 months, 3 weeks ago) by aellery
File size: 9786 byte(s)
Fixed support bug 443 (escripts would not compile on openSUSE).


1
2 ##############################################################################
3 #
4 # Copyright (c) 2003-2018 by The University of Queensland
5 # http://www.uq.edu.au
6 #
7 # Primary Business: Queensland, Australia
8 # Licensed under the Apache License, version 2.0
9 # http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 # Development 2012-2013 by School of Earth Sciences
13 # Development from 2014 by Centre for Geoscience Computing (GeoComp)
14 #
15 ##############################################################################
16
17 import os
18 Import('*')
19
20 from subprocess import PIPE, Popen
21
22 haveMPL=False # do we have matplotlib?
23 haveGD=False # does matplotlib have griddata?
24
25 mplmagicversion='0.98.5'
26
27 # check for matplotlib
28 if env['pythoncmd']=='python':
29 try:
30 import matplotlib
31 haveMPL=True
32 mplversion=matplotlib.__version__
33 from matplotlib.mlab import griddata
34 haveGD=True
35 except ImportError:
36 pass
37 else:
38 # we need to fire up the external command
39 p=Popen([env['pythoncmd'], '-c', 'from __future__ import print_function;import matplotlib;print(matplotlib.__version__);from matplotlib.mlab import griddata;print("1")'], stdout=PIPE)
40 try:
41 mplversion=p.stdout.readline().strip()
42 if mplversion!='':
43 haveMPL=True
44 hgd=p.stdout.readline().strip()
45 haveGD=True
46 except IOError:
47 pass
48 p.wait()
49
50 if not haveMPL:
51 env['warnings'].append("matplotlib not found, will skip some unit tests")
52 else:
53 import sys
54 if sys.version_info[0] == 3:
55 mplversion = str(mplversion, 'utf-8')
56 else:
57 mplversion = str(mplversion)
58 if mplversion<mplmagicversion:
59 env['warnings'].append("matplotlib found, but version too early. Some unit tests will be skipped.")
60
61 example_files_allow_mpi = []
62 example_files_no_mpi = []
63 example_deps = []
64 skipped_tests = []
65
66 def sortOutExample(name, needsGMSH=False, needsMPL=False, needsMagicMPL=False, needsGD=False, allowsMPI=True):
67 if needsMagicMPL: needsMPL=True
68 if needsGD: needsMPL=True
69 if needsGMSH: allowsMPI=False
70
71 if needsGMSH and not env['gmsh']:
72 skipped_tests.append(name)
73 return
74
75 if (not needsGMSH or env['gmsh']) and (not needsMPL or haveMPL) and (not needsMagicMPL or mplversion>=mplmagicversion) and (not needsGD or haveGD):
76 if allowsMPI:
77 example_files_allow_mpi.append(name)
78 else:
79 example_files_no_mpi.append(name)
80 else:
81 example_deps.append(name)
82
83 # these are the release examples in example subdirectory:
84 #
85 #_deps is for files which end in .py and are required for
86 # testing but should not be invoked directly themselves
87
88 sortOutExample('usersguide/lid_driven_cavity.py')
89 sortOutExample('usersguide/mount.py')
90 sortOutExample('usersguide/heatedblock.py')
91 sortOutExample('usersguide/helmholtz.py')
92 sortOutExample('usersguide/fluid.py')
93 sortOutExample('usersguide/poisson.py')
94 sortOutExample('usersguide/diffusion.py')
95 sortOutExample('usersguide/poisson_vtk.py')
96 sortOutExample('usersguide/darcy.py')
97 sortOutExample('usersguide/dirac.py')
98 sortOutExample('usersguide/slip.py')
99 sortOutExample('usersguide/int_save.py')
100 sortOutExample('usersguide/wave.py', needsMPL=True)
101 sortOutExample('usersguide/trapezoid.py', needsGMSH=True, allowsMPI=False)
102 sortOutExample('usersguide/quad.py', needsGMSH=True)
103 sortOutExample('usersguide/brick.py', needsGMSH=True)
104 sortOutExample('usersguide/refine.py', needsGMSH=True)
105 sortOutExample('usersguide/poisson_matplotlib.py', needsGD=True, allowsMPI=False)
106 sortOutExample('usersguide/voxet_reader.py')
107
108 sortOutExample('geotutorial/steadystate_variablek.py')
109 sortOutExample('geotutorial/steadystate.py')
110 sortOutExample('geotutorial/forward_euler.py')
111 sortOutExample('geotutorial/myfirstscript.py')
112 sortOutExample('geotutorial/backward_euler.py')
113
114 example_deps.append('cookbook/cblib.py')
115 sortOutExample('cookbook/example01a.py')
116 sortOutExample('cookbook/example01b.py', needsMPL=True)
117 sortOutExample('cookbook/example01c.py', needsMPL=True, allowsMPI=False)
118 sortOutExample('cookbook/example02.py', needsMPL=True, allowsMPI=False)
119 sortOutExample('cookbook/example03a.py', needsGD=True, allowsMPI=False)
120 sortOutExample('cookbook/example03b.py')
121 sortOutExample('cookbook/example04a.py', needsGMSH=True)
122 sortOutExample('cookbook/example04b.py', needsGMSH=True, needsGD=True)
123 sortOutExample('cookbook/example05a.py', needsGMSH=True, needsGD=True)
124 sortOutExample('cookbook/example05b.py', needsGMSH=True, needsGD=True)
125 sortOutExample('cookbook/example05c.py', needsGMSH=True, needsGD=True, needsMagicMPL=True)
126 sortOutExample('cookbook/example06.py', needsGMSH=True, needsGD=True, needsMagicMPL=True)
127 sortOutExample('cookbook/example07a.py', needsMagicMPL=True, allowsMPI=False)
128 sortOutExample('cookbook/example07b.py', needsMagicMPL=True, allowsMPI=False)
129 sortOutExample('cookbook/example08a.py', needsMagicMPL=True, allowsMPI=False)
130 sortOutExample('cookbook/example08b.py', needsMagicMPL=True, allowsMPI=False)
131 sortOutExample('cookbook/example08c.py', needsMagicMPL=True, needsGMSH=True, allowsMPI=False)
132 sortOutExample('cookbook/example09m.py', needsMagicMPL=True, needsGMSH=True, allowsMPI=False)
133 sortOutExample('cookbook/example09a.py', needsMagicMPL=True, needsGMSH=True, allowsMPI=False)
134 #sortOutExample('cookbook/example09b.py', needsMagicMPL=True, needsGMSH=True, allowsMPI=False)
135 sortOutExample('cookbook/example10a.py', needsMagicMPL=True, allowsMPI=False)
136 sortOutExample('cookbook/example10b.py', needsMagicMPL=True, allowsMPI=False)
137 sortOutExample('cookbook/example10m.py', needsMagicMPL=True, needsGMSH=True, allowsMPI=False)
138 #sortOutExample('cookbook/example10c_0.py', needsMagicMPL=True, needsGMSH=True, allowsMPI=False)
139 #sortOutExample('cookbook/example10c_1.py', needsMagicMPL=True, needsGMSH=True, allowsMPI=False)
140 sortOutExample('cookbook/example11a.py', needsMagicMPL=True, allowsMPI=False)
141 sortOutExample('cookbook/example11b.py', needsMagicMPL=True, allowsMPI=False)
142
143 sortOutExample('inversion/create_netcdf.py')
144 sortOutExample('inversion/grav_ermapper.py')
145 sortOutExample('inversion/grav_netcdf.py')
146 sortOutExample('inversion/gravmag_netcdf.py')
147 sortOutExample('inversion/gravmag_nodriver.py')
148 sortOutExample('inversion/mag_netcdf.py')
149 sortOutExample('inversion/plot_ermapper.py', needsMPL=True, allowsMPI=False)
150 sortOutExample('inversion/plot_netcdf.py', needsMPL=True, allowsMPI=False)
151 sortOutExample('inversion/dc_forward.py', needsGMSH=True)
152
153
154 sortOutExample('inversion/test_commemi1.py', needsMPL=True, allowsMPI=True)
155 sortOutExample('inversion/test_commemi4.py', needsMPL=True, allowsMPI=True)
156
157 example_deps.append('inversion/content.txt')
158 example_deps.append('inversion/data/GravitySmall')
159 example_deps.append('inversion/data/MagneticSmall')
160 example_deps.append('inversion/data/QLDWestGravity')
161 example_deps.append('inversion/data/QLDWestMagnetic')
162 example_deps.append('inversion/data/GravitySmall.ers')
163 example_deps.append('inversion/data/MagneticSmall.ers')
164 example_deps.append('inversion/data/QLDWestGravity.ers')
165 example_deps.append('inversion/data/QLDWestMagnetic.ers')
166 example_deps.append('inversion/data/GravitySmall.nc')
167 example_deps.append('inversion/data/MagneticSmall.nc')
168 example_deps.append('inversion/data/QLDWestGravity.nc')
169 example_deps.append('inversion/data/QLDWestMagnetic.nc')
170 example_deps.append('inversion/data/HalfSphere_v1.4.msh')
171
172
173 if len(skipped_tests)>0:
174 env['warnings'].append("gmsh not available. Skipping tests %s!"%' '.join(skipped_tests))
175
176 example_files = example_files_allow_mpi + example_files_no_mpi + example_deps
177
178 wave_examples = ['inversion/synthetic_HTI.py',
179 'inversion/synthetic_VTI.py',
180 'inversion/synthetic_TTI.py',
181 'inversion/synthetic_sonic.py',
182 'inversion/synthetic_sonicHTI.py']
183
184 for i in wave_examples:
185 sortOutExample(i)
186
187 ex2=[os.path.join("examples", str(x)) for x in example_files]#+wave_examples]
188
189 #=============================================================================
190
191 local_env = env.Clone()
192 src_dir = local_env.Dir('.').srcnode().abspath
193 release_dir=os.path.join(env['prefix'],'release','doc')
194 Export('release_dir')
195
196 dir_cmd = "cd "+src_dir+" && "
197
198 # Need to use explicit tar/zip rather than the builder due to problems getting
199 # it not to put unwanted path components in the archive file
200 # --transform on tar is not supported on savanna
201 zip_path=os.path.join(release_dir, 'escript_examples.zip')
202 zip = local_env.Command(zip_path, None, dir_cmd+"zip "+zip_path+" "+" ".join(ex2))
203 env.Alias('examples_zipfile', zip)
204
205 tar_path=os.path.join(release_dir, 'escript_examples.tar')
206 targz_path=os.path.join(release_dir, 'escript_examples.tar.gz')
207 tar = local_env.Command(tar_path, None, dir_cmd+"tar -cf "+tar_path+" "+" ".join(ex2))
208 targz = local_env.Command(targz_path, tar, "gzip -n -9 "+tar_path)
209 env.Alias('examples_tarfile', targz)
210
211 #env=Environment(TARFLAGS = "-c -z",chdir=src_dir)
212 #if 'Tar' in dir(env):
213 # tar=env.Tar(tar_path, example_files, chdir=src_dir)
214 # env.Alias('examples_tarfile', tar)
215
216 local_env.SConscript(dirs = ['#/doc/cookbook'], variant_dir='cookbook', duplicate=1)
217 local_env.SConscript(dirs = ['#/doc/user'], variant_dir='user', duplicate=1)
218 local_env.SConscript(dirs = ['#/doc/inversion'], variant_dir='inversion', duplicate=1)
219 local_env.SConscript(dirs = ['#/doc/epydoc'], variant_dir='epydoc', duplicate=1)
220 local_env.SConscript(dirs = ['#/doc/sphinx_api'], variant_dir='sphinx_api', duplicate=1)
221 local_env.SConscript(dirs = ['#/doc/doxygen'], variant_dir='doxygen', duplicate=1)
222 local_env.SConscript(dirs = ['#/doc/install'], variant_dir='install', duplicate=1)
223 local_env.SConscript(dirs = ['#/doc/examples'], variant_dir='examples', duplicate=1, exports=['example_files_allow_mpi', 'example_files_no_mpi', 'example_deps'])
224

  ViewVC Help
Powered by ViewVC 1.1.26