-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup.py
executable file
·156 lines (140 loc) · 4.03 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
#!/usr/bin/python
import platform
import pathlib
from setuptools import setup, find_packages, Extension
try:
from Cython.Distutils import build_ext
except ImportError:
from setuptools.command.build_ext import build_ext
from chisurf import info
NAME = info.__name__
VERSION = info.__version__
AUTHOR = info.__author__
LICENSE = info.__license__
DESCRIPTION = info.__description__
LONG_DESCRIPTION = info.LONG_DESCRIPTION
URL = info.__url__
EMAIL = info.__email__
def dict_from_txt(fn):
d = {}
with open(fn) as f:
for line in f:
(key, val) = line.split()
d[str(key)] = val
return d
script_directory = pathlib.Path(__file__).parent.absolute()
gui_scripts = dict_from_txt(script_directory / "chisurf/entry_points/gui.txt")
console_scripts = dict_from_txt(script_directory / "chisurf/entry_points/cmd.txt")
def get_extensions():
def make_extension(ext):
"""generate an Extension object from its dotted name
"""
import numpy as np
name = (ext[0])[2:-4]
name = name.replace("/", ".")
name = name.replace("\\", ".")
sources = ext[0:]
if platform.system() == "Darwin":
extra_compile_args = ["-O3", "-stdlib=libc++"]
extra_link_args = ["-stdlib=libc++"]
else:
extra_compile_args = []
extra_link_args = []
return Extension(
name,
sources=sources,
include_dirs=[np.get_include(), "."],
extra_compile_args=extra_compile_args,
extra_link_args=extra_link_args,
libraries=list(),
library_dirs=["."],
language="c++"
)
# and build up the set of Extension objects
eList = [
[
'./chisurf/fluorescence/simulation/simulation_.pyx',
'./chisurf/fluorescence/simulation/mt19937cok.cpp'
],
[
'./chisurf/structure/av/fps_.pyx',
'./chisurf/structure/av/mt19937cok.cpp'
],
[
'./chisurf/structure/potential/cPotentials_.pyx'
],
[
'./chisurf/math/reaction/reaction_.pyx'
]
]
try:
return [make_extension(extension) for extension in eList]
except ImportError:
return list()
metadata = dict(
name=NAME,
version=VERSION,
license=LICENSE,
description=DESCRIPTION,
author=AUTHOR,
author_email=EMAIL,
url=URL,
classifiers=[
'Development Status :: 2 - Pre-Alpha',
'Intended Audience :: Science/Research',
'Natural Language :: English',
'Operating System :: Microsoft :: Windows',
'Operating System :: MacOS :: MacOS X',
'Operating System :: POSIX :: Linux',
'Programming Language :: Python :: 3.7',
'Topic :: Scientific/Engineering',
],
keywords='fluorescence single-molecule spectroscopy',
packages=find_packages(
include=(NAME + "*",)
),
package_dir={
NAME: NAME
},
include_package_data=True,
package_data={
'': [
'*.json', '*.yaml',
'*.ui', '*.css', '*.qss',
'*.png', '*.svg',
'*.csv', '*.npy', '*.dat',
'*.dll', '*.so', '*.pyd', '*.ipynb'
]
},
install_requires=[
'PyQt5', 'qtpy', 'sip', 'pyqtgraph', 'qtconsole',
'numba', 'numpy', 'numexpr', 'scipy',
'cython', 'python-slugify', 'deprecation',
'emcee',
'PyYAML', 'typing-extensions',
'tables',
'matplotlib', 'python-docx',
'mdtraj',
'ipython'
],
setup_requires=[
"cython",
'numpy',
'PyYAML',
'setuptools'
],
ext_modules=get_extensions(),
cmdclass={
'build_ext': build_ext
},
entry_points={
"console_scripts": [
f"{key}={console_scripts[key]}" for key in console_scripts
],
"gui_scripts": [
f"{key}={gui_scripts[key]}" for key in gui_scripts
]
}
)
if __name__ == "__main__":
setup(**metadata)