-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathsetup.py
109 lines (98 loc) · 3.02 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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Setup script for the PSRDada python bindings.
Build and install the package using distutils.
"""
# pylint: disable=all
from Cython.Build import cythonize
from setuptools import setup
from distutils.extension import Extension
from os import environ, path
with open('README.md') as readme_file:
README = readme_file.read()
with open(path.join('psrdada', '__version__.py')) as version_file:
version = {}
exec(version_file.read(), version)
PROJECT_VERSION = version['__version__']
# Get the header locations from the environment
INCLUDE_DIRS = []
if "CPATH" in environ:
flags = environ["CPATH"].split(':')
for flag in flags:
# when usingn spack, there is no -I prefix
INCLUDE_DIRS.append(flag)
if "CFLAGS" in environ:
flags = environ["CFLAGS"].split(' ')
for flag in flags:
if flag[0:2] == '-I':
# when usingn spack, there is no -I prefix
INCLUDE_DIRS.append(flag[2:-1])
# keep the original order
INCLUDE_DIRS.reverse()
# Get the header locations from the environment
LIBRARY_DIRS = []
if "LD_LIBRARY_PATH" in environ:
flags = environ["LD_LIBRARY_PATH"].split(':')
for flag in flags:
# when usingn spack, there is no -I prefix
LIBRARY_DIRS.append(flag)
# keep the original order
LIBRARY_DIRS.reverse()
EXTENSIONS = [
Extension(
"psrdada.ringbuffer",
["psrdada/ringbuffer.pyx"],
libraries=["psrdada"],
library_dirs=LIBRARY_DIRS,
include_dirs=INCLUDE_DIRS
),
Extension(
"psrdada.reader",
["psrdada/reader.pyx"],
libraries=["psrdada"],
library_dirs=LIBRARY_DIRS,
include_dirs=INCLUDE_DIRS
),
Extension(
"psrdada.writer",
["psrdada/writer.pyx"],
libraries=["psrdada"],
library_dirs=LIBRARY_DIRS,
include_dirs=INCLUDE_DIRS
),
Extension(
"psrdada.viewer",
["psrdada/viewer.pyx"],
libraries=["psrdada"],
library_dirs=LIBRARY_DIRS,
include_dirs=INCLUDE_DIRS
),
]
setup(
name='psrdada',
version=PROJECT_VERSION,
description="Python3 bindings to the ringbuffer implementation in PSRDada",
long_description=README + '\n\n',
author="Jisk Attema",
author_email='[email protected]',
url='https://github.com/NLeSC/psrdada-python',
packages=['psrdada',],
package_dir={'psrdada': 'psrdada'},
include_package_data=True,
license="Apache Software License 2.0",
zip_safe=False,
keywords='psrdada',
classifiers=[
'Development Status :: 2 - Pre-Alpha',
'Intended Audience :: Developers',
'License :: OSI Approved :: Apache Software License',
'Natural Language :: English',
"Programming Language :: Python :: 2",
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
],
test_suite='tests',
ext_modules=cythonize(EXTENSIONS),
)