%global pkgname configparser %global sum Backport of Python 3 configparser module %if 0%{?fedora} > 12 || 0%{?rhel} >= 7 %global with_python3 1 %{!?python3_pkgversion: %global python3_pkgversion 36} %endif # Rename to python2-configparser after Fedora 23 %if 0%{?fedora} > 23 || 0%{?rhel} >= 8 %global with_python2 0 %global with_p2subpkg 1 %else %global with_python2 1 %global with_p2subpkg 0 %endif # __python2 macro doesn't exist for el6 %if 0%{?el6} %define __python2 %{__python} %define python2_sitelib %{python_sitelib} %endif Name: python-%{pkgname} Version: 4.0.2 Release: 2.0.3%{?dist} Summary: %{sum} License: MIT URL: https://pypi.python.org/pypi/configparser Source0: https://pypi.python.org/packages/source/c/configparser/configparser-%{version}.tar.gz Patch0: python-backports.patch BuildArch: noarch # For Fedora > 23 builds (protection against rename of python-setuptools) %if 0%{?with_python2} %if 0%{?with_p2subpkg} BuildRequires: python2-devel python2-setuptools BuildRequires: python2-setuptools_scm Requires: python2-setuptools python-backports %else BuildRequires: python2-devel python-setuptools python-backports BuildRequires: python-setuptools_scm Requires: python-setuptools python-backports Provides: python2-%{pkgname} = %{version}-%{release} %endif %endif %if 0%{?with_python3} BuildRequires: python%{python3_pkgversion}-devel BuildRequires: python%{python3_pkgversion}-setuptools BuildRequires: python%{python3_pkgversion}-setuptools_scm Requires: python%{python3_pkgversion}-setuptools %endif %description The ancient ConfigParser module available in the standard library 2.x has seen a major update in Python 3.2. This package is a backport of those changes so that they can be used directly in Python 2.6 - 3.5. # For Fedora > 23 builds %if 0%{?with_python2} %if 0%{?with_p2subpkg} %package -n python2-%{pkgname} Summary: %{sum} provides: python-%{pkgname} = %{version}-%{release} %description -n python2-%{pkgname} The ancient ConfigParser module available in the standard library 2.x has seen a major update in Python 3.2. This package is a backport of those changes so that they can be used directly in Python 2.6 - 3.5. %endif %endif %if 0%{?with_python3} %package -n python%{python3_pkgversion}-%{pkgname} Summary: %{sum} provides: python3-%{pkgname} = %{version}-%{release} %description -n python%{python3_pkgversion}-%{pkgname} The ancient ConfigParser module available in the standard library 2.x has seen a major update in Python 3.2. This package is a backport of those changes so that they can be used directly in Python 2.6 - 3.5. %endif %prep %setup -q -n configparser-%{version} %patch0 -p1 rm -rf *.egg-info # Python 2 setuptools cannot handle non-ASCII characters in setup.cfg. # See https://github.com/pypa/setuptools/issues/1062 sed -i 's/Ł/L/' setup.cfg README.rst %build %if 0%{?with_python2} %{__python2} setup.py build %endif %if 0%{?with_python3} %{__python3} setup.py build %endif %install rm -rf %{buildroot} %if 0%{?with_python2} %{__python2} setup.py install --skip-build --root %{buildroot} %endif %if 0%{?with_python3} %{__python3} setup.py install --skip-build --root %{buildroot} %endif %check %if 0%{?with_python2} %{__python2} setup.py test %endif %if 0%{?with_python3} %{__python3} setup.py test %endif # For Fedora > 23 builds %if 0%{?with_python2} %if 0%{?with_p2subpkg} %files -n python2-%{pkgname} %doc README.rst %license LICENSE %{python2_sitelib}/* %else %files %doc README.rst %license LICENSE %{python2_sitelib}/* %endif %endif %if 0%{?with_python3} %files -n python%{python3_pkgversion}-%{pkgname} %doc README.rst %license LICENSE %{python3_sitelib}/* %endif %changelog * Fri Mar 27 2020 Qing Lin - 4.0.2-2.0.3 - build python-configparser instead of python2-configparser. * Tue Nov 26 2019 Qing Lin - 4.0.2-2.0.1 - build python3 for ol7. * Tue Nov 05 2019 Avram Lubkin - 4.0.2-2 - Depend on python-backports * Mon Oct 28 2019 Avram Lubkin - 4.0.2-1 - Update to 4.0.2 * Thu Dec 17 2015 Avram Lubkin - 3.5.0b2-1 - Updated to build for el6 - Updated to build Python3 packages - Changed Python2 package name to python2-configparser for Fedora 24+ - Updated description - Removed license comments * Thu Jul 16 2015 José Matos - 3.5.0b2-0.2 - Improve description to make it clear that this package in only needed for python 2.7 - Make the license tag information more explicit. * Wed Jul 15 2015 José Matos - 3.5.0b2-0.1 - First release for Fedora