This repository was archived by the owner on May 21, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup.py
More file actions
76 lines (63 loc) · 1.55 KB
/
Copy pathsetup.py
File metadata and controls
76 lines (63 loc) · 1.55 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
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
import os
import sys
import requests
import tarfile
from pathlib import Path
from setuptools import setup, Extension
from Cython.Build import cythonize
from Cython.Compiler import Options
##
##
##
DDD = Path("usr/local")
URL = {
"linux": "https://lip6.github.io/libDDD/linux.tgz",
"darwin": "https://github.com/lip6/libDDD/raw/osx/osx.tgz",
"win32": "https://github.com/lip6/libDDD/raw/Windows/windows.zip",
}
SYS = sys.platform
DDDURL = URL[SYS]
DDDLIB = DDD / "lib" / "libDDD.a"
DDDINC = DDD / "include"
DDDTAR = Path(DDDURL.rsplit("/", 1)[-1])
##
##
##
os.chdir("src")
if not DDDTAR.exists():
print("Downloading", DDDTAR)
with requests.get(DDDURL, stream=True) as r:
with DDDTAR.open("wb") as f:
for chunk in r.iter_content(chunk_size=8192):
f.write(chunk)
if not DDD.exists():
print("Unpacking", DDDTAR)
with tarfile.open(DDDTAR) as arch:
# windows.zip is actually a tar file
arch.extractall()
if not DDDLIB.exists():
print(DDDLIB, "not found")
sys.exit(1)
if not DDDINC.exists():
print(DDDINC, "not found")
sys.exit(1)
##
##
##
Options.docstrings = True
Options.annotate = False
extensions = [
Extension(
"daddy.dddlib",
["daddy/dddlib.pyx", "cpp/assign.cpp", "cpp/action.cpp"],
language="c++",
include_dirs=[str(DDDINC), "."],
extra_objects=[str(DDDLIB)],
extra_compile_args=["-std=c++11"],
),
]
setup(
name="daddy",
packages=["daddy", "daddy.pygmy"],
ext_modules=cythonize(extensions, language_level=3),
)