# what it's called on pypi
%global srcname Automat
# what it's imported as
%global libname automat
# name of egg info directory
%global eggname %{srcname}
# package name fragment
%global pkgname %{srcname}
%global common_description %{expand:
Automat is a library for concise, idiomatic Python expression of finite-state
automata (particularly deterministic finite-state transducers).}
%bcond_without tests
Name: python-%{pkgname}
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
%description %{common_description}
%package -n python3-%{pkgname}
Summary: %{summary}
Provides: python3-%{libname}
BuildRequires: python3-devel
BuildRequires: python3dist(m2r)
BuildRequires: python3dist(setuptools)
BuildRequires: python3dist(setuptools-scm)
BuildRequires: python3dist(sphinx)
BuildRequires: python3dist(sphinx-rtd-theme)
%if %{with tests}
BuildRequires: python3dist(pytest)
BuildRequires: python3dist(attrs) >= 16.1
BuildRequires: python3dist(graphviz) > 0.5.1
BuildRequires: python3dist(six)
BuildRequires: python3dist(twisted) >= 16.1.1
%endif
%description -n python3-%{pkgname} %{common_description}
%package -n python-%{pkgname}-doc
Summary: Automat documentation
%description -n python-%{pkgname}-doc
Documentation for Automat
%prep
%autosetup -p1 -n %{srcname}-%{version}
# Remove bundled egg-info
rm -rf %{eggname}.egg-info
%build
%py3_build
# generate html docs
PYTHONPATH=${PWD} sphinx-build-3 docs html
# remove the sphinx-build leftovers
rm -rf html/.{doctrees,buildinfo}
%install
%py3_install
%check
%if %{with tests}
PYTHONPATH=%{buildroot}%{python3_sitelib} pytest-%{python3_version} --verbose automat/_test
%endif
%files -n python3-%{pkgname}
%license LICENSE
%doc README.md
%{_bindir}/automat-visualize
%{python3_sitelib}/%{libname}
%{python3_sitelib}/%{eggname}-%{version}-py%{python3_version}.egg-info
%files -n python-%{pkgname}-doc
%doc html
%license LICENSE
%changelog
%autochangelog