import CS python-setuptools-rust-0.12.1-6.el9

This commit is contained in:
eabdullin 2025-03-11 08:02:11 +00:00
parent fec4460b6e
commit 6882799f67
10 changed files with 256 additions and 188 deletions

12
.gitignore vendored
View File

@ -1,11 +1 @@
/*-pyproject-*
/setuptools-rust-0.11.6.tar.gz
/setuptools-rust-0.12.0.tar.gz
/setuptools-rust-0.12.1.tar.gz
/setuptools-rust-1.0.0.tar.gz
/setuptools-rust-1.1.2.tar.gz
/setuptools-rust-1.2.0.tar.gz
/setuptools-rust-1.5.2.tar.gz
/setuptools-rust-1.6.0.tar.gz
/setuptools-rust-1.7.0.tar.gz
/setuptools_rust-1.10.2.tar.gz
SOURCES/setuptools-rust-0.12.1.tar.gz

View File

@ -0,0 +1 @@
8068add8a5ccbd5deeed81f5ef412ef6ca8e443f SOURCES/setuptools-rust-0.12.1.tar.gz

View File

@ -1,3 +0,0 @@
# python-setuptools-rust
The python-setuptools-rust package

View File

@ -0,0 +1,120 @@
From 78965633be625fba3fee6fbbf3b24e22d9d349cc Mon Sep 17 00:00:00 2001
From: Christian Heimes <christian@python.org>
Date: Mon, 26 Jul 2021 12:29:12 +0200
Subject: [PATCH] Replace semantic_version with packaging
Use the "packaging" package instead of semantic_version package to parse
Rust version and spec. Packaging is used by setuptools to parse version
strings and specs.
This also solves a deprecation warning with semamtic_version. The
partial argument to Version() has been deprecated.
Signed-off-by: Christian Heimes <christian@python.org>
---
setup.cfg | 2 +-
setuptools_rust/check.py | 4 ++--
setuptools_rust/extension.py | 4 ++--
setuptools_rust/test.py | 4 ++--
setuptools_rust/utils.py | 4 ++--
5 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/setup.cfg b/setup.cfg
index 5b6ddf0..19b2b84 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -26,7 +26,7 @@ classifiers =
[options]
packages = setuptools_rust
zip_safe = True
-install_requires = setuptools>=46.1; semantic_version>=2.6.0; toml>=0.9.0
+install_requires = setuptools>=46.1; packaging; toml>=0.9.0
setup_requires = setuptools>=46.1; setuptools_scm[toml]>=3.4.3
python_requires = >=3.6
diff --git a/setuptools_rust/check.py b/setuptools_rust/check.py
index 4fe1d83..62e666b 100644
--- a/setuptools_rust/check.py
+++ b/setuptools_rust/check.py
@@ -7,13 +7,13 @@ from distutils.errors import (
DistutilsExecError,
)
-import semantic_version
+from packaging.specifiers import SpecifierSet
from .command import RustCommand
from .extension import RustExtension
from .utils import rust_features
-MIN_VERSION = semantic_version.Spec(">=1.16")
+MIN_VERSION = SpecifierSet(">=1.16")
class check_rust(RustCommand):
diff --git a/setuptools_rust/extension.py b/setuptools_rust/extension.py
index f8e7205..cc445cb 100644
--- a/setuptools_rust/extension.py
+++ b/setuptools_rust/extension.py
@@ -4,7 +4,7 @@ from distutils.errors import DistutilsSetupError
from enum import IntEnum, auto
from typing import Dict, List, Optional, Union
-import semantic_version
+from packaging.specifiers import SpecifierSet
class Binding(IntEnum):
@@ -149,7 +149,7 @@ class RustExtension:
if self.rust_version is None:
return None
try:
- return semantic_version.SimpleSpec.parse(self.rust_version)
+ return SpecifierSet(self.rust_version)
except ValueError:
raise DistutilsSetupError(
"Can not parse rust compiler version: %s", self.rust_version
diff --git a/setuptools_rust/test.py b/setuptools_rust/test.py
index 93beba1..1f5ce9a 100644
--- a/setuptools_rust/test.py
+++ b/setuptools_rust/test.py
@@ -4,12 +4,12 @@ import subprocess
from distutils.cmd import Command
from distutils.errors import CompileError, DistutilsFileError, DistutilsExecError
-import semantic_version
+from packaging.specifiers import SpecifierSet
from .extension import RustExtension
from .utils import rust_features, get_rust_version
-MIN_VERSION = semantic_version.Spec(">=1.15")
+MIN_VERSION = SpecifierSet(">=1.15")
class test_rust(Command):
diff --git a/setuptools_rust/utils.py b/setuptools_rust/utils.py
index 4b0220d..0564f26 100644
--- a/setuptools_rust/utils.py
+++ b/setuptools_rust/utils.py
@@ -2,7 +2,7 @@ import sys
import subprocess
from distutils.errors import DistutilsPlatformError
-import semantic_version
+from packaging.version import Version
from .extension import Binding
@@ -35,7 +35,7 @@ def rust_features(ext=True, binding=Binding.PyO3):
def get_rust_version(min_version=None):
try:
output = subprocess.check_output(["rustc", "-V"]).decode("latin-1")
- return semantic_version.Version(output.split(" ")[1], partial=True)
+ return Version(output.split(" ")[1])
except (subprocess.CalledProcessError, OSError):
raise DistutilsPlatformError(
"can't find Rust compiler\n\n"
--
2.31.1

View File

@ -0,0 +1,134 @@
%if 0%{?rhel}
%bcond_with tests
%else
%bcond_without tests
%endif
Name: python-setuptools-rust
Version: 0.12.1
Release: 6%{?dist}
Summary: Setuptools Rust extension plugin
License: MIT
URL: https://github.com/PyO3/setuptools-rust
Source0: %{pypi_source setuptools-rust}
Patch0001: 0001-Replace-semantic_version-with-packaging.patch
BuildArch: noarch
ExclusiveArch: %{rust_arches}
BuildRequires: python3-devel
BuildRequires: python3dist(setuptools)
BuildRequires: python3dist(packaging)
BuildRequires: python3dist(toml) >= 0.9.0
%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 -p1 -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/tomlgen
%cargo_prep
sed -i 's/"0\.[0-9.]*"/"^0"/g' setup.cfg
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 Feb 14 2025 Francisco Triviño <ftrivino@redhat.com> - 0.12.1-6
- Rebuilt needed to trigger signing of the package
- Resolves: RHEL-70463 python3-setuptools-rust is not signed
* Fri Jan 3 2025 Francisco Triviño <ftrivino@redhat.com> - 0.12.1-5
- Rebuilt needed for moving buildroot package to CRB
- Resolves: RHEL-70463 python3-setuptools-rust is not signed
- Resolves: RHEL-67341 move python3-setuptools-rust to CRB [rhel-9]
* Tue Aug 10 2021 Mohan Boddu <mboddu@redhat.com> - 0.12.1-4
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688
* Mon Jul 26 2021 Christian Heimes <cheimes@redhat.com> - 0.12.1-3
- Replace semantic_version with packaging
- Resolves: rhbz#1980994
* Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com> - 0.12.1-2
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
* Thu Mar 11 2021 Christian Heimes <cheimes@redhat.com> - 0.12.1-1
- Update to 0.12.1
* Tue Mar 09 2021 Christian Heimes <cheimes@redhat.com> - 0.12.0-1
- Update to 0.12.0 (#1936679)
- Run tomlgen example as test case
* Thu Feb 11 2021 Christian Heimes <cheimes@redhat.com> - 0.11.6-4
- Fix RHEL build: remove wheel build requirements, use rust-toolset
* Thu Feb 11 2021 Christian Heimes <cheimes@redhat.com> - 0.11.6-3
- Add RHEL packaging support
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.11.6-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Thu Jan 14 2021 Christian Heimes <cheimes@redhat.com> - 0.11.6-1
- Initial package.
- Resolves: rhbz#1906490

View File

@ -1,25 +0,0 @@
* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.12.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
* Wed Jun 02 2021 Python Maint <python-maint@redhat.com> - 0.12.1-2
- Rebuilt for Python 3.10
* Thu Mar 11 2021 Christian Heimes <cheimes@redhat.com> - 0.12.1-1
- Update to 0.12.1
* Tue Mar 09 2021 Christian Heimes <cheimes@redhat.com> - 0.12.0-1
- Update to 0.12.0 (#1936679)
- Run tomlgen example as test case
* Thu Feb 11 2021 Christian Heimes <cheimes@redhat.com> - 0.11.6-4
- Fix RHEL build: remove wheel build requirements, use rust-toolset
* Thu Feb 11 2021 Christian Heimes <cheimes@redhat.com> - 0.11.6-3
- Add RHEL packaging support
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.11.6-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Thu Jan 14 2021 Christian Heimes <cheimes@redhat.com> - 0.11.6-1
- Initial package.
- Resolves: rhbz#1906490

View File

@ -1,8 +0,0 @@
# recipients: abokovoy, frenaud, kaleem, ftrivino, cheimes
--- !Policy
product_versions:
- rhel-10
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional}

View File

@ -1,119 +0,0 @@
# RHEL does not have packaged rust libraries
%bcond packaged_rust_libraries %{undefined rhel}
# The integration tests depend on the presence of these libraries
%bcond integration_tests %{with packaged_rust_libraries}
# Regex of integration tests to skip.
# * html-py-ever requires unpackaged rust crates
%global integration_tests_exc '^(html-py-ever)'
Name: python-setuptools-rust
Version: 1.10.2
Release: %autorelease
Summary: Setuptools Rust extension plugin
License: MIT
URL: https://github.com/PyO3/setuptools-rust
Source0: %{pypi_source setuptools_rust}
BuildArch: noarch
BuildRequires: python3-devel
BuildRequires: %{py3_dist pytest}
%if 0%{?fedora}
BuildRequires: rust-packaging
%else
# RHEL has rust-toolset instead of rust-packaging
BuildRequires: rust-toolset >= 1.45
%endif
%if %{with integration_tests}
BuildRequires: %{py3_dist cffi}
%endif
%global _description %{expand:
Setuptools helpers for Rust Python extensions. Compile and distribute Python
extensions written in Rust as easily as if they were written in C.}
%description %{_description}
%package -n python3-setuptools-rust
Summary: %{summary}
Requires: cargo
%description -n python3-setuptools-rust %{_description}
%prep
%cargo_prep
%autosetup -p1 -n setuptools_rust-%{version}
%if %{with integration_tests}
for example in $(ls examples/ | grep -vE %{integration_tests_exc}); do
cd "examples/${example}"
%cargo_prep
cd -
done
%endif
%generate_buildrequires
%pyproject_buildrequires
%if %{with integration_tests}
for example in $(ls examples/ | grep -vE %{integration_tests_exc}); do
cd "examples/${example}"
%cargo_generate_buildrequires
cd - >&2
done
%endif
%build
%pyproject_wheel
%install
%pyproject_install
%pyproject_save_files -l setuptools_rust
%check
%pyproject_check_import
# Disable tests that require internet access and/or test Windows functionality
%global test_ignores %{shrink:
not test_adjusted_local_rust_target_windows_msvc
and not test_get_lib_name_namespace_package
}
%if %{without packaged_rust_libraries}
%global test_ignores %{shrink:%{test_ignores}
and not test_metadata_contents
and not test_metadata_cargo_log
}
%endif
%pytest tests/ setuptools_rust/ --import-mode importlib -k '%{test_ignores}'
%if %{with integration_tests}
export %{py3_test_envvars}
%global _pyproject_wheeldir dist
for example in $(ls examples/ | grep -vE %{integration_tests_exc}); do
cd "examples/${example}"
%pyproject_wheel
if [ -d "tests/" ]; then
%{python3} -m venv venv --system-site-packages
./venv/bin/pip install dist/*.whl
./venv/bin/python -Pm pytest tests/
fi
cd -
done
%endif
%files -n python3-setuptools-rust -f %{pyproject_files}
%doc README.md CHANGELOG.md
%changelog
%autochangelog

View File

@ -1 +0,0 @@
SHA512 (setuptools_rust-1.10.2.tar.gz) = 4a97ece7d42856532c9517ec1cc5ad7d8f765b8b4157ffcf458688478db7b3d1b4aa10898ebedd2251e3d29d80e81b45ad93128ae72bc270794f77c006ece324

View File

@ -1,21 +0,0 @@
---
#
# 1minutetip --buildroot rhel10
#
- hosts: localhost
tags:
- classic
roles:
- role: standard-test-source
required_packages:
- rust-toolset
- role: standard-test-basic
required_packages:
- python3-setuptools-rust
tests:
# build rust_with_cffi example (requires downloads from crates.io)
- example-rust-with-cffi:
dir: "source/examples/rust_with_cffi"
run: mkdir .cargo && cargo vendor > .cargo/config.toml && python3 setup.py build