-
Notifications
You must be signed in to change notification settings - Fork 169
Expand file tree
/
Copy pathsetup.py
More file actions
41 lines (33 loc) · 887 Bytes
/
setup.py
File metadata and controls
41 lines (33 loc) · 887 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
import os
import platform
from setuptools import setup
IS_CPYTHON = platform.python_implementation() == "CPython"
DISABLE_EXTENSION = bool(os.environ.get("DISABLE_LOGBOOK_CEXT"))
def status_msgs(*msgs):
print("*" * 75)
for msg in msgs:
print(msg)
print("*" * 75)
if not IS_CPYTHON:
status_msgs(
"WARNING: C extensions are not supported on this Python platform, "
"speedups are not enabled.",
)
kwargs = {}
elif DISABLE_EXTENSION:
status_msgs(
"DISABLE_LOGBOOK_CEXT is set; not attempting to build C extensions.",
)
kwargs = {}
else:
from setuptools_rust import RustExtension
kwargs = {
"rust_extensions": [
RustExtension(
"logbook._speedups",
"src/rust/Cargo.toml",
rust_version=">=1.74",
)
]
}
setup(**kwargs)