Skip to content

Commit 9d47743

Browse files
committed
don't ask for patchelf if ninja is available and the project is pure
Signed-off-by: Filipe Laíns <[email protected]>
1 parent 47f3ba6 commit 9d47743

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

mesonpy/__init__.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -1019,7 +1019,15 @@ def get_requires_for_build_wheel(
10191019
# we may need patchelf
10201020
if not shutil.which('patchelf'):
10211021
# patchelf not already accessible on the system
1022-
dependencies.append(_depstr.patchelf)
1022+
if _env_ninja_command() is not None:
1023+
# we have ninja available, so we can run Meson and check if the project needs patchelf
1024+
with _project(config_settings) as project:
1025+
if not project.is_pure:
1026+
dependencies.append(_depstr.patchelf)
1027+
else:
1028+
# we can't check if the project needs patchelf, so always add it
1029+
# XXX: wait for https://github.com/mesonbuild/meson/pull/10779
1030+
dependencies.append(_depstr.patchelf)
10231031

10241032
return dependencies
10251033

tests/test_pep517.py

+10-3
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,17 @@ def run(cmd: List[str], *args: object, **kwargs: object) -> subprocess.Completed
3737
monkeypatch.setattr(subprocess, 'run', run)
3838

3939
expected = {mesonpy._depstr.wheel}
40-
if system_patchelf is None and sys.platform.startswith('linux'):
41-
expected |= {mesonpy._depstr.patchelf}
42-
if ninja is None or [int(x) for x in ninja.split('.')] < [1, 8, 2]:
40+
41+
ninja_available = ninja is not None and [int(x) for x in ninja.split('.')] >= [1, 8, 2]
42+
43+
if not ninja_available:
4344
expected |= {mesonpy._depstr.ninja}
4445

46+
if (
47+
system_patchelf is None and sys.platform.startswith('linux')
48+
and (not ninja_available or (ninja_available and package != 'pure'))
49+
):
50+
expected |= {mesonpy._depstr.patchelf}
51+
4552
with cd_package(package):
4653
assert set(mesonpy.get_requires_for_build_wheel()) == expected

0 commit comments

Comments
 (0)