## START: Set by rpmautospec
## (rpmautospec version 0.3.5)
## 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 pypi_name pyhaversion
%global pkg_name haversion

Name:           python-%{pkg_name}
Version:        23.1.0
Release:        %autorelease
Summary:        Python module to get the version number of Home Assistant

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

%description
A Python module to get the version number of Home Assistant.

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

BuildRequires:  python3-devel
BuildRequires:  python3dist(aiohttp)
BuildRequires:  python3dist(async-timeout)
BuildRequires:  python3dist(awesomeversion)
BuildRequires:  python3dist(pytest)
BuildRequires:  python3dist(pytest-runner)
BuildRequires:  python3dist(semantic-version)
BuildRequires:  python3dist(setuptools)
BuildRequires:  python3dist(aresponses)
%{?python_provide:%python_provide python3-%{pypi_name}}

%description -n python3-%{pkg_name}
A Python module to get the version number of Home Assistant.

%prep
%autosetup -n %{pypi_name}-%{version}
rm -rf %{pypi_name}.egg-info
sed -i -e 's/main/%{version}/g' setup.py

%build
%py3_build

%install
%py3_install

%check
%pytest -v tests -k "not test_stable_version and not test_etag" 

%files -n python3-%{pkg_name}
%doc README.md
%license LICENSE
%{python3_sitelib}/%{pypi_name}/
%{python3_sitelib}/%{pypi_name}-*-py%{python3_version}.egg-info/

%changelog
* Sun Feb 19 2023 Fabian Affolter <mail@fabian-affolter.ch> - 23.1.0-1
- Upgrade to latest upstream release 23.1.0 (closes rhbz#2165235)

* Tue Jan 24 2023 Miro Hrončok <miro@hroncok.cz> - 22.8.0-3
- Upstream has switched from master to main, adjust the sed in %%prep
- This makes the package provide python3dist(pyhaversion) = 22.8 instead of
  python3dist(pyhaversion) = main
- This makes the package build with packaging 22+

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

* Wed Sep 14 2022 Fabian Affolter <mail@fabian-affolter.ch> - 22.8.0-1
- Update to latest upstream release 22.8.0 (closes rhbz#2072726) Fix FTBFS
  (closes rhbz#2098967)

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

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

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

* Wed Feb 23 2022 Fabian Affolter <mail@fabian-affolter.ch> - 22.02.0-1
- Update to latest upstream release 22.02.2 (closes rhbz#2057470)

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

* Sun Nov 07 2021 Fabian Affolter <mail@fabian-affolter.ch> - 21.11.1-1
- Update to latest upstream release 21.11.1 (closes rhbz#2020587)

* Fri Nov 05 2021 Fabian Affolter <mail@fabian-affolter.ch> - 21.11.0-1
- Update to latest upstream release 21.11.0 (closes rhbz#2020545)

* Wed Oct 13 2021 Fabian Affolter <mail@fabian-affolter.ch> - 21.10.1-1
- Update to latest upstream release 21.10.1 (closes rhbz#2012464)

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

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

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

* Tue Feb 02 2021 Fabian Affolter <mail@fabian-affolter.ch> - 20.12.1-5
- Fix upstream versioning issue

* Tue Feb 02 2021 Fabian Affolter <mail@fabian-affolter.ch> - 20.12.1-4
- Update %%files section

* Tue Feb 02 2021 Fabian Affolter <mail@fabian-affolter.ch> - 20.12.1-3
- Update BR

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

* Fri Jan 08 2021 Fabian Affolter <mail@fabian-affolter.ch> - 20.12.1-1
- * Fri Jan 01 2021 Fabian Affolter <mail@fabian-affolter.ch> - 20.12.1 -
  UPdate to latest upstream release 20.12.1

* Sat Sep 12 2020 Fabian Affolter <mail@fabian-affolter.ch> - 3.3.0-1
- * Thu Sep 03 2020 Fabian Affolter <mail@fabian-affolter.ch> - 3.3.0-1 -
  Initial package for Fedora