/[ascend]/trunk/models/SConscript
ViewVC logotype

Annotation of /trunk/models/SConscript

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2105 - (hide annotations) (download)
Thu Dec 3 02:55:53 2009 UTC (15 years ago) by jpye
File size: 1845 byte(s)
Add some regex-based excludes for installation of models (eg FPROPS).
Add IPOPT to default solvers.
1 jpye 2016 #!/usr/bin/python scons
2 johnpye 449 Import('env')
3    
4 johnpye 1032 # Build directories that contain external libraries
5 johnpye 811 env.SConscript(['johnpye/SConscript'],['env'])
6 johnpye 1032 env.SConscript(['test/SConscript'],['env'])
7 johnpye 1162 env.SConscript(['sensitivity/SConscript'],['env'])
8 johnpye 811
9 johnpye 1032 # Hunt for all models in the directory structure
10 jpye 2105 import os, os.path, re
11 johnpye 449
12 johnpye 561 modelfiles = []
13 johnpye 449
14 johnpye 561 excludedirs = ['.svn','CVS']
15 jpye 2105 excludefiles = ['Makefile.in','SConscript','SConstruct','update-Makefile.pl']
16     excludepatterns = [re.compile(s) for s in [
17     r"^.*\.os$"
18     , r"^.*\.o$"
19     ,r"^.*\.tm2$"
20     ,r"^.*/fprops/[a-z]+$"
21     ,r"^.*/fprops/.*\.c$"
22     ,r"^.*/fprops/.*\.h$"
23     ,r"^.*/fprops/test\.py$"
24     ,r"^.*/fprops/.*\.mac$"
25     ,r"^.*/fprops/precalc\.py$"
26     ,r"^.*/fprops/.*\.ods$"
27     ,r"^.*/fprops/python/.*$"
28     ]]
29 johnpye 449
30 johnpye 561 modeldir = env.Dir(".").abspath
31 jpye 1436 #print "MODEL DIR =",modeldir
32 johnpye 449
33 johnpye 561 cwd = os.getcwd()
34     os.chdir(modeldir)
35     for root,dirs,files in os.walk("."):
36     for d in dirs:
37     if d in excludedirs:
38     dirs.remove(d)
39 jpye 1634 if "PACKAGE" in files:
40     print "FOUND 'PACKAGE' file in %s..." % root
41     p = file(os.path.join(root,"PACKAGE"))
42     f1 = []
43     for l in p:
44     l1 = l.strip()
45     if not len(l1) or l1[0]=="#":
46     continue
47     f1.append(l1)
48     files = f1
49    
50 johnpye 561 for f in files:
51     if f in excludefiles:
52     continue
53 jpye 2105
54     np = os.path.normpath(os.path.join(root,f))
55    
56     fail = False
57     for r in excludepatterns:
58     if r.match(np):
59     fail = True
60     break
61     if fail:
62     continue
63    
64 jpye 1436 #print "ADDING",os.path.normpath(os.path.join(root,f))
65 jpye 2105 modelfiles.append(np)
66 johnpye 561 os.chdir(cwd)
67 johnpye 449
68 jpye 1436 #print "CWD =",cwd
69 johnpye 561
70 jpye 1436 modelsroot = '$INSTALL_ROOT$INSTALL_MODELS'
71    
72 johnpye 561 installeddirs = []
73    
74     for f in modelfiles:
75     head,tail = os.path.split(f)
76 jpye 1436 targetdir = Dir(env.subst(modelsroot)+"/"+head)
77    
78 johnpye 561 if not targetdir in installeddirs:
79     installeddirs.append(targetdir)
80 johnpye 629 env.InstallShared(targetdir,f)
81 johnpye 561
82     #print "MODEL INSTALLED DIRS =",installeddirs
83     Return('installeddirs')
84 johnpye 811
85     # vim: set syntax=python:
86    

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22