96 lines
2.5 KiB

%global __python3 /usr/bin/python3.11
%global python3_pkgversion 3.11
%if 0%{?rhel}
%bcond_with tests
%bcond_without tests
Name: python%{python3_pkgversion}-setuptools-rust
Version: 1.5.2
Release: 1%{?dist}
Summary: Setuptools Rust extension plugin
License: MIT
Source0: %{pypi_source setuptools-rust}
BuildArch: noarch
ExclusiveArch: %{rust_arches}
BuildRequires: python%{python3_pkgversion}-devel
BuildRequires: python%{python3_pkgversion}-rpm-macros
BuildRequires: python%{python3_pkgversion}-setuptools > 46.1
BuildRequires: python%{python3_pkgversion}-semantic_version >= 2.8.2
BuildRequires: python%{python3_pkgversion}-wheel
Requires: python%{python3_pkgversion}-semantic_version >= 2.8.2
Requires: python%{python3_pkgversion}-setuptools >= 62.4
# RHEL: Dependency is missing
#BuildRequires: python3dist(typing-extensions) >=
%if 0%{?fedora}
BuildRequires: rust-packaging >= 1.45
# RHEL has rust-toolset
BuildRequires: rust-toolset >= 1.45
Requires: rust-toolset >= 1.45
%if %{with tests}
BuildRequires: rust-pyo3+default-devel
Setuptools helpers for Rust Python extensions. Compile and distribute Python
extensions written in Rust as easily as if they were written in C.
%autosetup -n setuptools-rust-%{version}
# Remove bundled egg-info
rm -rf setuptools-rust.egg-info
%if ! 0%{?fedora}
# remove dependency on typing extensions and use
# stdlib instead
sed -i 's/typing_extensions.*$//g' setup.cfg
sed -i -e 's/typing_extensions/typing/' \
setuptools_rust/ \
setuptools_rust/ \
PYTHONPATH=%{buildroot}%{python3_sitelib} \
%{__python3} -c "from setuptools_rust import RustExtension, version"
%if %{with tests}
cd examples/hello-world
PYTHONPATH=%{buildroot}%{python3_sitelib} %{__python3} build
cd ../..
%files -n python%{python3_pkgversion}-setuptools-rust
%license LICENSE
* Thu Nov 03 2022 Charalampos Stratakis <> - 1.5.2-1
- Initial import
- Fedora contributions by:
Christian Heimes <>
Gwyn Ciesla <>
Tomáš Hrnčiar <>