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