File size: 1,087 Bytes
065fee7 |
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 |
import os
import sys
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:
if platform.system() == 'Windows' and sys.version_info[0] < 3:
disable_extensions = True
force_extensions = False
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
)
|