From 1de9edd84a4d074378dc59b9db6d62317eb5d507 Mon Sep 17 00:00:00 2001 From: Charalampos Stratakis Date: Fri, 2 Dec 2022 18:21:11 +0100 Subject: [PATCH] RHEL: Import from Fedora Resolves: rhbz#2157725 --- .gitignore | 1 + python-setuptools-rust.spec | 95 +++++++++++++++++++++++++++++++++++++ sources | 1 + 3 files changed, 97 insertions(+) create mode 100644 python-setuptools-rust.spec create mode 100644 sources diff --git a/.gitignore b/.gitignore index e69de29..6d2325f 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/setuptools-rust-1.5.2.tar.gz diff --git a/python-setuptools-rust.spec b/python-setuptools-rust.spec new file mode 100644 index 0000000..407f792 --- /dev/null +++ b/python-setuptools-rust.spec @@ -0,0 +1,95 @@ +%if 0%{?rhel} +%bcond_with tests +%else +%bcond_without tests +%endif + +Name: python-setuptools-rust +Version: 1.5.2 +Release: 1%{?dist} +Summary: Setuptools Rust extension plugin + +License: MIT +URL: https://github.com/PyO3/setuptools-rust +Source0: %{pypi_source setuptools-rust} +BuildArch: noarch +ExclusiveArch: %{rust_arches} + +BuildRequires: python3-devel +BuildRequires: python3dist(setuptools) > 46.1 +BuildRequires: python3dist(semantic-version) >= 2.8.2 +BuildRequires: python3dist(typing-extensions) >= 3.7.4.4 +%if 0%{?fedora} +BuildRequires: python3dist(setuptools-scm) >= 3.4.3 +BuildRequires: python3dist(wheel) +BuildRequires: rust-packaging >= 1.45 +%else +# RHEL has rust-toolset and neither setuptools-scm nor wheel +BuildRequires: rust-toolset >= 1.45 +%endif +%if %{with tests} +BuildRequires: rust-pyo3+default-devel +%endif + +%description +Setuptools helpers for Rust Python extensions. Compile and distribute Python +extensions written in Rust as easily as if they were written in C. + +%package -n python3-setuptools-rust +Summary: %{summary} +%if 0%{?fedora} +Requires: rust-packaging >= 1.45 +%else +Requires: rust-toolset >= 1.45 +%endif + +%description -n python3-setuptools-rust +Setuptools helpers for Rust Python extensions. Compile and distribute Python +extensions written in Rust as easily as if they were written in C. + +%prep +%autosetup -n setuptools-rust-%{version} +# 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" + +%if %{with tests} +cd examples/hello-world +%cargo_prep +PYTHONPATH=%{buildroot}%{python3_sitelib} %{__python3} setup.py build +cd ../.. +%endif + + +%files -n python3-setuptools-rust +%doc README.md CHANGELOG.md +%license LICENSE +%{python3_sitelib}/setuptools_rust/ +%{python3_sitelib}/setuptools_rust-%{version}-py%{python3_version}.egg-info/ + +%changelog +* Fri Dec 02 2022 Charalampos Stratakis - 1.5.2-1 +- Import from Fedora diff --git a/sources b/sources new file mode 100644 index 0000000..fa9b337 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (setuptools-rust-1.5.2.tar.gz) = 79b1de5581b9558cdf227320c421aa2445b2e6b8583ed9c118ee8d7acdfde9d947e7d11fa6a9697c475d4ca387c86ca6846429099ec30d2eb6e40f8849fcecc0