-
-
Notifications
You must be signed in to change notification settings - Fork 245
Expand file tree
/
Copy pathsetup.py
More file actions
36 lines (25 loc) · 926 Bytes
/
setup.py
File metadata and controls
36 lines (25 loc) · 926 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
import os
import platform
import setuptools
# # --- Detect if extensions should be disabled ------------------------------
wrapt_env = os.environ.get("WRAPT_INSTALL_EXTENSIONS")
if wrapt_env is None:
wrapt_env = os.environ.get("WRAPT_EXTENSIONS")
if wrapt_env is not None:
disable_extensions = wrapt_env.lower() == "false"
force_extensions = wrapt_env.lower() == "true"
else:
disable_extensions = False
force_extensions = False
if platform.python_implementation() != "CPython":
disable_extensions = True
# --- C extension ------------------------------------------------------------
extensions = [
setuptools.Extension(
"wrapt._wrappers",
sources=["src/wrapt/_wrappers.c"],
optional=not force_extensions,
)
]
# --- Setup ------------------------------------------------------------------
setuptools.setup(ext_modules=[] if disable_extensions else extensions)