forked from cta-observatory/pyeventio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
106 lines (91 loc) · 3.26 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
from setuptools import setup, find_packages
import os
import re
# make sure users without cython can install our extensions
try:
from Cython.Distutils.extension import Extension
from Cython.Distutils import build_ext as _build_ext
USE_CYTHON = True
except ImportError:
from setuptools import Extension
from setuptools.command.build_ext import build_ext as _build_ext
USE_CYTHON = False
print('using cython', USE_CYTHON)
# make sure numpy is installed before we try to build
# the extenion
class build_ext(_build_ext):
def finalize_options(self):
super().finalize_options()
import numpy
self.include_dirs.append(numpy.get_include())
# if we have cython, use the cython file if not the c file
ext = '.pyx' if USE_CYTHON else '.c'
extensions = [
Extension('eventio.header', sources=['eventio/header' + ext]),
Extension('eventio.var_int', sources=['eventio/var_int' + ext]),
Extension(
'eventio.simtel.parsing',
sources=['eventio/simtel/parsing' + ext]
),
]
cmdclass = {'build_ext': build_ext}
# give a nice error message if people cloned the
# repository and do not have cython installed
if ext == '.c':
sources = []
for ext in extensions:
sources.extend(ext.sources)
if not all(os.path.isfile(s) for s in sources):
raise ImportError('You need `Cython` to build this project locally')
with open('README.rst') as f:
long_description = f.read()
with open('eventio/__init__.py') as f:
m = re.search("__version__ = [\"']([0-9.]+)[\"']", f.read())
version = m.groups()[0]
setup(
name='eventio',
version=version,
description='Python read-only implementation of the EventIO file format',
long_description=long_description,
url='https://github.com/cta-observatory/pyeventio',
author='Dominik Neise, Maximilian Noethe',
author_email='[email protected]',
license='MIT',
packages=find_packages(),
ext_modules=extensions,
cmdclass=cmdclass,
package_data={
'eventio': ['*.c'],
'eventio.simtel': ['*.c'],
},
python_requires='>=3.5',
install_requires=[
'numpy',
'corsikaio ~= 0.2.0',
],
entry_points={
'console_scripts': [
'eventio_print_structure = eventio.scripts.print_structure:main',
'eventio_plot_histograms = eventio.scripts.plot_hists:main',
'eventio_print_object_information = eventio.scripts.print_object_information:main',
'eventio_cut_file = eventio.scripts.cut_eventio_file:main',
]
},
setup_requires=['pytest-runner', 'numpy'],
tests_require=['pytest>=3.0.0'],
classifiers=[
'Development Status :: 4 - Beta',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: MIT License',
'Natural Language :: English',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3 :: Only',
'Topic :: Scientific/Engineering :: Astronomy',
'Topic :: Scientific/Engineering :: Physics',
],
)