python-setuptools-rust/python-setuptools-rust.spec
Christian Heimes 568e1bc37e Update to 1.7.0, fixes rhbz#2233656
- modernize packaging, upstream has remove setup.py
- remove setup.cfg hacks for RHEL
2023-08-23 07:28:29 +02:00

82 lines
1.9 KiB
RPMSpec

%if 0%{?rhel}
%bcond_with tests
%else
%bcond_without tests
%endif
Name: python-setuptools-rust
Version: 1.7.0
Release: %autorelease
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
%if 0%{?fedora}
BuildRequires: rust-packaging
%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
%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, releases come with version.py
sed 's/"setuptools_scm"//' pyproject.toml
%endif
%generate_buildrequires
%pyproject_buildrequires
%build
%pyproject_wheel
%install
%pyproject_install
%pyproject_save_files setuptools_rust
%check
PYTHONPATH=%{buildroot}%{python3_sitelib} \
%{__python3} -c "from setuptools_rust import RustExtension, version"
%if %{with tests}
cd examples/hello-world-setuppy
%cargo_prep
PYTHONPATH=%{buildroot}%{python3_sitelib} %{__python3} setup.py build
cd ../..
%endif
%files -n python3-setuptools-rust -f %{pyproject_files}
%doc README.md CHANGELOG.md
%license LICENSE
%changelog
%autochangelog