File: compile.py

package info (click to toggle)
python-scientific 2.4.11-2
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 1,956 kB
  • ctags: 3,063
  • sloc: python: 9,157; ansic: 4,483; xml: 4,145; makefile: 126; sh: 18; csh: 1
file content (41 lines) | stat: -rw-r--r-- 1,017 bytes parent folder | download | duplicates (3)
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
41
# Compile the mpipython executable containing
# the Scientific.MPI extension module

# Normally nothing needs to be changed below
import distutils
import distutils.sysconfig
import os  

cfgDict = distutils.sysconfig.get_config_vars()

# Name of the MPI compilation script.
mpicompiler = 'mpicc'
sources='mpipython.c Scientific_mpi.c'

mpicompiler = 'mpicc'
mpiinclude = '/usr/include/lam'
executable = 'mpipython'

if os.environ.has_key('USE_LAM'):
    mpicompiler = 'mpicc.lam'
    mpiinclude = '/usr/include/lam'
    executable = 'mpipython.lam'
if os.environ.has_key('USE_MPICH'):
    mpicompiler = 'mpicc.mpich'
    mpiinclude = '/usr/lib/mpich/include'
    executable = 'mpipython.mpich'

cmd = '%s %s -o %s -I../../Include -I%s -I%s %s -L%s -lpython%s %s %s' % \
    (mpicompiler, 
    cfgDict['LINKFORSHARED'],
    executable,
    mpiinclude,
    cfgDict['INCLUDEPY'],
    sources,
    cfgDict['LIBPL'],
    cfgDict['VERSION'], 
    cfgDict['LIBS'], 
    cfgDict['LIBM'])

print 'cmd = ', cmd 
os.system(cmd)