-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
93 lines (75 loc) · 2.53 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
import os
import subprocess
import sys
from setuptools import Extension, find_packages, setup
from setuptools.command.build_ext import build_ext
class CMakeExtension(Extension):
def __init__(self, name, sourcedir):
Extension.__init__(self, name, sources=[])
self.sourcedir = os.path.abspath(sourcedir)
class CMakeExtensionBuild(build_ext):
def run(self):
for ext in self.extensions:
self.build_extension(ext)
def build_extension(self, ext):
ext_dir = os.path.abspath(
os.path.dirname(self.get_ext_fullpath(ext.name)))
debug_flag = f'{ext.name}_DEBUG'
build_type = 'Debug' if debug_flag in os.environ else 'Release'
cmake_args = [
f'-DCMAKE_BUILD_TYPE={build_type}',
f'-DCMAKE_LIBRARY_OUTPUT_DIRECTORY={ext_dir}',
f'-DCMAKE_ARCHIVE_OUTPUT_DIRECTORY={ext_dir}',
f'-DPYTHON_EXECUTABLE={sys.executable}'
]
build_args = []
if not os.path.exists(self.build_temp):
os.makedirs(self.build_temp)
subprocess.check_call(
['cmake', ext.sourcedir] + cmake_args, cwd=self.build_temp)
subprocess.check_call(
['cmake', '--build', '.'] + build_args, cwd=self.build_temp)
print()
setup(
name='gbkfit',
description='description',
long_description='long description',
author='Georgios Bekiaris',
author_email='[email protected]',
url='https://github.com/bek0s/gbkfit',
license='BSD (3-clause)',
classifiers=[
'Development Status :: 3 - Alpha',
'Environment :: Console',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: BSD License',
'Operating System :: MacOS',
'Operating System :: POSIX :: Linux',
'Programming Language :: C++',
'Programming Language :: Python :: 3',
'Topic :: Scientific/Engineering :: Astronomy'
],
packages=find_packages('src'),
package_dir={'': 'src'},
python_requires='>=3.10',
install_requires=[
'astropy',
'matplotlib',
'numpy',
'pandas',
'ruamel.yaml',
'scikit-image',
'scipy'
],
entry_points={
'console_scripts': [
'gbkfit-cli = gbkfit.apps.cli:main'
],
'gui_scripts': [
'gbkfit-gui = gbkfit.apps.gui:main'
]
},
ext_package='gbkfit/driver/native',
ext_modules=[CMakeExtension('libgbkfit', 'src/gbkfit/driver/native')],
cmdclass={'build_ext': CMakeExtensionBuild}
)