-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathsetup.py
More file actions
39 lines (33 loc) · 1.04 KB
/
setup.py
File metadata and controls
39 lines (33 loc) · 1.04 KB
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
import typing as tp
from setuptools import setup, Extension
from setuptools.command.build_ext import build_ext
import site, os
from pathlib import Path
AK_VERSION = Path("VERSION").read_text(encoding="utf-8").strip()
def get_ext_dir(*components: tp.Iterable[str]) -> tp.Sequence[str]:
dirs = []
for sp in site.getsitepackages():
fp = os.path.join(sp, *components)
if os.path.exists(fp):
dirs.append(fp)
return dirs
ext_modules = [
Extension(
name="arraykit._arraykit",
sources=[
"src/_arraykit.c",
"src/array_go.c",
"src/array_to_tuple.c",
"src/block_index.c",
"src/delimited_to_arrays.c",
"src/methods.c",
"src/tri_map.c",
"src/auto_map.c",
],
include_dirs=get_ext_dir('numpy', '_core', 'include') + ['src'],
library_dirs=get_ext_dir('numpy', '_core', 'lib'),
define_macros=[("AK_VERSION", AK_VERSION)],
libraries=["npymath"],
)
]
setup(ext_modules=ext_modules)