forked from scottransom/presto
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
89 lines (74 loc) · 3.48 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
from __future__ import print_function
import os
import sys
import numpy
# setuptools has to be imported before numpy.distutils.core
import setuptools
from numpy.distutils.core import Extension, setup
version = "3.0"
define_macros = []
undef_macros = []
extra_compile_args = ["-DUSEFFTW"]
include_dirs = [numpy.get_include()]
# For MacOS with MacPorts use the following
# include_dirs.append("/opt/local/include")
# Note: you might need to add "gfortran" to the following list if
# you see errors relating to missing "g" functions....
ppgplot_libraries = ["cpgplot", "pgplot", "X11", "png", "m"]
ppgplot_library_dirs = ["/usr/X11R6/lib"]
presto_libraries = ["presto", "fftw3f", "m"]
presto_library_dirs = []
ppgplot_include_dirs = include_dirs
presto_include_dirs = include_dirs
undef_macros.append('USE_NUMARRAY')
if os.name != "posix":
raise Exception("os not supported")
if "PGPLOT_DIR" in os.environ:
ppgplot_library_dirs.append(os.environ["PGPLOT_DIR"])
ppgplot_include_dirs.append(os.environ["PGPLOT_DIR"])
else:
print("PGPLOT_DIR env var not defined!", file=sys.stderr)
if "PRESTO" in os.environ:
presto_library_dirs.append(os.path.join(os.environ["PRESTO"], "lib"))
presto_include_dirs.append(os.path.join(os.environ["PRESTO"], "include"))
else:
print("PRESTO env var not defined!", file=sys.stderr)
presto_include_dirs.append(os.path.join(os.path.dirname(__file__),
'include'))
ext_ppgplot = Extension('_ppgplot',
['python/ppgplot_src/_ppgplot.c'],
include_dirs=ppgplot_include_dirs,
libraries=ppgplot_libraries,
library_dirs=ppgplot_library_dirs,
define_macros=define_macros,
extra_compile_args=extra_compile_args)
ext_presto = Extension('_presto',
['python/presto_src/presto_wrap.c'],
include_dirs=presto_include_dirs,
libraries=presto_libraries,
library_dirs=presto_library_dirs,
define_macros=define_macros,
extra_compile_args=extra_compile_args)
ext_fftfit = Extension('_fftfit', sources=['python/fftfit_src/brent.f',
'python/fftfit_src/cprof.f',
'python/fftfit_src/fccf.f',
'python/fftfit_src/ffft.f',
'python/fftfit_src/fftfit.f',
'python/fftfit_src/_fftfit.pyf'])
scripts = ['bin/' + i for i in os.listdir('bin') if i.endswith('.py') or i.endswith('.sh')]
setup(name="presto",
version=version,
install_requires=['numpy', 'future', 'six', 'scipy', 'matplotlib', 'astropy', 'pyslalib'],
scripts=scripts,
description="Python interfaces to PGPLOT and PRESTO",
author="Scott Ransom (ppgplot from Nick Patavlis)",
author_email="[email protected]",
url="https://github.com/scottransom/presto",
packages=['presto', 'presto.ppgplot', 'presto.presto', 'presto.singlepulse'],
package_dir={'presto.ppgplot': 'python/ppgplot_src',
'presto.presto': 'python/presto_src',
'presto': 'python/presto',
'presto.singlepulse': 'python/presto/singlepulse',
},
package_data={'presto': ['*.json']},
ext_modules=[ext_ppgplot, ext_presto, ext_fftfit])