# what it's called on pypi
%global srcname Automat
# what it's imported as
%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).}
%bcond_without check
Name: python-%{srcname}
Version: 20.2.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
# https://github.com/glyph/automat/issues/135
Patch0: 0001-Use-CodeType.replace-in-copycode-for-Python-3.8.patch
BuildArch: noarch
BuildRequires: python3-devel
%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}
# Remove bundled egg-info
rm -rf %{srcname}.egg-info
%generate_buildrequires
%pyproject_buildrequires -t
echo 'python3dist(sphinx-rtd-theme)'
%build
%pyproject_wheel
PYTHONPATH=${PWD} sphinx-build-3 docs html
# remove the sphinx-build leftovers
rm -rf html/.{doctrees,buildinfo}
%install
%pyproject_install
%pyproject_save_files %{libname}
%if %{with check}
%check
%tox
%endif
%files -n python3-%{srcname} -f %{pyproject_files}
%license LICENSE
%doc README.md
%{_bindir}/automat-visualize
%files -n python-%{srcname}-doc
%doc html
%license LICENSE
%changelog
%autochangelog