From e5d1d1a9325458534b1747f71528fb633a3cc82f Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Thu, 11 Feb 2021 07:21:06 +0100 Subject: [PATCH] Add RHEL packaging support --- python-setuptools-rust.spec | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/python-setuptools-rust.spec b/python-setuptools-rust.spec index 498d218..8918e8a 100644 --- a/python-setuptools-rust.spec +++ b/python-setuptools-rust.spec @@ -1,6 +1,6 @@ Name: python-setuptools-rust Version: 0.11.6 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Setuptools Rust extension plugin License: MIT @@ -10,11 +10,16 @@ BuildArch: noarch ExclusiveArch: %{rust_arches} BuildRequires: python3-devel -BuildRequires: python3dist(setuptools) >= 46.1 -BuildRequires: python3dist(setuptools-scm) >= 3.4.3 +BuildRequires: python3dist(setuptools) +BuildRequires: python3dist(semantic-version) >= 2.6 BuildRequires: python3dist(toml) >= 0.9.0 BuildRequires: python3dist(wheel) +%if 0%{?fedora} +BuildRequires: python3dist(setuptools-scm) >= 3.4.3 BuildRequires: rust-packaging +%else +BuildRequires: rust-toolset +%endif %description Setuptools helpers for Rust Python extensions. Compile and distribute Python @@ -22,7 +27,6 @@ extensions written in Rust as easily as if they were written in C. %package -n python3-setuptools-rust Summary: %{summary} -Requires: python3dist(setuptools) >= 46.1 Requires: rust-packaging %description -n python3-setuptools-rust @@ -34,12 +38,30 @@ extensions written in Rust as easily as if they were written in C. # Remove bundled egg-info rm -rf setuptools-rust.egg-info +%if ! 0%{?fedora} +# RHEL doesn't have setuptools-scm +# remove setuptools-scm +rm pyproject.toml +sed -i 's/setup_requires.*//' setup.cfg + +# create version.py without setuptools-scm +cat > setuptools_rust/version.py << EOF +version = '%{VERSION}' +version_tuple = ($(echo %{VERSION} | sed 's/\./, /g')) +EOF +%endif + + %build %py3_build %install %py3_install +%check +PYTHONPATH=%{buildroot}%{python3_sitelib} \ + %{__python3} -c "from setuptools_rust import RustExtension, version" + %files -n python3-setuptools-rust %doc README.md CHANGELOG.md %license LICENSE @@ -47,6 +69,9 @@ rm -rf setuptools-rust.egg-info %{python3_sitelib}/setuptools_rust-%{version}-py%{python3_version}.egg-info/ %changelog +* Thu Feb 11 2021 Christian Heimes - 0.11.6-3 +- Add RHEL packaging support + * Wed Jan 27 2021 Fedora Release Engineering - 0.11.6-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild