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

Annotation of /trunk/doc/SConscript

Parent Directory Parent Directory | Revision Log Revision Log


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


1 ksteube 1811
2 jfenwick 3982 ##############################################################################
3 cochrane 369 #
4 jfenwick 6651 # Copyright (c) 2003-2018 by The University of Queensland
5 jfenwick 3982 # http://www.uq.edu.au
6 elspeth 643 #
7 ksteube 1811 # Primary Business: Queensland, Australia
8 jfenwick 6112 # Licensed under the Apache License, version 2.0
9     # http://www.apache.org/licenses/LICENSE-2.0
10 ksteube 1705 #
11 jfenwick 3982 # Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 jfenwick 4657 # Development 2012-2013 by School of Earth Sciences
13     # Development from 2014 by Centre for Geoscience Computing (GeoComp)
14 jfenwick 3982 #
15     ##############################################################################
16 cochrane 369
17 gross 707 import os
18     Import('*')
19 jfenwick 2648
20 jfenwick 3892 from subprocess import PIPE, Popen
21    
22 jfenwick 3259 haveMPL=False # do we have matplotlib?
23     haveGD=False # does matplotlib have griddata?
24 jfenwick 2648
25 jfenwick 2674 mplmagicversion='0.98.5'
26    
27 jfenwick 3259 # check for matplotlib
28 jfenwick 3892 if env['pythoncmd']=='python':
29     try:
30 caltinay 3463 import matplotlib
31     haveMPL=True
32     mplversion=matplotlib.__version__
33     from matplotlib.mlab import griddata
34     haveGD=True
35 jfenwick 3892 except ImportError:
36 caltinay 3463 pass
37 jfenwick 3892 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 jfenwick 5411 if mplversion!='':
43     haveMPL=True
44     hgd=p.stdout.readline().strip()
45     haveGD=True
46 jfenwick 3892 except IOError:
47     pass
48     p.wait()
49 jfenwick 2578
50 jfenwick 2667 if not haveMPL:
51 caltinay 4299 env['warnings'].append("matplotlib not found, will skip some unit tests")
52 jfenwick 2667 else:
53 aellery 6751 import sys
54     if sys.version_info[0] == 3:
55     mplversion = str(mplversion, 'utf-8')
56     else:
57     mplversion = str(mplversion)
58 jfenwick 3259 if mplversion<mplmagicversion:
59 caltinay 4299 env['warnings'].append("matplotlib found, but version too early. Some unit tests will be skipped.")
60 jfenwick 2667
61 jfenwick 3259 example_files_allow_mpi = []
62     example_files_no_mpi = []
63     example_deps = []
64 caltinay 3595 skipped_tests = []
65 jfenwick 2667
66 gross 2950 def sortOutExample(name, needsGMSH=False, needsMPL=False, needsMagicMPL=False, needsGD=False, allowsMPI=True):
67 jfenwick 3259 if needsMagicMPL: needsMPL=True
68     if needsGD: needsMPL=True
69     if needsGMSH: allowsMPI=False
70 jfenwick 2667
71 caltinay 3595 if needsGMSH and not env['gmsh']:
72     skipped_tests.append(name)
73     return
74    
75 caltinay 3463 if (not needsGMSH or env['gmsh']) and (not needsMPL or haveMPL) and (not needsMagicMPL or mplversion>=mplmagicversion) and (not needsGD or haveGD):
76 jfenwick 3259 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 gross 2950 #
85     #_deps is for files which end in .py and are required for
86     # testing but should not be invoked directly themselves
87 jfenwick 2667
88 caltinay 3328 sortOutExample('usersguide/lid_driven_cavity.py')
89 jfenwick 3259 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 gross 3629 sortOutExample('usersguide/darcy.py')
97 gross 5671 sortOutExample('usersguide/dirac.py')
98 jfenwick 3259 sortOutExample('usersguide/slip.py')
99     sortOutExample('usersguide/int_save.py')
100     sortOutExample('usersguide/wave.py', needsMPL=True)
101 jfenwick 3940 sortOutExample('usersguide/trapezoid.py', needsGMSH=True, allowsMPI=False)
102 jfenwick 3259 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 sshaw 5722 sortOutExample('usersguide/voxet_reader.py')
107 gross 2950
108 jfenwick 3259 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 gross 2950
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 gross 2951 sortOutExample('cookbook/example04a.py', needsGMSH=True)
122     sortOutExample('cookbook/example04b.py', needsGMSH=True, needsGD=True)
123 gross 2952 sortOutExample('cookbook/example05a.py', needsGMSH=True, needsGD=True)
124     sortOutExample('cookbook/example05b.py', needsGMSH=True, needsGD=True)
125 artak 2973 sortOutExample('cookbook/example05c.py', needsGMSH=True, needsGD=True, needsMagicMPL=True)
126 artak 2974 sortOutExample('cookbook/example06.py', needsGMSH=True, needsGD=True, needsMagicMPL=True)
127 jfenwick 3208 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 ahallam 3385 sortOutExample('cookbook/example09m.py', needsMagicMPL=True, needsGMSH=True, allowsMPI=False)
133     sortOutExample('cookbook/example09a.py', needsMagicMPL=True, needsGMSH=True, allowsMPI=False)
134 ahallam 3405 #sortOutExample('cookbook/example09b.py', needsMagicMPL=True, needsGMSH=True, allowsMPI=False)
135 ahallam 3425 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 ahallam 3447 #sortOutExample('cookbook/example10c_0.py', needsMagicMPL=True, needsGMSH=True, allowsMPI=False)
139     #sortOutExample('cookbook/example10c_1.py', needsMagicMPL=True, needsGMSH=True, allowsMPI=False)
140 ahallam 3425 sortOutExample('cookbook/example11a.py', needsMagicMPL=True, allowsMPI=False)
141     sortOutExample('cookbook/example11b.py', needsMagicMPL=True, allowsMPI=False)
142 gross 2950
143 caltinay 4299 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 jduplessis 5353 sortOutExample('inversion/dc_forward.py', needsGMSH=True)
152 jfenwick 5738
153    
154     sortOutExample('inversion/test_commemi1.py', needsMPL=True, allowsMPI=True)
155     sortOutExample('inversion/test_commemi4.py', needsMPL=True, allowsMPI=True)
156    
157 jfenwick 4289 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 jduplessis 5353 example_deps.append('inversion/data/HalfSphere_v1.4.msh')
171 jfenwick 4289
172    
173 caltinay 3595 if len(skipped_tests)>0:
174 caltinay 4295 env['warnings'].append("gmsh not available. Skipping tests %s!"%' '.join(skipped_tests))
175 ahallam 3425
176 jfenwick 3259 example_files = example_files_allow_mpi + example_files_no_mpi + example_deps
177 gross 2502
178 sshaw 5666 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 jfenwick 2503
184 sshaw 5666 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 jfenwick 3259 #=============================================================================
190 jfenwick 2503
191 jfenwick 3259 local_env = env.Clone()
192 jfenwick 2402 src_dir = local_env.Dir('.').srcnode().abspath
193 caltinay 3277 release_dir=os.path.join(env['prefix'],'release','doc')
194     Export('release_dir')
195 ksteube 1215
196 jfenwick 2923 dir_cmd = "cd "+src_dir+" && "
197    
198 caltinay 3277 # 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 jfenwick 3259 # --transform on tar is not supported on savanna
201 caltinay 3277 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 jfenwick 2405
205 jfenwick 5834 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 caltinay 3277
211 jfenwick 2405 #env=Environment(TARFLAGS = "-c -z",chdir=src_dir)
212 caltinay 3277 #if 'Tar' in dir(env):
213     # tar=env.Tar(tar_path, example_files, chdir=src_dir)
214     # env.Alias('examples_tarfile', tar)
215 jfenwick 2405
216 caltinay 4045 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 jfenwick 4110 local_env.SConscript(dirs = ['#/doc/epydoc'], variant_dir='epydoc', duplicate=1)
220 jfenwick 4107 local_env.SConscript(dirs = ['#/doc/sphinx_api'], variant_dir='sphinx_api', duplicate=1)
221 caltinay 4045 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 ksteube 1705

  ViewVC Help
Powered by ViewVC 1.1.26