-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup.py
executable file
·111 lines (97 loc) · 3.85 KB
/
setup.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#!/usr/bin/env python
from distutils.core import setup, Extension
import os, sys,os.path
import numpy
if not hasattr(sys, 'version_info') or sys.version_info < (2,3,0,'alpha',0):
raise SystemExit, "Python 2.3 or later required to build Numeric."
def check_lib(libname,prefix_var,header):
"""Check if we can find header either in the directory where the environment
variable prefix_var points to, or /usr/local or /usr."""
prefix = []
try:
prefix.append(os.environ[prefix_var])
except KeyError:
for p in ['/usr/local', '/usr']:
prefix.append(p)
for p in prefix:
include = os.path.join(p, 'include')
lib = os.path.join(p, 'lib')
if os.path.exists(os.path.join(include, header)):
break
else:
print 'Error, cannot find %s library in /usr/local and /usr.'%libname
print 'Set environment variable %s to point to the prefix'%prefix_var
print 'where %s is installed.'%libname
sys.exit(1)
return (include,lib)
(proj_include, proj_lib) = check_lib('proj4','PROJ_PREFIX','projects.h')
(gsl_include, gsl_lib) = check_lib('GSL', 'GSL_PREFIX', 'gsl/gsl_errno.h')
# get path to numpy includes
numpy_inc = os.path.join(sys.modules['numpy'].__path__[0],'core','include')
print
print 'Configuration'
print '-------------'
print 'proj4: %s, %s'%(proj_include, proj_lib)
print 'GSL: %s, %s'%(gsl_include, gsl_lib)
print 'numpy include : %s'%numpy_inc
print
ext_modules = [
Extension('PyCF.proj',
['src/projmodule.c'],
include_dirs=[proj_include,numpy_inc],
library_dirs=[proj_lib],
libraries = ['proj']),
Extension('PyCF.TwoDspline',
['src/2Dsplinemodule.c'],
include_dirs=[gsl_include,numpy_inc],
library_dirs=[gsl_lib],
libraries = ['gsl','gslcblas']),
]
data_files = [('share/PyCF/',['data/ice.cpt',
'data/mb.cpt',
'data/temp.cpt',
'data/surf_temp.cpt',
'data/topo.cpt',
'data/velo.cpt',
'data/gthf.cpt',
'data/litho_temp.cpt',
'data/rsl_res.cpt',
'data/eismint2.data']),
('bin',['progs/add_projinfo.py',
'progs/create_topo.py',
'progs/construct_field.py',
'progs/make_anim.py',
'progs/plotCFvar.py',
'progs/plotEISvar.py',
'progs/plotEISMINT.py',
'progs/plotSpot.py',
'progs/plotProfile.py',
'progs/plotProfileTS.py',
'progs/plot3DProfiles.py',
'progs/plotCFstats.py',
'progs/extractProfile.py',
'progs/extractProfileTS.py',
'progs/extract3DProfile.py',
'progs/plotRSL.py',
'progs/plotRSLloc.py',
'progs/plotRSLhist.py',
'progs/plotRSLdata.py',
'progs/plotRSLres.py',
'progs/extractCFstats.py',
'progs/ran_topo.py',
'progs/extractTS.py',
'progs/plotStreams.py',
'progs/plotCFdiff.py',
'progs/plot_extent.py',
'progs/a2c.py',
'progs/plotEISMINT2stats.py'])]
setup (name = "PyCF",
version = "0.5",
description = "Python modules for CF",
author = "Magnus Hagdorn",
author_email = "[email protected]",
packages = ['PyCF'],
ext_modules = ext_modules,
data_files=data_files,
)
#EOF