Follow new packaging guidelines

Signed-off-by: Igor Gnatenko <ignatenko@redhat.com>
This commit is contained in:
Igor Gnatenko 2016-04-10 11:09:23 +02:00
parent da01faebc9
commit 7f6b746d18

View File

@ -1,12 +1,14 @@
%if 0%{?fedora} > 12
%global with_python3 1
%endif
%global pypi_name colorama
%if 0%{?fedora}
%bcond_without python3
%else
%bcond_with python3
%endif
Name: python-%{pypi_name}
Version: 0.3.7
Release: 1%{?dist}
Release: 2%{?dist}
Summary: Cross-platform colored terminal text
License: BSD
@ -14,8 +16,6 @@ URL: http://pypi.python.org/pypi/colorama/
Source0: http://pypi.python.org/packages/source/c/%{pypi_name}/%{pypi_name}-%{version}.tar.gz
BuildArch: noarch
BuildRequires: python2-devel
%description
Makes ANSI escape character sequences, for producing colored
terminal text and cursor positioning, work under MS Windows.
@ -27,14 +27,31 @@ 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.
%package -n python2-%{pypi_name}
Summary: Cross-platform colored terminal text
%{?python_provide:%python_provide python2-%{pypi_name}}
BuildRequires: python2-devel
BuildRequires: python2-setuptools
%description -n python2-%{pypi_name}
Makes ANSI escape character sequences, for producing colored
terminal text and cursor positioning, work under MS Windows.
%if 0%{?with_python3}
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.
%if %{with python3}
%package -n python3-%{pypi_name}
Summary: Cross-platform colored terminal text
Requires: python3
BuildRequires: python3-devel
%{?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
@ -47,59 +64,46 @@ 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
%setup -q -n %{pypi_name}-%{version}
%autosetup -n %{pypi_name}-%{version}
# remove bundled egg-info
rm -rf %{pypi_name}.egg-info
%if 0%{?with_python3}
cp -a . %{py3dir}
%endif
rm -rf *.egg-info
%build
%{__python} setup.py build
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py build
popd
%endif # with_python3
%py2_build
%if %{with python3}
%py3_build
%endif
%install
%{__python} setup.py install --skip-build --root %{buildroot}
%py2_install
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py install --skip-build --root %{buildroot}
popd
%endif # with_python3
%if %{with python3}
%py3_install
%endif
%files
%files -n python2-%{pypi_name}
%doc README.rst
%license LICENSE.txt
%{python_sitelib}/%{pypi_name}
%{python_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info
%{python2_sitelib}/%{pypi_name}/
%{python2_sitelib}/%{pypi_name}-%{version}-*.egg-info/
%if 0%{?with_python3}
%if %{with python3}
%files -n python3-%{pypi_name}
%doc README.rst
%license LICENSE.txt
%{python3_sitelib}/%{pypi_name}
%{python3_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info
%{python3_sitelib}/%{pypi_name}/
%{python3_sitelib}/%{pypi_name}-%{version}-*.egg-info/
%endif
%changelog
* Sun Apr 10 2016 Igor Gnatenko <ignatenko@redhat.com> - 0.3.7-2
- Follow new packaging guidelines
* Tue Mar 08 2016 Matthias Runge <mrunge@redhat.com> - 0.3.7-1
- update to 0.3.7 (rhbz#1179250)