## START: Set by rpmautospec
## (rpmautospec version 0.7.3)
## RPMAUTOSPEC: autorelease, autochangelog
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
    release_number = 1;
    base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}"));
    print(release_number + base_release_number - 1);
}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}}
## END: Set by rpmautospec

%global srcname rpds-py
%global modname rpds_py

Name:           python-rpds-py
Version:        0.22.3
Release:        %autorelease
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}}

# The 'generate-import-lib' extension is only useful on MS Win
Patch:          do_not_require_win_only_pyo3_extension.patch

BuildRequires:  cargo-rpm-macros
BuildRequires:  dos2unix
BuildRequires:  python3-devel

%global _description %{expand:
Python bindings to the Rust rpds crate.}

%description %_description

%package -n python3-%{srcname}
Summary:        %{summary}

%description -n python3-%{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
# Remove test dependency not available and unused in Fedora
sed -i -e /pytest-run-parallel/d tests/requirements.in

%cargo_prep


%generate_buildrequires
%pyproject_buildrequires tests/requirements.in
%cargo_generate_buildrequires


%build
export RUSTFLAGS='%{build_rustflags}'
%cargo_license_summary
%{cargo_license} > LICENSES.dependencies
%pyproject_wheel


%install
%pyproject_install

%pyproject_save_files rpds


%check
%pytest -vv


%files -n python3-%{srcname} -f %{pyproject_files}
%license LICENSE LICENSES.dependencies
%doc README.rst


%changelog
## START: Generated by rpmautospec
* Sat Dec 14 2024 Mattia Verga <mattia.verga@proton.me> - 0.22.3-1
- Update to 0.22.3 (fedora#2330028)

* Sun Nov 10 2024 Mattia Verga <mattia.verga@proton.me> - 0.21.0-1
- Update to 0.21.0 (fedora#2322955)

* Wed Oct 16 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 0.20.0-3
- Revert "Fix automatic provides on Python extension due to SONAME"
- The fix is in rust-1.81.0-4 and later, which is now in all stable
  branches, so this workaround is no longer necessary.

* Fri Sep 27 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 0.20.0-2
- Fix automatic provides on Python extension due to SONAME

* Sat Aug 24 2024 Mattia Verga <mattia.verga@proton.me> - 0.20.0-1
- Update to 0.20.0 (Fedora#2303236)

* Sun Jul 28 2024 Mattia Verga <mattia.verga@proton.me> - 0.19.1-1
- Update to 0.19.1 (fedora#2296303)

* Fri Jul 19 2024 Fedora Release Engineering <releng@fedoraproject.org> - 0.18.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild

* Fri Jun 07 2024 Python Maint <python-maint@redhat.com> - 0.18.1-2
- Rebuilt for Python 3.13

* Sun May 26 2024 Mattia Verga <mattia.verga@proton.me> - 0.18.1-1
- Update to 0.18.1 (fedora#2279310)

* Sun Feb 18 2024 Mattia Verga <mattia.verga@proton.me> - 0.18.0-1
- Update to 0.18.0 (fedora#2264109)

* Sat Jan 27 2024 Mattia Verga <mattia.verga@proton.me> - 0.17.1-1
- Update to 0.17.1 (fedora#2258128)

* Fri Jan 26 2024 Fedora Release Engineering <releng@fedoraproject.org> - 0.16.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Mon Jan 22 2024 Fedora Release Engineering <releng@fedoraproject.org> - 0.16.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Fri Dec 29 2023 Mattia Verga <mattia.verga@proton.me> - 0.16.2-1
- Update to 0.16.2 (fedora#2254849)

* Sun Dec 10 2023 Mattia Verga <mattia.verga@proton.me> - 0.13.2-1
- Update to 0.13.2 (fedora#2252155)

* Sun Nov 26 2023 Mattia Verga <mattia.verga@proton.me> - 0.13.1-1
- Update to 0.13.1

* Tue Nov 14 2023 Mattia Verga <mattia.verga@proton.me> - 0.12.0-1
- Update to 0.12 (fedora#2247859)

* Thu Oct 12 2023 Mattia Verga <mattia.verga@proton.me> - 0.10.6-1
- Update to 0.10.6 (fedora#2242307)

* Wed Sep 13 2023 Miro Hrončok <miro@hroncok.cz> - 0.9.2-4
- Remove an unused test dependency on hypothesis

* Thu Sep 07 2023 Mattia Verga <mattia.verga@proton.me> - 0.9.2-3
- Enable build on i686

* Fri Aug 25 2023 Mattia Verga <mattia.verga@proton.me> - 0.9.2-2
- Patch to fix dependencies on archery and rpds crates

* Thu Jul 20 2023 Mattia Verga <mattia.verga@proton.me> - 0.9.2-1
- Initial import (fedora#2222367)
## END: Generated by rpmautospec