Add a patchelf build conditional

- Add a comment briefly explaining what this does, where, and why.

This does not change what is built by default in each place (Fedora,
EPEL, RHEL), but it ties related conditional sections together and makes
everything easier to test.

[skip changelog]
This commit is contained in:
Benjamin A. Beasley 2024-06-10 19:32:30 -04:00 committed by Pavel Simovec
parent 281defd308
commit e855a27bc9

View File

@ -2,6 +2,12 @@
# The python-pytest-mock dependency is unwanted on RHEL; we can omit it and
# still run most of the tests.
%bcond pytest_mock %{undefined rhel}
# RHEL will not have patchelf (which is used for adjusting RPATH in shared
# libraries bundled in wheels); that is OK because the package is
# buildroot-only there and the packages built with python-meson-python will not
# bundle shared libraries. In Fedora and EPEL, we must depend on patchelf to
# ship a full-featured package.
%bcond patchelf %{expr:%{undefined rhel} || %{defined epel}}
Name: python-meson-python
Summary: Meson Python build backend (PEP 517)
@ -42,7 +48,7 @@ Summary: %{summary}
# When patchelf is not in the PATH, mesonpy.get_requires_for_build_wheel() adds
# https://pypi.org/project/patchelf/ to the dependencies. We always want to use
# the system patchelf.
%if 0%{?epel} || !0%{?rhel}
%if %{with patchelf}
BuildRequires: /usr/bin/patchelf
Requires: /usr/bin/patchelf
%endif
@ -57,7 +63,7 @@ Requires: /usr/bin/patchelf
%setup -n meson_python-%{version} -q
%patch 0 -p1
%patch 1 -p1
%if !0%{?epel} && 0%{?rhel}
%if %{without patchelf}
%patch 2 -p1
%endif
# build: used only by skipped PEP 518 test
@ -92,7 +98,7 @@ ignore="${ignore-} --ignore=tests/test_pep518.py"
k="${k-}${k+ and }not test_invalid_build_dir"
k="${k-}${k+ and }not test_use_ansi_colors"
%endif
%if !0%{?epel} && 0%{?rhel}
%if %{without patchelf}
k="${k-}${k+ and }not test_contents"
k="${k-}${k+ and }not test_local_lib"
k="${k-}${k+ and }not test_rpath"