#7 Remove Python 2 subpackage and make spec fedora-specific
Merged 4 years ago by lbalhar. Opened 4 years ago by lbalhar.
rpms/ lbalhar/python-packaging master  into  master

file modified
+25 -97
@@ -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 @@ 

  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

- %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

- %endif

- %if %{with docs}

- BuildRequires:  python-sphinx

- %endif

- %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

+ BuildRequires:  python3-setuptools

+ BuildRequires:  python3-devel

+ BuildRequires:  python3-pyparsing

+ BuildRequires:  python3-six

  %if %{with tests}

- BuildRequires:  python%{python3_pkgversion}-pytest

- BuildRequires:  python%{python3_pkgversion}-pretend

+ BuildRequires:  python3-pytest

+ BuildRequires:  python3-pretend

  %endif

  %if %{with docs}

- BuildRequires:  python%{python3_pkgversion}-sphinx

- %endif

+ BuildRequires:  python3-sphinx

  %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}

- Summary:        %{summary}

- %{?python_provide:%python_provide python2-%{pypi_name}}

- 

- %if 0%{?fedora} || 0%{?rhel} >= 8

- Requires:       python2-pyparsing

- %else

- Requires:       pyparsing

- %endif

- 

- 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}

+ %package -n python3-%{pypi_name}

  Summary:        %{summary}

- %{?python_provide:%python_provide python%{python3_pkgversion}-%{pypi_name}}

+ %{?python_provide:%python_provide python3-%{pypi_name}}

  

- Requires:       python%{python3_pkgversion}-pyparsing

- Requires:       python%{python3_pkgversion}-six

+ Requires:       python3-pyparsing

+ Requires:       python3-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 @@ 

  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 @@ 

  %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 @@ 

  %endif

  

  %changelog

+ * Mon Sep 23 2019 Lumír Balhar <lbalhar@redhat.com> - 19.0-6

+ - Remove Python 2 subpackage

+ - Make spec fedora-specific

I don't consider this information useful for the package users, but I don't care that much.

+ 

  * Mon Sep 02 2019 Miro Hrončok <mhroncok@redhat.com> - 19.0-5

  - Reduce Python 2 build time dependencies

  

I'd like to remove python2- subpackage but I don't want to add other conditions to the specfile and make it more complex.

Scratch build: https://koji.fedoraproject.org/koji/taskinfo?taskID=37819408

WDYT?

I don't consider this information useful for the package users, but I don't care that much.

Pull-Request has been merged by lbalhar

4 years ago