Skip to content

Commit dc95e9c

Browse files
committed
Raise an error if we don't provide wheels for a given platform
1 parent 3ab17a5 commit dc95e9c

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

api/python/backend/setup.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import os
44
import sys
55
import sysconfig
6+
import platform
67
from functools import lru_cache
78
from typing import Optional, Union, List
89

@@ -117,6 +118,10 @@ def _get_hooked_config(is_editable: bool) -> Optional[dict[str, Union[str, List[
117118

118119
def _get_build_requirements(is_editable: bool) -> List[str]:
119120
build_req_file = BINDING_DIR / "build-requirements.txt"
121+
if not build_req_file.is_file() and not (BINDING_DIR / "src").is_dir():
122+
# By convention this is an mocked sdist
123+
print(f"LIEF does not provide precompiled wheels for '{sys.platform} - {platform.machine()}'", file=sys.stderr)
124+
sys.exit(1)
120125
reqs = [line for line in build_req_file.read_text().splitlines() if not line.startswith("#")]
121126
return reqs
122127

@@ -168,4 +173,16 @@ def build_sdist(
168173
sdist_directory: str,
169174
config_settings: Optional[dict[str, Union[str, List[str]]]] = None,
170175
) -> str:
171-
raise RuntimeError("LIEF does not support Python source distribution ('sdist')")
176+
from scikit_build_core.build.sdist import build_sdist as _impl
177+
config_settings = _get_hooked_config(is_editable=False)
178+
config_settings['sdist.exclude'].extend([
179+
'*'
180+
])
181+
config_settings['sdist.include'] = [
182+
'pyproject.toml',
183+
'backend/setup.py',
184+
'backend/versioning.py',
185+
'backend/config.py',
186+
'backend/dynamic_provider.py',
187+
]
188+
return _impl(sdist_directory, config_settings)

0 commit comments

Comments
 (0)