Blob Blame Raw
# what it's called on pypi
%global srcname prettyprinter
# what it's imported as
%global libname %{srcname}
# name of egg info directory
%global eggname %{srcname}
# package name fragment
%global pkgname %{srcname}

%global common_description %{expand:
Syntax-highlighting, declarative and composable pretty printer.  Drop in
replacement for the standard library pprint: just rename pprint to
prettyprinter in your imports.  Uses a modified Wadler-Leijen layout algorithm
for optimal formatting.  Write pretty printers for your own types with a dead
simple, declarative interface.}

%if 0%{?fedora} >= 31
# tests are incompatible with hypothesis 4
%bcond_with tests
%bcond_without tests

Name:           python-%{pkgname}
Version:        0.17.0
Release:        5%{?dist}
Summary:        Syntax-highlighting, declarative and composable pretty printer
License:        MIT
Source0:        %pypi_source
# avoid build requirement on pytest-runner
Patch0:         remove-setup-requires.patch
# test relies on a pinned requests version user-agent
Patch1:         allow-failure-with-different-requests-versions.patch
Patch2:         allow-failure-with-system-wide-timezone-database.patch
BuildArch:      noarch

%description %{common_description}

%package -n python3-%{pkgname}
Summary:        %{summary}
BuildRequires:  python3-devel
BuildRequires:  python3-setuptools
%if %{with tests}
BuildRequires:  python3-pytest
BuildRequires:  python3-hypothesis
BuildRequires:  python3-requests
BuildRequires:  python3-attrs
BuildRequires:  python3-ipython
BuildRequires:  python3-pytz
BuildRequires:  python3-numpy
BuildRequires:  python3-colorful >= 0.4.0
BuildRequires:  python3-pygments >= 2.2.0
Requires:       python3-colorful >= 0.4.0
Requires:       python3-pygments >= 2.2.0
%{?python_provide:%python_provide python3-%{pkgname}}

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

%autosetup -n %{srcname}-%{version} -p 1
rm -rf %{eggname}.egg-info

# tests are incompatible with django 2
rm -r tests/test_django



%if %{with tests}
PYTHONPATH=%{buildroot}%{python3_sitelib} py.test-%{python3_version} --verbose tests

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

* Thu Jan 30 2020 Fedora Release Engineering <> - 0.17.0-5
- Rebuilt for

* Thu Oct 03 2019 Miro Hrončok <> - 0.17.0-4
- Rebuilt for Python 3.8.0rc1 (#1748018)

* Mon Aug 19 2019 Miro Hrončok <> - 0.17.0-3
- Rebuilt for Python 3.8

* Fri Jul 26 2019 Fedora Release Engineering <> - 0.17.0-2
- Rebuilt for

* Sat Apr 06 2019 Carl George <> - 0.17.0-1
- Initial package