Blob Blame History Raw
# 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
Source0:        %pypi_source
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

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

%package -n python-%{pkgname}-doc
Summary:        Automat documentation
%description -n python-%{pkgname}-doc
Documentation for Automat

%autosetup  -p1 -n %{srcname}-%{version}
# Remove bundled egg-info
rm -rf %{eggname}.egg-info

# generate html docs
PYTHONPATH=${PWD} sphinx-build-3 docs html
# remove the sphinx-build leftovers
rm -rf html/.{doctrees,buildinfo}


%if %{with tests}
PYTHONPATH=%{buildroot}%{python3_sitelib} pytest-%{python3_version} --verbose automat/_test

%files -n python3-%{pkgname}
%license LICENSE

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