1 |
|
2 |
######################################################## |
3 |
# |
4 |
# Copyright (c) 2003-2010 by University of Queensland |
5 |
# Earth Systems Science Computational Center (ESSCC) |
6 |
# http://www.uq.edu.au/esscc |
7 |
# |
8 |
# 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 |
# |
12 |
######################################################## |
13 |
|
14 |
|
15 |
import os |
16 |
Import('*') |
17 |
|
18 |
#_deps is for files which end in .py and are required for |
19 |
# testing but should not be invoked directly themselves |
20 |
example_deps = ['cookbook/cblib.py', |
21 |
'cookbook/heatrefraction_mesher001.py', |
22 |
'cookbook/heatrefraction_mesher002.py', |
23 |
'cookbook/heatrefraction001.py', |
24 |
'cookbook/heatrefraction002.py', |
25 |
'cookbook/cblib1.py', |
26 |
'cookbook/cblib2.py' |
27 |
] |
28 |
|
29 |
# |
30 |
# these are the release examples in example sub directory: |
31 |
# |
32 |
example_files_allow_mpi = [ |
33 |
'geotutorial/steadystate_variablek.py', |
34 |
'geotutorial/steadystate.py', |
35 |
'geotutorial/forward_euler.py', |
36 |
'geotutorial/myfirstscript.py', |
37 |
'geotutorial/backward_euler.py', |
38 |
'usersguide/lit_driven_cavity.py', |
39 |
'usersguide/mount.py', |
40 |
'usersguide/heatedblock.py', |
41 |
'usersguide/helmholtz.py', |
42 |
'usersguide/fluid.py', |
43 |
'usersguide/poisson.py', |
44 |
'usersguide/diffusion.py', |
45 |
'usersguide/poisson_vtk.py', |
46 |
'usersguide/slip.py', |
47 |
'usersguide/int_save.py', |
48 |
] |
49 |
|
50 |
example_files_no_mpi = [ |
51 |
] |
52 |
|
53 |
haveGMSH=(os.system("gmsh -version")/256==0) #Do we have gmsh installed? |
54 |
haveMPL=False #Do we have matplotlib? |
55 |
haveGD=False #Does the matplotlib have griddata? |
56 |
|
57 |
mplmagicversion='0.98.5' |
58 |
|
59 |
try: |
60 |
import matplotlib |
61 |
haveMPL=True |
62 |
mplversion=matplotlib.__version__ |
63 |
from matplotlib.mlab import griddata |
64 |
haveGD=True |
65 |
except ImportError: |
66 |
pass |
67 |
|
68 |
if not haveMPL: |
69 |
print "matplotlib not found skipping some tests" |
70 |
else: |
71 |
if mplversion<mplmagicversion: |
72 |
print "matplotlib found but version too early. Some tests skipped." |
73 |
|
74 |
if not haveGMSH: |
75 |
print "gmsh not found" |
76 |
|
77 |
example_files_allow_mpi.append('cookbook/onedheatdiffbase.py') |
78 |
example_files_allow_mpi.append('cookbook/twodheatdiffvtk.py') |
79 |
example_files_no_mpi.append('cookbook/wavesolver2d001.py') |
80 |
example_files_no_mpi.append('cookbook/wavesolver2d002.py') |
81 |
|
82 |
|
83 |
if haveMPL: |
84 |
example_files_no_mpi.append('cookbook/onedheatdiff001.py') |
85 |
example_files_no_mpi.append('cookbook/onedheatdiff001b.py') |
86 |
example_files_no_mpi.append('cookbook/onedheatdiff002.py') |
87 |
if mplversion>=mplmagicversion: |
88 |
example_files_no_mpi.append('cookbook/twodheatdiff001.py') |
89 |
example_files_no_mpi.append('usersguide/poisson_matplotlib.py') |
90 |
example_files_allow_mpi.append('usersguide/wave.py') |
91 |
if haveGMSH: |
92 |
example_files_no_mpi.append('cookbook/run_heatrefraction.py') |
93 |
if haveGMSH: |
94 |
example_files_no_mpi.append('usersguide/trapezoid.py') |
95 |
example_files_no_mpi.append('usersguide/quad.py') |
96 |
example_files_no_mpi.append('usersguide/brick.py') |
97 |
example_files_no_mpi.append('usersguide/refine.py') |
98 |
example_files_no_mpi.append('cookbook/simple_mesher001.py') |
99 |
example_files_no_mpi.append('cookbook/simple_solver001.py') |
100 |
example_files_no_mpi.append('cookbook/twodheatdiff001.py') |
101 |
|
102 |
# we want to make sure these are still added to the examples bundle even if we can't run them |
103 |
if not haveGMSH: |
104 |
example_deps.append('cookbook/run_heatrefraction.py') |
105 |
example_deps.append('usersguide/trapezoid.py') |
106 |
example_deps.append('usersguide/quad.py') |
107 |
example_deps.append('usersguide/brick.py') |
108 |
example_deps.append('usersguide/refine.py') |
109 |
example_deps.append('cookbook/simple_mesher001.py') |
110 |
example_deps.append('cookbook/simple_solver001.py') |
111 |
example_deps.append('cookbook/twodheatdiff001.py') |
112 |
if not haveGD: |
113 |
example_deps.append('cookbook/twodheatdiff001.py') |
114 |
example_deps.append('usersguide/poisson_matplotlib.py') |
115 |
example_deps.append('usersguide/wave.py') |
116 |
if not haveMPL: |
117 |
example_deps.append('cookbook/onedheatdiff001.py') |
118 |
example_deps.append('cookbook/onedheatdiff001b.py') |
119 |
example_deps.append('cookbook/onedheatdiff002.py') |
120 |
|
121 |
|
122 |
example_files= example_files_allow_mpi + example_files_no_mpi + example_deps |
123 |
|
124 |
|
125 |
ex2=[ os.path.join("examples",str(x)) for x in example_files] |
126 |
|
127 |
#========================================================================================== |
128 |
|
129 |
local_env = clone_env(env) |
130 |
src_dir = local_env.Dir('.').srcnode().abspath |
131 |
release_dir=local_env.Dir('#/release/doc/').srcnode().abspath |
132 |
|
133 |
dir_cmd = "cd "+src_dir+" && " |
134 |
|
135 |
tmp1 = local_env.Command("#/release/doc/escript_examples.zip", None, |
136 |
dir_cmd+"zip "+os.path.join(release_dir,"escript_examples.zip ") +" ".join(ex2), |
137 |
#chdir=src_dir |
138 |
) |
139 |
env.Alias('examples_zipfile', tmp1) |
140 |
|
141 |
|
142 |
#Need to use explicit tar rather than the tar builder due to problems getting it not to put |
143 |
#unwanted path components in the tar file |
144 |
#--transform on tar is not supported on savanna |
145 |
tmp2 = local_env.Command("#/release/doc/escript_examples.tar.gz", None, dir_cmd+"tar -czf "+os.path.join(release_dir,"escript_examples.tar.gz ")+" ".join(ex2), |
146 |
# chdir=src_dir |
147 |
) |
148 |
env.Alias('examples_tarfile',tmp2) |
149 |
|
150 |
#env=Environment(TARFLAGS = "-c -z",chdir=src_dir) |
151 |
#if 'Tar' in dir(env): env.Tar('#/release/doc/escript_examples.tar.gz', example_files,chdir=src_dir) |
152 |
#env.Alias('examples_tarfile', '#release/doc/escript_examples.tar.gz') |
153 |
|
154 |
local_env.SConscript(dirs = ['#/doc/cookbook'], build_dir='#/build/$PLATFORM/doc/cookbook', duplicate=1) |
155 |
local_env.SConscript(dirs = ['#/doc/user'], build_dir='#/build/$PLATFORM/doc/user', duplicate=1) |
156 |
local_env.SConscript(dirs = ['#/doc/epydoc'], build_dir='#/build/$PLATFORM/doc/epydoc', duplicate=1) |
157 |
local_env.SConscript(dirs = ['#/doc/doxygen'], build_dir='#/build/$PLATFORM/doc/doxygen', duplicate=1) |
158 |
local_env.SConscript(dirs = ['#/doc/install'], build_dir='#/build/$PLATFORM/doc/install', duplicate=1) |
159 |
local_env.SConscript(dirs = ['#/doc/examples'], build_dir='#/build/$PLATFORM/doc/examples', duplicate=1, exports=[ 'example_files_allow_mpi' , 'example_files_no_mpi', 'example_deps' ]) |
160 |
|
161 |
|