From cf62192b71f066ad7b84b6fdff0cbd26ec0dfdcf Mon Sep 17 00:00:00 2001 From: "Benjamin A. Beasley" Date: Wed, 3 May 2023 10:12:08 -0400 Subject: [PATCH] =?UTF-8?q?Port=20to=20pyproject-rpm-macros=20(=E2=80=9Cne?= =?UTF-8?q?w=20Python=20guidelines=E2=80=9D)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- python-ruamel-yaml-clib.spec | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/python-ruamel-yaml-clib.spec b/python-ruamel-yaml-clib.spec index e4dbf8e..8e0e44b 100644 --- a/python-ruamel-yaml-clib.spec +++ b/python-ruamel-yaml-clib.spec @@ -17,14 +17,16 @@ Patch: fix-typecasts-s390x.patch BuildRequires: gcc -%description -It is the C based reader/scanner and emitter for ruamel.yaml. +%global _description %{expand: +It is the C based reader/scanner and emitter for ruamel.yaml.} + +%description %{_description} %package -n python3-ruamel-yaml-clib Summary: %{summary} + BuildRequires: python3-devel -BuildRequires: python3-setuptools -BuildRequires: python3-Cython +BuildRequires: %{py3_dist Cython} # Unfortunately, the circular dependency is intentional; the clib extension # packaged here imports from ruamel.yaml, which in turn uses the extension for @@ -48,8 +50,9 @@ Requires: python3-ruamel-yaml # Version number from VERSION in config.h: Provides: bundled(libyaml) = 0.1.7 -%description -n python3-ruamel-yaml-clib -It is the C based reader/scanner and emitter for ruamel.yaml. +%py_provides python3-ruamel.yaml.clib + +%description -n python3-ruamel-yaml-clib %{_description} %prep %autosetup -n ruamel-yaml-clib-code-%{commit} @@ -57,6 +60,11 @@ It is the C based reader/scanner and emitter for ruamel.yaml. rm -v $(grep -rl '/\* Generated by Cython') cp -p '%{SOURCE1}' . +%generate_buildrequires +# Upstream has a tox.ini, but it is for a build-and-install check, not a test +# suite, so we do not use it to generate dependencies (-t). +%pyproject_buildrequires + %build # cython refuses to cythonize a file in a directory that cannot be a Python module ¯\_(ツ)_/¯ mkdir ruamel.yaml.clib @@ -65,19 +73,21 @@ cythonize -3 ruamel.yaml.clib/*.pyx mv ruamel.yaml.clib/* . rmdir ruamel.yaml.clib -%py3_build +%pyproject_wheel %install -%{python3} setup.py install --single-version-externally-managed --skip-build --root $RPM_BUILD_ROOT +%pyproject_install +%pyproject_save_files _ruamel_yaml %check %py3_check_import _ruamel_yaml -%files -n python3-ruamel-yaml-clib +%files -n python3-ruamel-yaml-clib -f %{pyproject_files} +# pyproject_files handles LICENSE; verify with “rpm -qL -p …” +# Remove the following once we no longer have a separate LICENSE-libyaml: %license LICENSE LICENSE-libyaml + %doc README.rst -%{python3_sitearch}/_ruamel_yaml.cpython-* -%{python3_sitearch}/ruamel.yaml.clib-%{version}-py%{python3_version}.egg-info %changelog * Wed May 03 2023 Benjamin A. Beasley - 0.2.6-5 @@ -89,6 +99,7 @@ rmdir ruamel.yaml.clib - Update URL (close RHBZ#1840610) - Add an import-only “smoke test” - Properly handle libyaml bundling +- Port to pyproject-rpm-macros (“new Python guidelines”) * Fri Jan 20 2023 Fedora Release Engineering - 0.2.6-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild