%global srcname rpds-py %global modname rpds_py %global python3_pkgversion 3.11 Name: python-rpds-py Version: 0.18.0 Release: 2.ac8.py3.11%{?dist} Summary: Python bindings to the Rust rpds crate # Full license breakdown in LICENSES.dependencies License: MIT AND Apache-2.0 AND (MIT OR Apache-2.0) AND MPL-2.0 URL: https://github.com/crate-py/rpds Source: %{pypi_source %{modname}} BuildRequires: cargo-rpm-macros BuildRequires: dos2unix BuildRequires: rust-pyo3-devel BuildRequires: python%{python3_pkgversion}-devel %global _description %{expand: Python bindings to the Rust rpds crate.} %description %_description %package -n python%{python3_pkgversion}-%{srcname} Summary: %{summary} %description -n python%{python3_pkgversion}-%{srcname} %_description %prep %autosetup -p1 -n %{modname}-%{version} # Fix line terminations dos2unix README* LICENSE* *.pyi # Fix for bad requirements dependency sed -r -i 's/^file:/# &/' tests/requirements.in %cargo_prep %generate_buildrequires %pyproject_buildrequires tests/requirements.in %cargo_generate_buildrequires %build export RUSTFLAGS='%{build_rustflags}' %{shrink: %{__cargo} tree --workspace --offline --edges no-build,no-dev,no-proc-macro --no-dedupe --target all %{__cargo_parse_opts %{-n} %{-a} %{-f:-f%{-f*}}} --prefix none --format "# {l}" | sed -e "s: / :/:g" -e "s:/: OR :g" | sort -u} %{shrink: %{__cargo} tree --workspace --offline --edges no-build,no-dev,no-proc-macro --no-dedupe --target all %{__cargo_parse_opts %{-n} %{-a} %{-f:-f%{-f*}}} --prefix none --format "{l}: {p}" | sed -e "s: ($(pwd)[^)]*)::g" -e "s: / :/:g" -e "s:/: OR :g" | sort -u} > LICENSES.dependencies %pyproject_wheel %install %pyproject_install %pyproject_save_files rpds %check for m in $(find %{buildroot}%{_datadir}/locale/* -type f) ; do mv "$m" $(sed -re "s/(.*).mo$/\1%{python3_pkgversion}.mo/"<<<"$m"); done for m in $(find %{buildroot}%{_mandir}/ -type f) ; do mv "$m" $(sed -re "s/(.*).([1-8]([^.]+)?)$/\1%{python3_pkgversion}.\2/"<<<"$m"); done for b in $(find %{buildroot}%{_bindir}/ -type f) ; do mv "$b" $(sed -re "s/(.*)$/\1%{python3_pkgversion}/"<<<"$b"); done %pytest -vv %files -n python%{python3_pkgversion}-%{srcname} -f %{pyproject_files} %license LICENSE LICENSES.dependencies %doc README.rst %changelog * Mon Apr 08 2024 Ding-Yi Chen - 0.18.0-2.ac8.py3.11 - Cut corner packaging