Clean up spec

- Remove all python2 bits
- Adopt pyproject-rpm-macros
- Switch to GitHub tarball for tests and enable check
This commit is contained in:
Mikel Olasagasti Uranga 2022-01-08 11:27:50 +01:00
parent ee4c302e52
commit d3cc0675d8
2 changed files with 19 additions and 77 deletions

View File

@ -1,32 +1,20 @@
%global pypi_name colorama
%if 0%{?rhel}
%if 0%{?rhel}> 7
%bcond_with python2
%bcond_without python3
%else
%bcond_without python2
%bcond_with python3
%endif
%else
%if 0%{?fedora} > 29
%bcond_without python3
%else
%bcond_without python2
%bcond_without python3
%endif
%endif
Name: python-%{pypi_name}
Version: 0.4.4
Release: %autorelease
Release: %autorelease -b 5
Summary: Cross-platform colored terminal text
License: BSD
URL: http://pypi.python.org/pypi/colorama
Source0: https://files.pythonhosted.org/packages/source/c/%{pypi_name}/%{pypi_name}-%{version}.tar.gz
URL: https://github.com/tartley/colorama
Source0: %{url}/archive/%{version}/colorama-%{version}.tar.gz
BuildArch: noarch
BuildRequires: python3-devel
# for check
BuildRequires: python3dist(pytest)
%description
Makes ANSI escape character sequences, for producing colored
terminal text and cursor positioning, work under MS Windows.
@ -38,35 +26,8 @@ It also provides some shortcuts to help generate ANSI sequences, and works fine
in conjunction with any other ANSI sequence generation library, such as
Termcolor.
%if %{with python2}
%package -n python2-%{pypi_name}
Summary: Cross-platform colored terminal text
BuildRequires: python2-devel
%{?el6:BuildRequires: python-setuptools}
%{!?el6:BuildRequires: python2-setuptools}
%{?el6:Provides: python-%{pypi_name}}
%{?python_provide:%python_provide python2-%{pypi_name}}
%description -n python2-%{pypi_name}
Makes ANSI escape character sequences, for producing colored
terminal text and cursor positioning, work under MS Windows.
ANSI escape character sequences have long been used to produce colored terminal
text and cursor positioning on Unix and Macs. Colorama makes this work on
Windows, too.
It also provides some shortcuts to help generate ANSI sequences, and works fine
in conjunction with any other ANSI sequence generation library, such as
Termcolor.
Python 2 version.
%endif
%if %{with python3}
%package -n python3-%{pypi_name}
Summary: Cross-platform colored terminal text
%{?python_provide:%python_provide python3-%{pypi_name}}
BuildRequires: python3-devel
BuildRequires: python3-setuptools
%description -n python3-%{pypi_name}
Makes ANSI escape character sequences, for producing colored
@ -79,44 +40,25 @@ It also provides some shortcuts to help generate ANSI sequences, and works fine
in conjunction with any other ANSI sequence generation library, such as
Termcolor.
Python 3 version.
%endif
%prep
%autosetup -n %{pypi_name}-%{version}
rm -rf *.egg-info
%generate_buildrequires
%pyproject_buildrequires -r
%build
%if %{with python2}
%py2_build
%endif
%if %{with python3}
%py3_build
%endif
%pyproject_wheel
%install
%if %{with python2}
%py2_install
%endif
%if %{with python3}
%py3_install
%endif
%pyproject_install
%pyproject_save_files colorama
%if %{with python2}
%files -n python2-%{pypi_name}
%doc README.rst
%license LICENSE.txt
%{python2_sitelib}/%{pypi_name}/
%{python2_sitelib}/%{pypi_name}-%{version}-*.egg-info/
%endif
%check
%pytest
%if %{with python3}
%files -n python3-%{pypi_name}
%doc README.rst
%files -n python3-%{pypi_name} -f %{pyproject_files}
%doc CHANGELOG.rst README.rst
%license LICENSE.txt
%{python3_sitelib}/%{pypi_name}/
%{python3_sitelib}/%{pypi_name}-%{version}-*.egg-info/
%endif
%changelog
%autochangelog

View File

@ -1 +1 @@
SHA512 (colorama-0.4.4.tar.gz) = 84db73bed5a6d4ab1624bdbeea65aef2061126e730f9d4a853f3b2504b9ebf5eb7c0649024ec687b538a89c20c83a5f3365d4fb1aba9fdba3db0b375942c48f4
SHA512 (colorama-0.4.4.tar.gz) = 35501915b79bfc5fe46a36f83790ecd79c82150d6b73a57cd55fbe6431ea5ed7a86676504af90147eeb3a963ffd16890e0220099df579a66f2d8f1f7494f862e