%define _trivial .0
%define _buildid .1

## START: Set by rpmautospec
## (rpmautospec version 0.5.1)
## RPMAUTOSPEC: autorelease, autochangelog
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
    release_number = 3;
    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

%bcond_without check

Name:           cargo2rpm
Version:        0.1.15
Release:        %autorelease%{?_trivial}%{?_buildid}
Summary:        Translation layer between cargo and RPM
License:        MIT

URL:            https://pagure.io/fedora-rust/cargo2rpm
Source:         %{url}/archive/%{version}/cargo2rpm-%{version}.tar.gz


# default python is 3.9 on AL2023
Patch1000:      0001-rewrite-with-py3.9-syntax.patch

BuildArch:      noarch

BuildRequires:  python3-devel
BuildRequires:  %{py3_dist pytest}

Requires:       cargo

%description
cargo2rpm implements a translation layer between cargo and RPM. It
provides a CLI interface (for implementing RPM macros and generators)
and a Python API (which rust2rpm is built upon).

%prep
%autosetup -p1

%generate_buildrequires
%pyproject_buildrequires

%build
%pyproject_wheel

%install
%pyproject_install
%pyproject_save_files cargo2rpm

%check
%pyproject_check_import
%if %{with check}
%pytest
%endif

%files -f %{pyproject_files}
%doc README.md
%doc CHANGELOG.md
%{_bindir}/cargo2rpm

%changelog
## START: Generated by rpmautospec
* Tue Jan 23 2024 Fedora Release Engineering <releng@fedoraproject.org> - 0.1.15-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Fri Jan 19 2024 Fedora Release Engineering <releng@fedoraproject.org> - 0.1.15-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Fri Dec 08 2023 Fabio Valentini <decathorpe@gmail.com> - 0.1.15-1
- Update to version 0.1.15; Fixes RHBZ#2253432

* Fri Dec 01 2023 Fabio Valentini <decathorpe@gmail.com> - 0.1.14-1
- Update to version 0.1.14; Fixes RHBZ#2252412

* Thu Nov 02 2023 Fabio Valentini <decathorpe@gmail.com> - 0.1.13-1
- Update to version 0.1.13; Fixes RHBZ#2247679

* Fri Oct 06 2023 Fabio Valentini <decathorpe@gmail.com> - 0.1.12-1
- Update to version 0.1.12; Fixes RHBZ#2242404

* Sun Sep 24 2023 Robert-André Mauchin <zebob.m@gmail.com> - 0.1.9-1
- Update to version 0.1.9; Fixes RHBZ#2240213

* Mon Sep 18 2023 Fabio Valentini <decathorpe@gmail.com> - 0.1.8-1
- Update to version 0.1.8; Fixes RHBZ#2239513

* Mon Jul 31 2023 Fabio Valentini <decathorpe@gmail.com> - 0.1.7-1
- Update to version 0.1.7; Fixes RHBZ#2227751

* Wed Jul 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 0.1.5-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild

* Tue Jun 13 2023 Python Maint <python-maint@redhat.com> - 0.1.5-2
- Rebuilt for Python 3.12

* Tue Jun 13 2023 Fabio Valentini <decathorpe@gmail.com> - 0.1.5-1
- Update to version 0.1.5

* Thu Jun 01 2023 Fabio Valentini <decathorpe@gmail.com> - 0.1.4-2
- Avoid dependency on tox and run tests with pytest directly

* Wed May 17 2023 Fabio Valentini <decathorpe@gmail.com> - 0.1.4-1
- Update to version 0.1.4; Fixes RHBZ#2196881

* Mon Mar 06 2023 Fabio Valentini <decathorpe@gmail.com> - 0.1.3-1
- Update to version 0.1.3; Fixes RHBZ#2175302

* Thu Feb 16 2023 Fabio Valentini <decathorpe@gmail.com> - 0.1.2-1
- Update to version 0.1.2

* Thu Feb 16 2023 Fabio Valentini <decathorpe@gmail.com> - 0.1.1-2
- Update to more modern Python packaging

* Tue Feb 14 2023 Fabio Valentini <decathorpe@gmail.com> - 0.1.1-1
- Update to version 0.1.1

* Mon Feb 13 2023 Fabio Valentini <decathorpe@gmail.com> - 0.1.0-1
- Initial import (#2169233)
## END: Generated by rpmautospec