diff --git a/.python-meson-python.metadata b/.python-meson-python.metadata new file mode 100644 index 0000000..e62e33e --- /dev/null +++ b/.python-meson-python.metadata @@ -0,0 +1 @@ +9e6dbb00173189dc2d5b0a7eeb8a206268dc0a4f SOURCES/meson_python-0.17.1.tar.gz diff --git a/SOURCES/meson_python-remove-patchelf.patch b/SOURCES/meson_python-remove-patchelf.patch new file mode 100644 index 0000000..39495a0 --- /dev/null +++ b/SOURCES/meson_python-remove-patchelf.patch @@ -0,0 +1,39 @@ +diff --color -ruN a/mesonpy/__init__.py b/mesonpy/__init__.py +--- a/mesonpy/__init__.py 2024-06-05 11:10:53.628398345 +0200 ++++ b/mesonpy/__init__.py 2024-06-05 11:31:13.600792738 +0200 +@@ -410,6 +410,7 @@ + # directory, in the form of a relative RPATH entry. meson-python + # relocates the shared libraries to the $project.mesonpy.libs + # folder. Rewrite the RPATH to point to that folder instead. ++ assert False, "Patchelf is not allowed to run on RHEL" + libspath = os.path.relpath(self._libs_dir, destination.parent) + mesonpy._rpath.fix_rpath(origin, libspath) + +@@ -1007,9 +1008,6 @@ + if os.environ.get('NINJA') is None and _env_ninja_command() is None: + dependencies.append(f'ninja >= {_NINJA_REQUIRED_VERSION}') + +- if sys.platform.startswith('linux') and not shutil.which('patchelf'): +- dependencies.append('patchelf >= 0.11.0') +- + return dependencies + + +diff --color -ruN a/mesonpy/_rpath.py b/mesonpy/_rpath.py +--- a/mesonpy/_rpath.py 2024-06-05 11:10:53.628398345 +0200 ++++ b/mesonpy/_rpath.py 2024-06-05 11:31:18.954861673 +0200 +@@ -17,12 +17,13 @@ + + + if sys.platform == 'linux': +- + def _get_rpath(filepath: Path) -> List[str]: ++ assert False, "Patchelf is not allowed to run on RHEL" + r = subprocess.run(['patchelf', '--print-rpath', os.fspath(filepath)], capture_output=True, text=True) + return r.stdout.strip().split(':') + + def _set_rpath(filepath: Path, rpath: Iterable[str]) -> None: ++ assert False, "Patchelf is not allowed to run on RHEL" + subprocess.run(['patchelf','--set-rpath', ':'.join(rpath), os.fspath(filepath)], check=True) + + def fix_rpath(filepath: Path, libs_relative_path: str) -> None: diff --git a/SPECS/python-meson-python.spec b/SPECS/python-meson-python.spec new file mode 100644 index 0000000..289690f --- /dev/null +++ b/SPECS/python-meson-python.spec @@ -0,0 +1,190 @@ +%bcond tests 1 +# 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 1 + +Name: python-meson-python +Summary: Meson Python build backend (PEP 517) +Version: 0.17.1 +Release: 2%{?dist} + +# SPDX +License: MIT +URL: https://github.com/mesonbuild/meson-python +Source: %{pypi_source meson_python} + +# Downstream-only patch to remove the patchelf dependency (and corresponding +# functionality), controlled by the patchelf build conditional +Patch100: meson_python-remove-patchelf.patch + +BuildArch: noarch + +BuildRequires: python3-devel + +%if %{with tests} +BuildRequires: gcc +BuildRequires: git-core +%endif + +%global common_description %{expand: +meson-python is a Python build backend built on top of the Meson build system. +It enables to use Meson for the configuration and build steps of Python +packages. Meson is an open source build system meant to be both extremely fast, +and, even more importantly, as user friendly as possible. meson-python is best +suited for building Python packages containing extension modules implemented in +languages such as C, C++, Cython, Fortran, Pythran, or Rust. Consult the +documentation for more details.} + +%description %{common_description} + + +%package -n python3-meson-python +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 %{with patchelf} +BuildRequires: /usr/bin/patchelf +Requires: /usr/bin/patchelf +%endif + +# https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_provides_for_importable_modules +%py_provides python3-mesonpy + +%description -n python3-meson-python %{common_description} + + +%prep +# We need “-S git” because test_reproducible uses “meson dist,” which only +# works in a git or mercurial repo. +%autosetup -n meson_python-%{version} -N -S git +%autopatch -M 99 -p1 +%if %{without patchelf} +%patch 100 -p1 +%endif +# build: used only by skipped PEP 518 test +# pytest-cov: https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_linters +sed -r -i "s/^ '(build|pytest-cov)/#&/" pyproject.toml +%if %{without pytest_mock} +sed -r -i "s/^ '(pytest-mock)/#&/" pyproject.toml +%endif + + +%generate_buildrequires +%pyproject_buildrequires -w %{?with_tests:-x test} + + +%build +%pyproject_wheel + + +%install +%pyproject_install +%pyproject_save_files mesonpy + + +%check +%if %{with tests} +# Note: tests are *not* safe for parallel execution with pytest-xdist. + +# PEP 518 tests require network access. +ignore="${ignore-} --ignore=tests/test_pep518.py" + +%if %{without pytest_mock} +k="${k-}${k+ and }not test_invalid_build_dir" +k="${k-}${k+ and }not test_use_ansi_escapes" +%endif +%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" +k="${k-}${k+ and }not test_get_requires_for_build_wheel" +k="${k-}${k+ and }not test_uneeded_rpath" +%endif + +%pytest ${ignore-} -k "${k-}" + +%else +%pyproject_check_import +%endif + + +%files -n python3-meson-python -f %{pyproject_files} +# LICENSE duplicates LICENSES/MIT.txt. Currently, neither is automatically +# installed into the dist-info metadata directory. +%license LICENSES/* +%doc CHANGELOG.rst +%doc README.rst + + +%changelog +* Tue Nov 05 2024 Joel Capitao - 0.17.1-2 +- Enable patchelf condition + +* Sat Oct 26 2024 Benjamin A. Beasley - 0.17.1-1 +- Update to 0.17.1 (close RHBZ#2321782) + +* Mon Oct 21 2024 Benjamin A. Beasley - 0.17.0-1 +- Update to 0.17.0 (close RHBZ#2320393) + +* Fri Jul 19 2024 Fedora Release Engineering - 0.16.0-10 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild + +* Fri Jun 07 2024 Pavel Simovec - 0.16.0-5 +- Remove patchelf dependency for RHEL + +* Fri Jun 07 2024 Python Maint - 0.16.0-4 +- Rebuilt for Python 3.13 + +* Thu May 09 2024 Benjamin A. Beasley - 0.16.0-3 +- Omit pytest-mock test dependency and associated tests on RHEL + +* Sat Apr 20 2024 Benjamin A. Beasley - 0.16.0-2 +- Patch for pyproject-metadata 0.8.0 + +* Wed Apr 17 2024 Benjamin A. Beasley - 0.16.0-1 +- Update to 0.16.0 (close RHBZ#2275469) + +* Fri Jan 26 2024 Fedora Release Engineering - 0.15.0-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Mon Jan 22 2024 Fedora Release Engineering - 0.15.0-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Fri Dec 01 2023 Yaakov Selkowitz - 0.15.0-2 +- Drop unused python-build dependency + +* Wed Nov 01 2023 Benjamin A. Beasley - 0.15.0-1 +- Update to 0.15.0 (close RHBZ#2246309) + +* Tue Sep 05 2023 Benjamin A. Beasley - 0.14.0-1 +- Update to 0.14.0 (close RHBZ#2237380) + +* Fri Jul 21 2023 Fedora Release Engineering - 0.13.2-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild + +* Fri Jul 07 2023 Benjamin A. Beasley - 0.13.2-2 +- Use new (rpm 4.17.1+) bcond style + +* Wed Jun 28 2023 Benjamin A. Beasley - 0.13.2-1 +- Update to 0.13.2 (close RHBZ#2218115) + +* Thu Jun 15 2023 Python Maint - 0.13.1-4 +- Rebuilt for Python 3.12 + +* Sun Apr 30 2023 Benjamin A. Beasley - 0.13.1-3 +- Depend on the system patchelf +- This avoids generating dependencies on python3dist(patchelf). + +* Sun Apr 30 2023 Benjamin A. Beasley - 0.13.1-2 +- Let the dist-git branches diverge; drop the spec-file conditionals + +* Sun Apr 30 2023 Benjamin A. Beasley - 0.13.1-1 +- Initial package (close RHBZ#2192109)