-
Notifications
You must be signed in to change notification settings - Fork 2
/
setup.py
87 lines (75 loc) · 2.9 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
import os
import sys
import shutil
import subprocess
from setuptools import setup, Extension
from setuptools.command.build_ext import build_ext
DISTNAME = 'disc'
DESCRIPTION = 'Discover and Describe Diverging Data Partitions'
AUTHOR = 'Sebastian Dalleiger'
AUTHOR_EMAIL = '[email protected]'
LICENSE = 'MIT'
VERSION = "0.2.2"
URL = 'https://github.com/sdalleig/disc-aaai20'
CLASSIFIERS = ['Intended Audience :: Science/Research',
'Intended Audience :: Developers',
'Intended Audience :: Data Scientists',
'License :: MIT',
'License :: OSI Approved',
'Programming Language :: Python',
'Programming Language :: C++',
'Topic :: Scientific/Engineering',
'Operating System :: Microsoft :: Windows',
'Operating System :: POSIX',
'Operating System :: Unix',
'Operating System :: MacOS']
with open('README.md') as readme_file:
LONG_DESCRIPTION = readme_file.read()
class Ext(Extension):
def __init__(self, name, src=''):
Extension.__init__(self, name, sources=[])
self.src = os.path.abspath(src)
class Build(build_ext):
def run(self):
for ext in self.extensions:
self.build_extension(ext)
def build_extension(self, ext):
# required for auto-detection of auxiliary "native" libs
t = os.path.abspath(os.path.dirname(self.get_ext_fullpath(ext.name)))
if not t.endswith(os.path.sep):
t += os.path.sep
if not os.path.exists(self.build_temp):
os.makedirs(self.build_temp)
# subprocess.check_call(['meson', ext.src, "--prefix", t], cwd=self.build_temp)
# subprocess.check_call(['meson', 'compile'], cwd=self.build_temp)
# subprocess.check_call(['meson', 'install'], cwd=self.build_temp)
subprocess.check_call(['cmake',
'-H{}'.format(ext.src),
'-B{}'.format(self.build_temp),
'-DPYTHON_EXECUTABLE={}'.format(sys.executable),
"-DCMAKE_INSTALL_PREFIX={}".format(t),
"-DCMAKE_BUILD_TYPE=Release"])
subprocess.check_call(['cmake',
'--build',
self.build_temp,
'--target', 'install'])
shutil.rmtree(self.build_temp)
setup(
name=DISTNAME,
author=AUTHOR,
author_email=AUTHOR_EMAIL,
maintainer=AUTHOR,
maintainer_email=AUTHOR_EMAIL,
description=DESCRIPTION,
long_description=LONG_DESCRIPTION,
license=LICENSE,
version=VERSION,
url=URL,
download_url=URL,
classifiers=CLASSIFIERS,
options={"bdist_wheel": {"universal": True}},
ext_modules=[Ext('disc')],
cmdclass=dict(build_ext=Build),
zip_safe=False,
install_requires=['pybind11', 'numpy'],
)