From 1901358560cd4ff4d553aa0dda3a0be231efe42d Mon Sep 17 00:00:00 2001 From: Lumir Balhar Date: Mon, 23 Sep 2019 10:26:44 +0200 Subject: [PATCH] Remove Python 2 subpackage and make spec fedora-specific --- python-packaging.spec | 122 +++++++++--------------------------------- 1 file changed, 25 insertions(+), 97 deletions(-) diff --git a/python-packaging.spec b/python-packaging.spec index 242d0d5..2d1a333 100644 --- a/python-packaging.spec +++ b/python-packaging.spec @@ -1,9 +1,7 @@ %global pypi_name packaging -%if 0%{?fedora} || 0%{?rhel} >= 8 -%global build_wheel 1 -%global with_python3 1 -%endif +# Specify --without wheel to prevent building the wheel +%bcond_without wheel # Specify --without docs to prevent the dependency loop on python-sphinx %bcond_without docs @@ -15,7 +13,7 @@ Name: python-%{pypi_name} Version: 19.0 -Release: 5%{?dist} +Release: 6%{?dist} Summary: Core utilities for Python packages License: BSD or ASL 2.0 @@ -23,84 +21,37 @@ URL: https://github.com/pypa/packaging Source0: https://files.pythonhosted.org/packages/source/p/%{pypi_name}/%{pypi_name}-%{version}.tar.gz BuildArch: noarch -# Dependencies with different names in Fedora and Epel7 -%if 0%{?fedora} || 0%{?rhel} >= 8 -BuildRequires: python2-setuptools -BuildRequires: python2-devel -BuildRequires: python2-pyparsing +BuildRequires: python3-setuptools +BuildRequires: python3-devel +BuildRequires: python3-pyparsing +BuildRequires: python3-six %if %{with tests} -BuildRequires: python2-pytest -BuildRequires: python2-pretend -%endif -%else -BuildRequires: python-setuptools -BuildRequires: python-devel -BuildRequires: pyparsing -%if %{with tests} -BuildRequires: pytest -BuildRequires: python2-pretend +BuildRequires: python3-pytest +BuildRequires: python3-pretend %endif %if %{with docs} -BuildRequires: python-sphinx -%endif +BuildRequires: python3-sphinx %endif -BuildRequires: python2-six - -# Build Python 3 subpackage only for Fedora -%if 0%{?with_python3} -BuildRequires: python%{python3_pkgversion}-setuptools -BuildRequires: python%{python3_pkgversion}-devel -BuildRequires: python%{python3_pkgversion}-pyparsing -BuildRequires: python%{python3_pkgversion}-six -%if %{with tests} -BuildRequires: python%{python3_pkgversion}-pytest -BuildRequires: python%{python3_pkgversion}-pretend -%endif -%if %{with docs} -BuildRequires: python%{python3_pkgversion}-sphinx -%endif -%endif - -%if 0%{?build_wheel} -%if 0%{?with_python3} -BuildRequires: python%{python3_pkgversion}-pip -BuildRequires: python%{python3_pkgversion}-wheel -%endif +%if %{with wheel} +BuildRequires: python3-pip +BuildRequires: python3-wheel %endif %description python-packaging provides core utilities for Python packages like utilities for dealing with versions, specifiers, markers etc. -%package -n python2-%{pypi_name} +%package -n python3-%{pypi_name} Summary: %{summary} -%{?python_provide:%python_provide python2-%{pypi_name}} +%{?python_provide:%python_provide python3-%{pypi_name}} -%if 0%{?fedora} || 0%{?rhel} >= 8 -Requires: python2-pyparsing -%else -Requires: pyparsing -%endif +Requires: python3-pyparsing +Requires: python3-six -Requires: python2-six - -%description -n python2-%{pypi_name} -python2-packaging provides core utilities for Python packages like utilities for -dealing with versions, specifiers, markers etc. - -%if 0%{?with_python3} -%package -n python%{python3_pkgversion}-%{pypi_name} -Summary: %{summary} -%{?python_provide:%python_provide python%{python3_pkgversion}-%{pypi_name}} - -Requires: python%{python3_pkgversion}-pyparsing -Requires: python%{python3_pkgversion}-six - -%description -n python%{python3_pkgversion}-%{pypi_name} +%description -n python3-%{pypi_name} python3-packaging provides core utilities for Python packages like utilities for dealing with versions, specifiers, markers etc. -%endif %if %{with docs} %package -n python-%{pypi_name}-doc @@ -116,24 +67,15 @@ Documentation for python-packaging rm -rf %{pypi_name}.egg-info %build -%py2_build - -%if 0%{?with_python3} -%if 0%{?build_wheel} +%if %{with wheel} %py3_build_wheel %else %py3_build %endif -%endif %if %{with docs} # generate html docs -%if 0%{?with_python3} sphinx-build-3 docs html -%else -sphinx-build docs html -%endif - # remove the sphinx-build leftovers rm -rf html/.{doctrees,buildinfo} # Do not bundle fonts @@ -141,40 +83,22 @@ rm -rf html/_static/fonts/ %endif %install -%py2_install - -%if 0%{?with_python3} -%if 0%{?build_wheel} +%if %{with wheel} %py3_install_wheel %{python_wheelname} %else %py3_install %endif -%endif %if %{with tests} %check -%if 0%{?fedora} || 0%{?rhel} >= 8 -%{__python2} -m pytest tests/ %{__python3} -m pytest tests/ -%else -# Disable non-working tests in Epel7 -%{__python2} -m pytest --ignore=tests/test_requirements.py tests/ -%endif %endif -%files -n python2-%{pypi_name} -%license LICENSE LICENSE.APACHE LICENSE.BSD -%doc README.rst CHANGELOG.rst CONTRIBUTING.rst -%{python2_sitelib}/%{pypi_name}/ -%{python2_sitelib}/%{pypi_name}-*-info/ - -%if 0%{?with_python3} -%files -n python%{python3_pkgversion}-%{pypi_name} +%files -n python3-%{pypi_name} %license LICENSE LICENSE.APACHE LICENSE.BSD %doc README.rst CHANGELOG.rst CONTRIBUTING.rst %{python3_sitelib}/%{pypi_name}/ %{python3_sitelib}/%{pypi_name}-*-info/ -%endif %if %{with docs} %files -n python-%{pypi_name}-doc @@ -183,6 +107,10 @@ rm -rf html/_static/fonts/ %endif %changelog +* Mon Sep 23 2019 Lumír Balhar - 19.0-6 +- Remove Python 2 subpackage +- Make spec fedora-specific + * Mon Sep 02 2019 Miro Hrončok - 19.0-5 - Reduce Python 2 build time dependencies