Port to pyproject-rpm-macros (“new Python guidelines”)

This commit is contained in:
Benjamin A. Beasley 2023-05-03 10:12:08 -04:00
parent a8b60c242c
commit cf62192b71

View File

@ -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 <code@musicinmybrain.net> - 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 <releng@fedoraproject.org> - 0.2.6-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild