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

Name:           python-%{pypi_name}
Version:        24.2.0
Release:        %autorelease
Summary:        Python module to deal with versions

License:        MIT
URL:            https://github.com/ludeeus/awesomeversion
Source0:        %{url}/archive/%{version}/%{pypi_name}-%{version}.tar.gz
BuildArch:      noarch

BuildRequires:  python3-devel
BuildRequires:  python3-pytest
BuildRequires:  python3dist(pytest-snapshot)

%description
Python module to deal with versions if it comes to comparing them. Make
anything a version object, and compare against a vast section of other
version formats.

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

%description -n python3-%{pypi_name}
Python module to deal with versions if it comes to comparing them. Make
anything a version object, and compare against a vast section of other
version formats.

%prep
%autosetup -n %{pypi_name}-%{version}
# Only the PyPI source set the version properly
sed -i -e 's/version = "0"/version = "%{version}"/g' pyproject.toml
%generate_buildrequires
%pyproject_buildrequires

%build
%pyproject_wheel

%install
%pyproject_install
%pyproject_save_files %{pypi_name}
rm %{buildroot}/%{python3_sitelib}/LICENCE.md

%check
%pytest -v tests

%files -n python3-%{pypi_name} -f %{pyproject_files}
%doc README.md
%license LICENCE.md

%changelog
* Fri Mar 1 2024 Brian J. Murrell <brian@interlinx.bc.ca> - 23.4.2-0.01
- Update to 24.2

* Sun Feb 4 2024 Brian J. Murrell <brian@interlinx.bc.ca> - 23.11.0-0.01
- Update to 23.11
- Add BR: python3dist(pytest-snapshot)

* Fri Jul 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 22.9.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild

* Thu Jun 15 2023 Python Maint <python-maint@redhat.com> - 22.9.0-3
- Rebuilt for Python 3.12

* Fri Jan 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 22.9.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild

* Sun Sep 18 2022 Fabian Affolter <mail@fabian-affolter.ch> - 22.9.0-1
- Update to latest upstream release 22.9.0 (closes rhbz#2127107)

* Thu Sep 15 2022 Fabian Affolter <mail@fabian-affolter.ch> - 22.8.0-1
- Update to latest upstream release 22.8.0 (closes rhbz#2079374)

* Fri Jul 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 22.4.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild

* Tue Jun 14 2022 Python Maint <python-maint@redhat.com> - 22.4.0-3
- Rebuilt for Python 3.11

* Wed Apr 06 2022 Fabian Affolter <mail@fabian-affolter.ch> - 22.4.0-2
- Add new source

* Wed Apr 06 2022 Fabian Affolter <mail@fabian-affolter.ch> - 22.4.0-1
- Update to latest upstream release 22.4.0 (closes rhbz#2071355)

* Fri Mar 04 2022 Fabian Affolter <mail@fabian-affolter.ch> - 22.2.0-1
- Update to latest upstream release 22.2.0 (closes rhbz#2016610)

* Fri Jan 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 21.8.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild

* Thu Aug 26 2021 Fabian Affolter <mail@fabian-affolter.ch> - 21.8.1-1
- * Thu Aug 26 2021 Fabian Affolter <mail@fabian-affolter.ch> - 21.8.1-1 -
  Update to latest upstream release 21.8.1 (rhbz#1946105)

* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 21.2.3-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild

* Fri Jun 04 2021 Python Maint <python-maint@redhat.com> - 21.2.3-2
- Rebuilt for Python 3.10

* Wed Feb 24 2021 Fabian Affolter <mail@fabian-affolter.ch> - 21.2.3-1
- * Wed Feb 24 2021 Fabian Affolter <mail@fabian-affolter.ch> - 21.2.3-1 -
  Update to latest upstream release 21.2.3 (#1932296)

* Fri Feb 05 2021 Fabian Affolter <mail@fabian-affolter.ch> - 21.2.2-1
- * Fri Feb 05 2021 Fabian Affolter <mail@fabian-affolter.ch> - 21.2.2-1 -
  Update to latest upstream release 21.2.2

* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 21.1.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild

* Sun Jan 24 2021 Fabian Affolter <mail@fabian-affolter.ch> - 21.1.3-1
- * Thu Jan 21 2021 Fabian Affolter <mail@fabian-affolter.ch> - 21.1.3-1 -
  Remove BR and obsolete macro - Update to latest upstream release 21.1.3
  (#1914195)