Blob Blame 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
%bcond_without  python2

Name:           python-%{pkgname}
Version:        0.7.0
Release:        2%{?dist}
Summary:        Self-service finite-state machines for the programmer on the go

License:        MIT
Source0:        %pypi_source
BuildArch:      noarch


%description %{common_description}

%if %{with python2}
%package -n     python2-%{pkgname}
Summary:        %{summary}
Provides:       python2-%{libname}
%{?python_provide:%python_provide python2-%{pkgname}}

BuildRequires:  python2-devel
BuildRequires:  python2dist(m2r)
BuildRequires:  python2dist(setuptools)
BuildRequires:  python2dist(setuptools-scm)
%if %{with tests}
BuildRequires:  python2dist(pytest)
BuildRequires:  python2dist(attrs) >= 16.1.0
BuildRequires:  python2dist(graphviz) > 0.5.1
BuildRequires:  python2dist(six)
BuildRequires:  python2dist(twisted) >= 16.1.1

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

%package -n     python3-%{pkgname}
Summary:        %{summary}
Provides:       python3-%{libname}
%{?python_provide:%python_provide python3-%{pkgname}}

BuildRequires:  python3-devel
BuildRequires:  python3dist(m2r)
BuildRequires:  python3dist(setuptools)
BuildRequires:  python3dist(setuptools-scm)
%if %{with tests}
BuildRequires:  python3dist(pytest)
BuildRequires:  python3dist(attrs) >= 16.1.0
BuildRequires:  python3dist(graphviz) > 0.5.1
BuildRequires:  python3dist(six)
BuildRequires:  python3dist(twisted) >= 16.1.1

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

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

%if %{with python2}

# Must do the default python version install last because
# the scripts in /usr/bin are overwritten with every install.
%if %{with python2}
rm -rf %{buildroot}%{_bindir}/*

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

%if %{with python2}
%files -n python2-%{pkgname}
%license LICENSE

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

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

* Mon Mar 11 2019 Robert-André Mauchin <> - 0.7.0-1
- Release 0.7.0 (#1687495)

* Fri Mar 08 2019 Jeroen van Meeuwen <> - 0.6.0-5
 - Add bcond_without tests

* Sat Feb 02 2019 Fedora Release Engineering <> - 0.6.0-4
- Rebuilt for

* Fri Jul 13 2018 Fedora Release Engineering <> - 0.6.0-3
- Rebuilt for

* Tue Jun 19 2018 Miro Hrončok <> - 0.6.0-2
- Rebuilt for Python 3.7

* Fri Apr 13 2018 Robert-André Mauchin <> - 0.6.0-1
- Initial package.