-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathsetup.py
73 lines (61 loc) · 2.11 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
import os
import sys
from glob import glob
from setuptools import setup, Command, Extension
try:
import numpy as np
except ImportError:
print("Need numpy for installation")
sys.exit(1)
try:
from Cython.Build import cythonize
except ImportError:
print("Need cython for installation")
sys.exit(1)
try:
with open("README.rst", "r") as handle:
long_description = handle.read()
except:
long_description = "Minimal Cython wrapper of the TNG trajectory library"
class CleanCommand(Command):
"""Custom clean command to tidy up the project root."""
# https://stackoverflow.com/questions/3779915/why-does-python-setup-py-sdist-create-unwanted-project-egg-info-in-project-r
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
os.system('rm -vrf ./*.so')
os.system('rm -vrf build')
os.system('rm -vrf dist')
os.system('rm -vrf pytng.egg-info')
os.system("find pytng -name '*.pyc' -delete -print")
os.system("find pytng -name '*.so' -delete -print")
def extensions():
""" setup extensions for this module
"""
exts = []
exts.append(
Extension(
'pytng.pytng',
sources=glob('pytng/src/compression/*.c') + glob(
'pytng/src/lib/*.c') + glob('pytng/src/external/*.c') + glob('pytng/src/external/zlib/*.c') + ['pytng/pytng.pyx'],
include_dirs=[
"pytng/include/", "pytng/include/external/", "{}/include".format(sys.prefix),
np.get_include()
],
library_dirs=["{}/lib".format(sys.prefix)]))
return cythonize(exts, gdb_debug=False)
setup(
name="pytng",
python_requires=">=3.9",
install_requires=['numpy>=1.22.3'],
description='Minimal Cython wrapper of the TNG trajectory library',
long_description=long_description,
long_description_content_type='text/x-rst',
author='Max Linke, Richard J Gowers, Hugo MacDermott-Opeskin',
author_email='[email protected]',
packages=['pytng'],
ext_modules=extensions(),
zip_safe=False)