Blob Blame History Raw
%global srcname autopage

# Macros for pyproject (Fedora) vs. setup.py (CentOS)
%if 0%{?fedora} >= 33 || 0%{?rhel} >= 10
%bcond_without pyproject
%else
%bcond_with pyproject
%endif

# Macros for disabling tests on CentOS 7
%if 0%{?el7}
%bcond_with enable_tests
%else
%bcond_without enable_tests
%endif


Name:           python-%{srcname}
Version:        0.5.2
Release:        1%{?dist}
Summary:        A Python library to provide automatic paging for console output
License:        ASL 2.0
URL:            https://pypi.python.org/pypi/autopage
Source0:        %{pypi_source}
Source1:        setup.py

# autopage should ideally require fixtures[streams], but we don't have that
# packaged in Fedora yet.
Patch1:         0001-Do-not-depend-on-fixtures-streams.patch

BuildArch:      noarch

%global _description %{expand:
Autopage is a Python library to provide automatic paging for console output.}


%description %_description

%package -n python3-%{srcname}
Summary:        %{summary}
BuildRequires:  python3-devel
%if %{with pyproject}
BuildRequires:  pyproject-rpm-macros
%else
%if %{with enable_tests}
BuildRequires:  %{py3_dist fixtures}
# autopage should ideally require fixtures[streams], but we don't have that
# packaged in Fedora yet. Once that is available, we can depend on only that
# instead of testtools.
BuildRequires:  %{py3_dist testtools}
%endif
%endif

%description -n python3-%{srcname} %_description

%prep
%autosetup -n %{srcname}-%{version}

%if %{with pyproject}
%generate_buildrequires
%pyproject_buildrequires -t
%else
cp %{SOURCE1} ./
%endif

%build
%if %{with pyproject}
%pyproject_wheel
%else
%py3_build
%endif

%install
%if %{with pyproject}
%pyproject_install
%pyproject_save_files autopage
%else
%py3_install
%endif

%check
%if %{with enable_tests}
%if %{with pyproject}
%tox
%else
%{python3} setup.py test
%endif
%endif

%if %{with pyproject}
%files -n python3-%{srcname} -f %{pyproject_files}
%else
%files -n python3-%{srcname}
%{python3_sitelib}/%{srcname}-*.egg-info/
%{python3_sitelib}/%{srcname}/
%endif
%license LICENSE
%doc README.md

%changelog
* Mon Oct 16 2023 Zane Bitter <zaneb@fedoraproject.org> 0.5.2-1
- Fix tests with less v633
- Fix test reliability

* Wed May 24 2023 Zane Bitter <zaneb@fedoraproject.org> 0.5.1-1
- Initial build for EPEL 9