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

%global common_description %{expand:
Automat is a library for concise, idiomatic Python expression of finite-state
automata (particularly deterministic finite-state transducers).}

Name:           python-%{srcname}
Version:        22.10.0
Release:        %autorelease
Summary:        Self-service finite-state machines for the programmer on the go

License:        MIT
URL:            https://github.com/glyph/automat
Source0:        %pypi_source

BuildArch:      noarch
BuildRequires:  python3-devel
BuildRequires:  python3dist(sphinx-rtd-theme)

%description %{common_description}

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

%description -n python3-%{srcname} %{common_description}

%package -n python-%{srcname}-doc
Summary:        Automat documentation

%description -n python-%{srcname}-doc
Documentation for Automat

%prep
%autosetup  -p1 -n %{srcname}-%{version}

# Backport of https://github.com/glyph/automat/commit/2bf0abddd9b532ef9dd90707a10a09ce48c24f3d
sed -i "s/py\.test/pytest/g" tox.ini

%generate_buildrequires
%pyproject_buildrequires -t

%build
%pyproject_wheel

PYTHONPATH=%{pyproject_build_lib}  sphinx-build docs html
# remove the sphinx-build leftovers
rm -rf html/.{doctrees,buildinfo}

%install
%pyproject_install
%pyproject_save_files %{libname}

%check
%tox

%files -n python3-%{srcname} -f %{pyproject_files}
%{_bindir}/automat-visualize

%files -n python-%{srcname}-doc
%doc html
%license LICENSE

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

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

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

* Wed Dec 28 2022 Robert-André Mauchin <zebob.m@gmail.com> - 22.10.0-1
- Update to 22.10.0

* Fri Dec 09 2022 Lumir Balhar <lbalhar@redhat.com> - 20.2.0-21
- Fix compatibility with pytest 7.2 and tox 4

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

* Sun Jul 03 2022 Robert-André Mauchin <zebob.m@gmail.com> - 20.2.0-19
- Minor fixes

* Sun Jul 03 2022 Robert-André Mauchin <zebob.m@gmail.com> - 20.2.0-18
- Remove check condition

* Sun Jul 03 2022 Robert-André Mauchin <zebob.m@gmail.com> - 20.2.0-17
- Minor fixes

* Tue Jun 21 2022 Robert-André Mauchin <zebob.m@gmail.com> - 20.2.0-16
- Remove deletion of egg.info

* Tue Jun 21 2022 Robert-André Mauchin <zebob.m@gmail.com> - 20.2.0-15
- Add a switch for the tests

* Tue Jun 21 2022 Robert-André Mauchin <zebob.m@gmail.com> - 20.2.0-14
- Convert to new Python guidelines

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

* Mon Jun 13 2022 Python Maint <python-maint@redhat.com> - 20.2.0-12
- Bootstrap for Python 3.11

* Mon Feb 14 2022 Robert-André Mauchin <zebob.m@gmail.com> - 20.2.0-11
- Fix FTBFS with Python 3.11 Close: rhbz#2050073

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

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

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

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

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

* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 20.2.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild

* Sun May 24 2020 Miro Hrončok <mhroncok@redhat.com> - 20.2.0-3
- Rebuilt for Python 3.9

* Sun May 24 2020 Miro Hrončok <mhroncok@redhat.com> - 20.2.0-2
- Bootstrap for Python 3.9

* Wed Feb 19 03:32:18 CET 2020 Robert-André Mauchin <zebob.m@gmail.com> - 20.2.0-1
- Update to 20.2.0

* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.8.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild

* Sat Dec 14 2019 Robert-André Mauchin <zebob.m@gmail.com> - 0.8.0-1
- Update to 0.8.0 (#1763502)

* Sun Oct 13 23:16:43 CEST 2019 Robert-André Mauchin <zebob.m@gmail.com> - 0.7.0-8
- Drop Python 2 support (#1761207)

* Wed Sep 18 2019 Petr Viktorin <pviktori@redhat.com> - 0.7.0-7
- Python 2: Remove tests and test dependencies

* Sat Aug 17 2019 Miro Hrončok <mhroncok@redhat.com> - 0.7.0-6
- Rebuilt for Python 3.8

* Sat Aug 17 2019 Miro Hrončok <mhroncok@redhat.com> - 0.7.0-5
- Bootstrap for Python 3.8

* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.7.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild

* Mon May 27 21:26:47 CEST 2019 Robert-André Mauchin <zebob.m@gmail.com> - 0.7.0-3
- Add patch supporting for positional only arguments for Python 3.8

* Sat Apr 06 2019 Carl George <carl@george.computer> - 0.7.0-2
- Add provides for lowercase name
- Run tests with pytest like upstream does

* Mon Mar 11 2019 Robert-André Mauchin <zebob.m@gmail.com> - 0.7.0-1
- Release 0.7.0 (#1687495)

* Fri Mar 08 2019 Jeroen van Meeuwen <vanmeeuwen+fedora@kolabsys.com> - 0.6.0-5
 - Add bcond_without tests

* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.6.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild

* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.6.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild

* Tue Jun 19 2018 Miro Hrončok <mhroncok@redhat.com> - 0.6.0-2
- Rebuilt for Python 3.7

* Fri Apr 13 2018 Robert-André Mauchin <zebob.m@gmail.com> - 0.6.0-1
- Initial package.