1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
--- Src/MPI/compile.py
+++ Src/MPI/compile.py
@@ -4,7 +4,7 @@
# Normally nothing needs to be changed below
import distutils
import distutils.sysconfig
-import os, sys
+import os, subprocess, sys
from Scientific import N
cfgDict = distutils.sysconfig.get_config_vars()
@@ -32,16 +32,16 @@
items[i] = os.path.join(frameworkdir[0], items[i])
linkforshared = ' '.join(items)
-cmd = '%s %s -o mpipython -I%s %s %s -L%s -lpython%s %s %s' % \
- (mpicompiler,
- linkforshared,
- cfgDict['INCLUDEPY'],
- extra_compile_args,
- sources,
- cfgDict['LIBPL'],
- cfgDict['VERSION'],
- cfgDict['LIBS'],
- cfgDict['LIBM'])
+cmd = [mpicompiler]
+cmd.extend(linkforshared.split())
+cmd.extend(os.environ.get("CFLAGS", "").split())
+cmd.extend(os.environ.get("LDFLAGS", "").split())
+cmd.extend(["-o", "mpipython"])
+cmd.extend(["-I" + x for x in cfgDict['INCLUDEPY'].split()])
+cmd.extend(["-I../../Include"])
+cmd.extend(extra_compile_args.split())
+cmd.extend(sources.split())
+cmd.extend(["-lpython%s" % cfgDict['VERSION']])
-print 'cmd = ', cmd
-os.system(cmd)
+print 'cmd =', " ".join(cmd)
+sys.exit(subprocess.call(cmd))
|