35
print "matplotlib not found skipping some tests"
43
print("matplotlib not found, skipping some tests")
37
if mplversion<mplmagicversion:
38
print "matplotlib found but version too early. Some tests skipped."
41
print "gmsh not found"
43
example_files_allow_mpi = [ ]
44
example_files_no_mpi = [ ]
45
if mplversion<mplmagicversion:
46
print("matplotlib found, but version too early. Some tests skipped.")
48
example_files_allow_mpi = []
49
example_files_no_mpi = []
47
52
def sortOutExample(name, needsGMSH=False, needsMPL=False, needsMagicMPL=False, needsGD=False, allowsMPI=True):
48
if needsMagicMPL: needsMPL=True
49
if needsGD: needsMPL=True
50
if needsGMSH: allowsMPI=False
52
if (not needsGMSH or haveGMSH) and (not needsMPL or haveMPL) and (not needsMagicMPL or mplversion>=mplmagicversion) and (not needsGD or haveGD):
54
example_files_allow_mpi.append(name)
56
example_files_no_mpi.append(name)
58
example_deps.append(name)
60
# these are the release examples in example sub directory:
53
if needsMagicMPL: needsMPL=True
54
if needsGD: needsMPL=True
55
if needsGMSH: allowsMPI=False
57
if (not needsGMSH or haveGMSH) and (not needsMPL or haveMPL) and (not needsMagicMPL or mplversion>=mplmagicversion) and (not needsGD or haveGD):
59
example_files_allow_mpi.append(name)
61
example_files_no_mpi.append(name)
63
example_deps.append(name)
65
# these are the release examples in example subdirectory:
62
67
#_deps is for files which end in .py and are required for
63
68
# testing but should not be invoked directly themselves
65
sortOutExample( 'usersguide/lit_driven_cavity.py')
66
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
sortOutExample( 'usersguide/slip.py')
74
sortOutExample( 'usersguide/int_save.py')
75
sortOutExample( 'usersguide/wave.py', needsMPL=True)
76
sortOutExample( 'usersguide/trapezoid.py', needsGMSH=True)
77
sortOutExample( 'usersguide/quad.py', needsGMSH=True)
78
sortOutExample( 'usersguide/brick.py', needsGMSH=True)
79
sortOutExample( 'usersguide/refine.py', needsGMSH=True)
80
sortOutExample( 'usersguide/poisson_matplotlib.py', needsGD=True, allowsMPI=False)
70
sortOutExample('usersguide/lit_driven_cavity.py')
71
sortOutExample('usersguide/mount.py')
72
sortOutExample('usersguide/heatedblock.py')
73
sortOutExample('usersguide/helmholtz.py')
74
sortOutExample('usersguide/fluid.py')
75
sortOutExample('usersguide/poisson.py')
76
sortOutExample('usersguide/diffusion.py')
77
sortOutExample('usersguide/poisson_vtk.py')
78
sortOutExample('usersguide/slip.py')
79
sortOutExample('usersguide/int_save.py')
80
sortOutExample('usersguide/wave.py', needsMPL=True)
81
sortOutExample('usersguide/trapezoid.py', needsGMSH=True)
82
sortOutExample('usersguide/quad.py', needsGMSH=True)
83
sortOutExample('usersguide/brick.py', needsGMSH=True)
84
sortOutExample('usersguide/refine.py', needsGMSH=True)
85
sortOutExample('usersguide/poisson_matplotlib.py', needsGD=True, allowsMPI=False)
82
sortOutExample( 'geotutorial/steadystate_variablek.py')
83
sortOutExample( 'geotutorial/steadystate.py')
84
sortOutExample( 'geotutorial/forward_euler.py')
85
sortOutExample( 'geotutorial/myfirstscript.py')
86
sortOutExample( 'geotutorial/backward_euler.py')
87
sortOutExample('geotutorial/steadystate_variablek.py')
88
sortOutExample('geotutorial/steadystate.py')
89
sortOutExample('geotutorial/forward_euler.py')
90
sortOutExample('geotutorial/myfirstscript.py')
91
sortOutExample('geotutorial/backward_euler.py')
88
93
example_deps.append('cookbook/cblib.py')
89
94
sortOutExample('cookbook/example01a.py')
107
112
#sortOutExample('cookbook/example09a.py', needsMagicMPL=True, needsGMSH=True, allowsMPI=False)
108
113
#sortOutExample('cookbook/example09b.py', needsMagicMPL=True, needsGMSH=True, allowsMPI=False)
110
example_files= example_files_allow_mpi + example_files_no_mpi + example_deps
113
ex2=[ os.path.join("examples",str(x)) for x in example_files]
115
#==========================================================================================
117
local_env = clone_env(env)
115
example_files = example_files_allow_mpi + example_files_no_mpi + example_deps
117
ex2=[os.path.join("examples", str(x)) for x in example_files]
119
#=============================================================================
121
local_env = env.Clone()
118
122
src_dir = local_env.Dir('.').srcnode().abspath
119
123
release_dir=local_env.Dir('#/release/doc/').srcnode().abspath
121
125
dir_cmd = "cd "+src_dir+" && "
123
tmp1 = local_env.Command("#/release/doc/escript_examples.zip", None,
124
dir_cmd+"zip "+os.path.join(release_dir,"escript_examples.zip ") +" ".join(ex2),
127
tmp1 = local_env.Command("#/release/doc/escript_examples.zip", None, dir_cmd+"zip "+os.path.join(release_dir,"escript_examples.zip ") +" ".join(ex2))
127
128
env.Alias('examples_zipfile', tmp1)
130
#Need to use explicit tar rather than the tar builder due to problems getting it not to put
131
#unwanted path components in the tar file
132
#--transform on tar is not supported on savanna
133
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),
130
# Need to use explicit tar rather than the tar builder due to problems getting
131
# it not to put unwanted path components in the tar file
132
# --transform on tar is not supported on savanna
133
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))
136
134
env.Alias('examples_tarfile',tmp2)
138
136
#env=Environment(TARFLAGS = "-c -z",chdir=src_dir)
139
137
#if 'Tar' in dir(env): env.Tar('#/release/doc/escript_examples.tar.gz', example_files,chdir=src_dir)
140
138
#env.Alias('examples_tarfile', '#release/doc/escript_examples.tar.gz')
142
CallSConscript(local_env, dirs = ['#/doc/cookbook'], variant_dir='#/build/$PLATFORM/doc/cookbook', duplicate=1)
143
CallSConscript(local_env, dirs = ['#/doc/user'], variant_dir='#/build/$PLATFORM/doc/user', duplicate=1)
144
CallSConscript(local_env, dirs = ['#/doc/epydoc'], variant_dir='#/build/$PLATFORM/doc/epydoc', duplicate=1)
145
CallSConscript(local_env, dirs = ['#/doc/doxygen'], variant_dir='#/build/$PLATFORM/doc/doxygen', duplicate=1)
146
CallSConscript(local_env, dirs = ['#/doc/install'], variant_dir='#/build/$PLATFORM/doc/install', duplicate=1)
149
#For some reason my CallSConscript wrapper fails when you want to use the exports= keyword
150
if cantusevariantdir:
151
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' ])
153
local_env.SConscript(dirs = ['#/doc/examples'], variant_dir='#/build/$PLATFORM/doc/examples', duplicate=1, exports=[ 'example_files_allow_mpi' , 'example_files_no_mpi', 'example_deps' ])
140
local_env.SConscript(dirs = ['#/doc/cookbook'], variant_dir='#/build/$PLATFORM/doc/cookbook', duplicate=1)
141
local_env.SConscript(dirs = ['#/doc/user'], variant_dir='#/build/$PLATFORM/doc/user', duplicate=1)
142
local_env.SConscript(dirs = ['#/doc/epydoc'], variant_dir='#/build/$PLATFORM/doc/epydoc', duplicate=1)
143
local_env.SConscript(dirs = ['#/doc/doxygen'], variant_dir='#/build/$PLATFORM/doc/doxygen', duplicate=1)
144
local_env.SConscript(dirs = ['#/doc/install'], variant_dir='#/build/$PLATFORM/doc/install', duplicate=1)
145
local_env.SConscript(dirs = ['#/doc/examples'], variant_dir='#/build/$PLATFORM/doc/examples', duplicate=1, exports=['example_files_allow_mpi', 'example_files_no_mpi', 'example_deps'])