File python-ruamel.yaml.clib.spec of Package python-ruamel.yaml.clib

#
# spec file for package python-ruamel.yaml.clib
#
# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


%{?sle15_python_module_pythons}
%define relver 0.2.8
Name:           python-ruamel.yaml.clib
Version:        0.2.8+hg.44
Release:        0
Summary:        Python YAML parser c-library
License:        MIT
URL:            https://bitbucket.org/ruamel/yaml.clib
# Source:         https://files.pythonhosted.org/packages/source/r/ruamel.yaml.clib/ruamel.yaml.clib-%%{version}.tar.gz
Source:         ruamel-yaml-clib-%{version}.tar.gz
# PATCH-FIX-UPSTREAM 0001-Fix-building-with-clang-16.patch bsc#1221017 mcepl@suse.com
# Fix incompatible function pointer types
Patch0:         0001-Fix-building-with-clang-16.patch
BuildRequires:  %{python_module Cython}
BuildRequires:  %{python_module devel}
BuildRequires:  %{python_module pip}
BuildRequires:  %{python_module setuptools >= 28.7.0}
BuildRequires:  %{python_module wheel}
BuildRequires:  fdupes
BuildRequires:  python-rpm-macros
%python_subpackages

%description
ruamel.yaml.clib is a YAML parser/emitter that supports roundtrip preservation
of comments, seq/map flow style, and map key order.
This package contains the C library counterpart of it.

%prep
%autosetup -p1 -n ruamel-yaml-clib-%{version}

rm -v $(grep -rl '/\* Generated by Cython')
rm -rf *egg-info

%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
%python_expand %fdupes %{buildroot}%{$python_sitearch}

%files %{python_files}
%license LICENSE
%doc README.rst
%{python_sitearch}/_ruamel_yaml*.so
%{python_sitearch}/ruamel[_.]yaml[_.]clib-%{relver}.dist-info

%changelog
openSUSE Build Service is sponsored by