-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
70 lines (60 loc) · 2.13 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
import os
import subprocess
from setuptools import setup
from setuptools.extension import Extension
extra_kwargs = {}
try:
from Cython.Build import cythonize
except ImportError:
pass
else:
import numpy
extra_kwargs['ext_modules'] = cythonize([
Extension(
'xts.math._vmi_native', ['xts/math/_vmi_native.pyx'],
include_dirs=[numpy.get_include()],
# Do not use -ffast-math for this one, needs further checking!
extra_compile_args=['-O2', '-march=native', '-frename-registers',
'-ftree-vectorize', '-fopenmp'],
extra_link_args=['-fopenmp']
),
Extension(
'xts.math._signal_native', ['xts/math/_signal_native.pyx'],
include_dirs=[numpy.get_include()],
extra_compile_args=['-O2', '-march=native', '-frename-registers',
'-ftree-vectorize', '-ffast-math']
),
], build_dir='./build/sources', language_level=3)
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
try:
short_hash = subprocess.check_output(
['git', 'rev-parse', '--short', 'HEAD'],
stderr=subprocess.STDOUT
)
except Exception:
version_str = 'dev'
else:
if not short_hash.startswith(b'fatal'):
version_str = short_hash.decode('ascii').strip()
setup(
name='XTS',
version=version_str,
author='Philipp Schmidt',
author_email='[email protected]',
description='An extendable toolkit for data analysis of shot data, e.g. '
'at FEL experiments',
license='License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)',
packages=['xts', 'xts.math'],
long_description=read('README.md'),
long_description_content_type='text/markdown',
python_requires='>=3.6',
install_requires=['numpy', 'scipy'],
classifiers=[
'Topic :: Scientific/Engineering :: Physics',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)',
'Programming Language :: Python :: 3',
],
**extra_kwargs
)