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

Annotation of /trunk/doc/SConscript

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3892 - (hide annotations)
Tue Apr 10 08:57:23 2012 UTC (6 years, 10 months ago) by jfenwick
File size: 7452 byte(s)
Merged changes across from the attempt2 branch.
This version builds and passes python2 tests.
It also passes most python3 tests.



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

  ViewVC Help
Powered by ViewVC 1.1.26