Force regenerating C files from Cython sources

See https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_packages_using_cython

The pre-generated sources fail to build with Python 3.10.
This commit is contained in:
Miro Hrončok 2020-11-12 13:21:08 +01:00
parent 0be32400a6
commit 4d7ab8b374
3 changed files with 21 additions and 4 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
/ruamel.yaml.clib-0.1.2.tar.gz
/ruamel-yaml-clib-code-955989c1f022b95ca1f92bf0abd761ef8aa0b940.zip

View File

@ -1,14 +1,17 @@
%global pypi_name ruamel.yaml.clib
%global pname ruamel-yaml-clib
# This means version 0.1.2:
%global hash 955989c1f022b95ca1f92bf0abd761ef8aa0b940
Name: python-%{pname}
Version: 0.1.2
Release: 4%{?dist}
Release: 5%{?dist}
Summary: C version of reader, parser and emitter for ruamel.yaml derived from libyaml
License: MIT
URL: https://bitbucket.org/ruamel/yaml.clib
Source0: %{pypi_source}
Source0: https://sourceforge.net/code-snapshots/hg/r/ru/ruamel-yaml-clib/code/ruamel-yaml-clib-code-%{hash}.zip
BuildRequires: gcc
BuildRequires: libyaml-devel
@ -20,6 +23,7 @@ It is the C based reader/scanner and emitter for ruamel.yaml.
Summary: %{summary}
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-Cython
Requires: python3-setuptools
@ -27,9 +31,18 @@ Requires: python3-setuptools
It is the C based reader/scanner and emitter for ruamel.yaml.
%prep
%autosetup -n %{pypi_name}-%{version}
%autosetup -n %{pname}-code-%{hash}
# Force regenerating C files from Cython sources
rm -v $(grep -rl '/\* Generated by Cython')
%build
# cython refuses to cythonize a file in a directory that cannot be a Python module ¯\_(ツ)_/¯
mkdir ruamel.yaml.clib
mv *.pyx ruamel.yaml.clib
cythonize ruamel.yaml.clib/*.pyx
mv ruamel.yaml.clib/* .
rmdir ruamel.yaml.clib
%py3_build
%install
@ -42,6 +55,9 @@ It is the C based reader/scanner and emitter for ruamel.yaml.
%{python3_sitearch}/%{pypi_name}-%{version}-py%{python3_version}.egg-info
%changelog
* Thu Nov 12 2020 Miro Hrončok <mhroncok@redhat.com> - 0.1.2-5
- Force regenerating C files from Cython sources
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.1.2-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild

View File

@ -1 +1 @@
SHA512 (ruamel.yaml.clib-0.1.2.tar.gz) = a5c84b1ff10dde5a467fa16f1a3bd5ea174c39251364429ac3d63fa94bc728571316a8f418bf9a50f441096d59580c3e2e49c3ecf9d5961d650d61440b57f461
SHA512 (ruamel-yaml-clib-code-955989c1f022b95ca1f92bf0abd761ef8aa0b940.zip) = a2032af5c677c5ebadd8c8289bd0fa926cbb07e0a289d95893dc7f0e38d6387cf3798046727627c6574ede84828054eabf6262b4f5a490072e8902c85c6c6b06