/
setup_fortran_bin.py
65 lines (58 loc) · 1.57 KB
/
setup_fortran_bin.py
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/env python
import os, sys, shutil, platform, struct
home = 'http://synchrotron.org.au/pdviper'
print 70*'*'
print 'Checking python packages...',
missing = []
for pkg in [
'numpy',
'scipy',
'matplotlib',
'chaco',
'traits',
'traitsui',
'enable',
'PySide',
'pandas',
'pyface',
'kiva'
]:
try:
exec('import '+pkg)
except:
missing.append(pkg)
if missing:
print """
Sorry, this version of Python cannot be used
for PDViPeR. It is missing the following package(s):
\t""",
for pkg in missing:
print " ", pkg,
print
print "We suggest installing the EPDfree package at\nhttp://www.enthought.com/products/epd_free.php/"
sys.exit()
if not os.path.exists('bin'):
os.mkdir('bin')
open(os.path.join('bin', '__init__.py'), 'w')
src = None
if sys.platform.startswith('linux'):
src = 'binlinux64-2.7'
elif sys.platform == 'darwin' and platform.machine() == 'x86_64':
src = 'binmac64-2.7'
elif sys.platform == 'darwin' and platform.machine() == 'i386':
src = 'binmac2.7'
elif sys.platform == 'win32':
if struct.calcsize("P")*8 == 64:
src = 'binwin64-2.7'
else:
src = 'binwin2.7'
elif sys.platform == 'darwin':
print 'Mac OS X, PowerPC -- you will need to run f2py on fsource files'
else:
print 'Unidentifed platform -- you may need to run f2py on fsource files'
if src:
files = os.listdir(src)
for f in files:
fullfilename = os.path.join(src, f)
shutil.copy(fullfilename, 'bin')
print src