-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathsetup.py
More file actions
executable file
·43 lines (34 loc) · 1010 Bytes
/
setup.py
File metadata and controls
executable file
·43 lines (34 loc) · 1010 Bytes
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
#!/usr/bin/env python3
import glob
import os
import numpy
from pybind11.setup_helpers import ParallelCompile, Pybind11Extension
from setuptools import setup
# see https://github.com/pybind/python_example
def list_files(dirs, exts, exclude=None):
exclude = exclude or []
files = []
if isinstance(exclude, str):
exclude = [exclude]
for directory in dirs:
for ext in exts:
files.extend(glob.glob(os.path.join(directory, "*." + ext)))
[f in files and files.remove(f) for f in exclude]
return files
ext_modules = [
Pybind11Extension(
"_neworder_core",
sources=list_files(["src"], ["cpp"]),
include_dirs=[numpy.get_include()],
depends=["setup.py", "neworder/__init__.py"] + list_files(["src"], ["h"]),
cxx_std=20,
),
]
ParallelCompile().install()
setup(
name="neworder",
packages=["neworder"],
package_data={"neworder": ["py.typed", "*.pyi"]},
ext_modules=ext_modules,
zip_safe=False,
)