Skip to content

Commit bdde3f0

Browse files
committed
Make extension optional by default
1 parent fb94f33 commit bdde3f0

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,6 @@ warn_unused_configs = true
6868
[tool.cibuildwheel]
6969
test-command = "pytest --import-mode=importlib -p no:cacheprovider {project}/tests"
7070
test-requires = ["pytest", "pytest-cov", "pytest-asyncio", "pytest-trio"]
71+
72+
[tool.cibuildwheel.environment]
73+
SONYFLAKE_TURBO_BUILD_REQUIRED = "1"

setup.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,16 @@
66

77
from setuptools import Extension, setup
88

9-
build: bool = os.environ.get("SONYFLAKE_TURBO_BUILD", "1").lower() in ("1", "true")
9+
10+
def get_bool(name: str, default: bool = False) -> bool:
11+
try:
12+
return os.environ[f"SONYFLAKE_TURBO_{name}"].lower() in ("1", "true")
13+
except KeyError:
14+
return default
15+
16+
17+
build: bool = get_bool("BUILD", True)
18+
build_required: bool = get_bool("BUILD_REQUIRED", False)
1019
options: Dict[str, Any] = {}
1120
define_macros: List[Tuple[str, Optional[str]]] = []
1221
py_limited_api: bool = not sysconfig.get_config_var("Py_GIL_DISABLED")
@@ -44,6 +53,7 @@
4453
define_macros=define_macros,
4554
py_limited_api=py_limited_api,
4655
extra_compile_args=cflags,
56+
optional=not build_required,
4757
),
4858
],
4959
}

0 commit comments

Comments
 (0)