python-ruamel-yaml-clib/python-ruamel-yaml-clib.spec
Kseniia Nivnia f3ae48b1b5
Convert to %autorelease and %autochangelog
Resolves: RHEL-102978
[skip changelog]
2025-07-11 10:35:13 +01:00

99 lines
3.1 KiB
RPMSpec

%global commit fdd42e838e4d5199b0277fc21a920a744cdd5c9d
Name: python-ruamel-yaml-clib
Version: 0.2.7
Release: %autorelease
Summary: C version of reader, parser and emitter for ruamel.yaml derived from libyaml
# SPDX
License: MIT
URL: https://sourceforge.net/projects/ruamel-yaml-clib
Source0: https://sourceforge.net/code-snapshots/hg/r/ru/ruamel-yaml-clib/code/ruamel-yaml-clib-code-%{commit}.zip
# Include license file for bundled libyaml
# https://sourceforge.net/p/ruamel-yaml-clib/tickets/16/
# This should be fixed upstream in a future ruamel.yaml.clib release >0.2.7
Source1: https://github.com/yaml/libyaml/raw/0.1.7/LICENSE#/LICENSE-libyaml
Patch1: fix-typecasts-s390x.patch
BuildRequires: gcc
%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: %{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
# performance.
BuildRequires: python3-ruamel-yaml
Requires: python3-ruamel-yaml
# Bundled sources from libyaml are:
# - config.h yaml.h yaml_private.h
# - api.c dumper.c emitter.c loader.c parser.c reader.c scanner.c writer.c
#
# Support building with an external/system copy of libyaml?
# https://sourceforge.net/p/ruamel-yaml-clib/tickets/15/
#
# Upstream replied:
#
# The copy is because there have been improvements where libyaml had not been
# maintained for several years. But that is minor reason to do that, as I am
# working on an alternative for clib.
#
# Version number from VERSION in config.h:
Provides: bundled(libyaml) = 0.1.7
%py_provides python3-ruamel.yaml.clib
%description -n python3-ruamel-yaml-clib %{_description}
%prep
%autosetup -p1 -n ruamel-yaml-clib-code-%{commit}
# Force regenerating C files from Cython sources
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 ¯\_(ツ)_/¯
#
# Top-level structure seems to be incompatible with Cython 0.29.34
# ('ruamel-yaml-clib-code._ruamel_yaml' is not a valid module name)
# https://sourceforge.net/p/ruamel-yaml-clib/tickets/14/
mkdir ruamel.yaml.clib
mv *.pyx ruamel.yaml.clib
cythonize -3 ruamel.yaml.clib/*.pyx
mv ruamel.yaml.clib/* .
rmdir ruamel.yaml.clib
%pyproject_wheel
%install
%pyproject_install
%pyproject_save_files _ruamel_yaml
%check
%py3_check_import _ruamel_yaml
%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
%changelog
%autochangelog