forked from virgesmith/humanleague
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
executable file
·76 lines (60 loc) · 1.82 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
#!/usr/bin/env python3
import glob
from setuptools import setup, Extension
from setuptools.command.build_ext import build_ext
from pybind11.setup_helpers import Pybind11Extension, ParallelCompile
def readme():
with open('README.md') as f:
return f.read()
def version():
""" The R file DESCRIPTION in the project root is now the single source of version info """
with open("DESCRIPTION") as fd:
lines = fd.readlines()
for line in lines:
if line.startswith("Version:"):
return line.rstrip().split(":")[1].lstrip()
def source_files():
sources = glob.glob("src/*.cpp")
# can't use compile skips as some files are auto-generated
skip = ["RcppExports.cpp", "rcpp_api.cpp"]
for s in skip:
sources = [f for f in sources if not s in f]
return sources
def header_files():
return glob.glob("src/*.h")
def defines():
return [
("HUMANLEAGUE_VERSION", version()),
("PYTHON_MODULE", None)
]
ext_modules = [
Pybind11Extension(
'humanleague',
sources=source_files(),
include_dirs=["src"],
define_macros=defines(),
depends=["setup.py", "DESCRIPTION", "src/docstr.inl"] + header_files(),
cxx_std=17
)
]
ParallelCompile().install()
setup(
name = 'humanleague',
version = version(),
description = 'Microsynthesis using quasirandom sampling and/or IPF',
author = 'Andrew P Smith',
author_email = 'a.p.smith@leeds.ac.uk',
url = 'http://github.com/virgesmith/humanleague',
long_description = readme(),
long_description_content_type="text/markdown",
ext_modules=ext_modules,
install_requires=['numpy>=1.19.1'],
setup_requires=['pybind11>=2.5.0', 'pytest-runner'],
tests_require=['pytest'],
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
],
zip_safe=False,
)