%global pypi_name enlighten %global sum Enlighten Progress Bar %global desc Enlighten Progress Bar is console progress bar module for Python.\ The main advantage of Enlighten is it allows writing to stdout and stderr\ without any redirection. # Default to versioned Python 2 package %global py2_major 2 # Build Python 3 package for Fedora %if 0%{?fedora} > 12 %global with_python3 1 %endif # Python 2 package name is unversioned in EL7 %if 0%{?el7} %global py2_major %{nil} %endif # Python 2 package name is unversioned in EL6 # Macros missing in EL6 %if 0%{?el6} %global py2_major %{nil} %global __python2 %{__python} %global python2_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())") %endif Name: python-%{pypi_name} Version: 1.0.6 Release: 1%{?dist} Summary: %{sum} License: MPLv2.0 URL: https://github.com/Rockhopper-Technologies/enlighten Source0: https://files.pythonhosted.org/packages/source/e/%{pypi_name}/%{pypi_name}-%{version}.tar.gz BuildArch: noarch # Python 2 build requirements BuildRequires: python%{py2_major}-setuptools BuildRequires: python%{py2_major}-devel BuildRequires: python2-mock BuildRequires: python-blessed # Additional build requirements for Python 2.6 %if 0%{?el6} BuildRequires: python-unittest2 %endif # Python 3 build requirements %if 0%{?with_python3} BuildRequires: python3-setuptools BuildRequires: python3-devel BuildRequires: python3-blessed %endif # Unversion Python 2 package %if ! 0%{?py2_major} Requires: python-blessed %endif %description %{desc} # Versioned Python 2 package %if 0%{?py2_major} %package -n python2-%{pypi_name} Summary: %{sum} %{?python_provide:%python_provide python2-%{pypi_name}} Requires: python-blessed %description -n python2-%{pypi_name} %{desc} %endif # Python 3 package %if 0%{?with_python3} %package -n python3-%{pypi_name} Summary: %{sum} %{?python_provide:%python_provide python3-%{pypi_name}} Requires: python3-blessed %description -n python3-%{pypi_name} %{desc} %endif %prep %autosetup -p0 -n %{pypi_name}-%{version} # Remove bundled egg-info rm -rf %{pypi_name}.egg-info %build %py2_build %if 0%{?with_python3} %py3_build %endif %install %if 0%{?with_python3} %py3_install %endif %py2_install %check %{__python2} setup.py test %if 0%{?with_python3} %{__python3} setup.py test %endif %files -n python%{py2_major}-%{pypi_name} %doc README* %license LICENSE %{python2_sitelib}/* %if 0%{?with_python3} %files -n python3-%{pypi_name} %doc README* %license LICENSE %{python3_sitelib}/* %endif %changelog * Fri Oct 13 2017 Avram Lubkin - 1.0.6-1 - Initial package.