From 7c53583d11de3185c74f58413fae4db4638b6081 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Fri, 2 Oct 2020 12:24:34 +0200 Subject: [PATCH] Convert to pyproject-rpm-macros --- python-packaging.spec | 63 ++++++++++++++++++++++++++----------------- 1 file changed, 39 insertions(+), 24 deletions(-) diff --git a/python-packaging.spec b/python-packaging.spec index b076044..d6aa532 100644 --- a/python-packaging.spec +++ b/python-packaging.spec @@ -6,8 +6,6 @@ # Specify --without tests to prevent the dependency loop on python-pytest %bcond_without tests -%global python_wheelname %{pypi_name}-%{version}-py2.py3-none-any.whl - Name: python-%{pypi_name} Version: 20.4 Release: 3%{?dist} @@ -21,31 +19,44 @@ BuildArch: noarch # Remove dependency on six to make package lighter, backported from upstream Patch1: %{url}/commit/39a70cce.patch -BuildRequires: python%{python3_pkgversion}-setuptools BuildRequires: python%{python3_pkgversion}-devel -BuildRequires: python%{python3_pkgversion}-pyparsing -%if %{with tests} -BuildRequires: python%{python3_pkgversion}-pytest -BuildRequires: python%{python3_pkgversion}-pretend -%endif -%if %{with docs} -BuildRequires: python%{python3_pkgversion}-sphinx -%endif +BuildRequires: pyproject-rpm-macros +# We specify dependencies to build the wheel manually to avoid circular +# dependency on self. +# We also don't use the python3dist() form, in case packaging is ever used +# in the provides generator. +BuildRequires: python%{python3_pkgversion}-setuptools BuildRequires: python%{python3_pkgversion}-pip BuildRequires: python%{python3_pkgversion}-wheel -%description +# Upstream uses nox for testing, we specify the test deps manually as well. +%if %{with tests} +BuildRequires: python%{python3_pkgversion}-pytest +BuildRequires: python%{python3_pkgversion}-pretend +BuildRequires: python%{python3_pkgversion}-pyparsing +%endif +%if %{with docs} +BuildRequires: python%{python3_pkgversion}-sphinx +BuildRequires: python%{python3_pkgversion}-pyparsing +%endif + + +%global _description %{expand: python-packaging provides core utilities for Python packages like utilities for -dealing with versions, specifiers, markers etc. +dealing with versions, specifiers, markers etc.} + +%description %_description + %package -n python%{python3_pkgversion}-%{pypi_name} Summary: %{summary} -%{?python_provide:%python_provide python%{python3_pkgversion}-%{pypi_name}} -%description -n python%{python3_pkgversion}-%{pypi_name} -python3-packaging provides core utilities for Python packages like utilities for -dealing with versions, specifiers, markers etc. +# This is kept for compatibility with Fedora < 33 only: +%py_provides python%{python3_pkgversion}-%{pypi_name} + +%description -n python%{python3_pkgversion}-%{pypi_name} %_description + %if %{with docs} %package -n python-%{pypi_name}-doc @@ -55,13 +66,13 @@ Summary: python-packaging documentation Documentation for python-packaging %endif + %prep %autosetup -p1 -n %{pypi_name}-%{version} -# Remove bundled egg-info -rm -rf %{pypi_name}.egg-info + %build -%py3_build_wheel +%pyproject_wheel %if %{with docs} # generate html docs @@ -72,19 +83,22 @@ rm -rf html/.{doctrees,buildinfo} rm -rf html/_static/fonts/ %endif + %install -%py3_install_wheel %{python_wheelname} +%pyproject_install +%pyproject_save_files %{pypi_name} + %if %{with tests} %check %pytest %endif -%files -n python%{python3_pkgversion}-%{pypi_name} + +%files -n python%{python3_pkgversion}-%{pypi_name} -f %{pyproject_files} %license LICENSE LICENSE.APACHE LICENSE.BSD %doc README.rst CHANGELOG.rst CONTRIBUTING.rst -%{python3_sitelib}/%{pypi_name}/ -%{python3_sitelib}/%{pypi_name}-*-info/ + %if %{with docs} %files -n python-%{pypi_name}-doc @@ -92,6 +106,7 @@ rm -rf html/_static/fonts/ %license LICENSE LICENSE.APACHE LICENSE.BSD %endif + %changelog * Fri Oct 02 2020 Miro HronĨok - 20.4-3 - Drop the dependency on six to make the package lighter