1 | import os |
---|
2 | import time |
---|
3 | import sys |
---|
4 | import subprocess |
---|
5 | |
---|
6 | buildroot = os.getcwd() |
---|
7 | t0 = time.time() |
---|
8 | |
---|
9 | #-------------------------------------------------- |
---|
10 | # Compiling anuga code |
---|
11 | #-------------------------------------------------- |
---|
12 | os.chdir('source') |
---|
13 | |
---|
14 | print 'Changing to', os.getcwd() |
---|
15 | |
---|
16 | cmd = 'python setup.py build_ext --inplace -f ' |
---|
17 | print cmd |
---|
18 | err = os.system(cmd) |
---|
19 | if err != 0: |
---|
20 | msg = 'Could not compile anuga ' |
---|
21 | msg += 'on platform %s, %s\n' % (sys.platform, os.name) |
---|
22 | raise Exception, msg |
---|
23 | else: |
---|
24 | print 50*"-" |
---|
25 | print |
---|
26 | msg = 'Compiled anuga successfully.' |
---|
27 | print msg |
---|
28 | |
---|
29 | # |
---|
30 | # |
---|
31 | # |
---|
32 | # |
---|
33 | # print 'Changing to', os.getcwd() |
---|
34 | # |
---|
35 | # #entries = listdir('.') |
---|
36 | # |
---|
37 | # t0 = time.time() |
---|
38 | # |
---|
39 | # # Attempt to compile all ANUGA extensions |
---|
40 | # execfile('compile_all.py') |
---|
41 | # |
---|
42 | # |
---|
43 | # os.chdir(buildroot) |
---|
44 | # |
---|
45 | # |
---|
46 | # #-------------------------------------------------- |
---|
47 | # # Compiling anuga_1d code |
---|
48 | # # excluded for the time being |
---|
49 | # #-------------------------------------------------- |
---|
50 | # #os.chdir('anuga_1d') |
---|
51 | # |
---|
52 | # |
---|
53 | # #t0 = time.time() |
---|
54 | # |
---|
55 | # # Attempt to compile all ANUGA_1D extensions |
---|
56 | # #execfile('compile_all.py') |
---|
57 | # |
---|
58 | # |
---|
59 | # os.chdir(buildroot) |
---|
60 | # print |
---|
61 | # print 'Changing to', os.getcwd() |
---|
62 | # |
---|
63 | # #-------------------------------------------------- |
---|
64 | # # Compiling partition code |
---|
65 | # #-------------------------------------------------- |
---|
66 | # |
---|
67 | # try: |
---|
68 | # print |
---|
69 | # print '-----------------------------------------------' |
---|
70 | # print 'Attempting to compile Metis' |
---|
71 | # print '-----------------------------------------------' |
---|
72 | # |
---|
73 | # import pypar |
---|
74 | # |
---|
75 | # # Attempt to compile Metis for use with anuga_parallel |
---|
76 | # os.chdir('source') |
---|
77 | # os.chdir('anuga') |
---|
78 | # #os.chdir('parallel') |
---|
79 | # os.chdir('pymetis') |
---|
80 | # |
---|
81 | # print 'Changing to', os.getcwd() |
---|
82 | # |
---|
83 | # cmd = 'python setup.py build_ext --inplace -f ' |
---|
84 | # print cmd |
---|
85 | # err = os.system(cmd) |
---|
86 | # if err != 0: |
---|
87 | # msg = 'Could not compile pymetis ' |
---|
88 | # msg += 'on platform %s, %s\n' % (sys.platform, os.name) |
---|
89 | # msg += 'You need to compile metis manually ' |
---|
90 | # msg += 'if you want to run ANUGA in parallel.' |
---|
91 | # raise Exception, msg |
---|
92 | # else: |
---|
93 | # msg = 'Compiled pymetis successfully.' |
---|
94 | # print msg |
---|
95 | # |
---|
96 | # |
---|
97 | # |
---|
98 | # except: |
---|
99 | # print |
---|
100 | # print 'pymetis could not compile as pypar not installed' |
---|
101 | # |
---|
102 | # |
---|
103 | # os.chdir(buildroot) |
---|
104 | # print 'Changing to', os.getcwd() |
---|
105 | # |
---|
106 | # #-------------------------------------------------- |
---|
107 | # # Compiling pypar_extras |
---|
108 | # #-------------------------------------------------- |
---|
109 | # |
---|
110 | # try: |
---|
111 | # print |
---|
112 | # print '-----------------------------------------------' |
---|
113 | # print 'Attempting to compile mpiextras' |
---|
114 | # print '-----------------------------------------------' |
---|
115 | # |
---|
116 | # import pypar |
---|
117 | # |
---|
118 | # os.chdir('source') |
---|
119 | # os.chdir('anuga') |
---|
120 | # os.chdir('parallel') |
---|
121 | # #os.chdir('pypar_extras') |
---|
122 | # |
---|
123 | # cmd = 'python setup.py build_ext --inplace -f ' |
---|
124 | # print cmd |
---|
125 | # err = os.system(cmd) |
---|
126 | # if err != 0: |
---|
127 | # msg = 'Could not compile mpiextras ' |
---|
128 | # msg += 'on platform %s, %s\n' % (sys.platform, os.name) |
---|
129 | # msg += 'You need to compile mpiextras manually ' |
---|
130 | # msg += 'if you want to run ANUGA in parallel.' |
---|
131 | # raise Exception, msg |
---|
132 | # else: |
---|
133 | # msg = 'Compiled mpiextras successfully.' |
---|
134 | # print msg |
---|
135 | # except: |
---|
136 | # print 'anuga.parallel code not compiled as pypar not installed' |
---|
137 | # |
---|
138 | # |
---|
139 | |
---|
140 | print |
---|
141 | print 'That took %.3fs' %(time.time() - t0) |
---|
142 | |
---|
143 | |
---|
144 | |
---|
145 | |
---|