diff --git a/.fmf/version b/.fmf/version deleted file mode 100644 index d00491f..0000000 --- a/.fmf/version +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/.gitignore b/.gitignore index 1966257..eea8f48 100644 --- a/.gitignore +++ b/.gitignore @@ -22,5 +22,3 @@ PyYAML-3.09.tar.gz /6.0b1.tar.gz /6.0.tar.gz /6.0.1.tar.gz -/6.0.2.tar.gz -/6.0.3.tar.gz diff --git a/731.patch b/731.patch new file mode 100644 index 0000000..4c924f4 --- /dev/null +++ b/731.patch @@ -0,0 +1,39 @@ +From 17dc5b6cd96dcfe64fd71789c771ca9b96d260e5 Mon Sep 17 00:00:00 2001 +From: "Andrew J. Hesford" +Date: Fri, 21 Jul 2023 09:50:00 -0400 +Subject: [PATCH] Fix builds with Cython 3 + +This is a *de minimis* fix for building with Cython 3. Recent Cython<3 +releases provided `Cython.Distutils.build_ext` as an alias to +`Cython.Distutils.old_build_ext.old_build_ext`; Cython 3 drops this +alias and instead uses a wholly new `Cython.Distutils.build_ext` that +does not provide the `cython_sources` function used in `setup.py`. + +Explicitly importing `old_build_ext` preserves the existing behavior for +recent Cython<3 and uses the correct behavior for Cython 3. Should the +import fail (*e.g.*, because the version of Cython available predates +the availability of `old_build_ext`), the import falls back to just +`Cython.Distutils.build_ext`. + +Signed-off-by: Andrew J. Hesford +--- + setup.py | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/setup.py b/setup.py +index 944e7fa2..462b1e95 100644 +--- a/setup.py ++++ b/setup.py +@@ -82,7 +82,11 @@ + with_cython = True + try: + from Cython.Distutils.extension import Extension as _Extension +- from Cython.Distutils import build_ext as _build_ext ++ try: ++ from Cython.Distutils.old_build_ext import old_build_ext as _build_ext ++ except ImportError: ++ from Cython.Distutils import build_ext as _build_ext ++ + with_cython = True + except ImportError: + if with_cython: diff --git a/PyYAML.spec b/PyYAML.spec index 8cb2438..ead210f 100644 --- a/PyYAML.spec +++ b/PyYAML.spec @@ -1,5 +1,5 @@ Name: PyYAML -Version: 6.0.3 +Version: 6.0.1 Release: %autorelease Summary: YAML parser and emitter for Python @@ -8,10 +8,13 @@ License: MIT URL: https://github.com/yaml/pyyaml Source: https://github.com/yaml/pyyaml/archive/%{version}.tar.gz +# Fix build with Cython 3 +# Proposed upstream but refused (upstream does not want Cython 3) +Patch: https://github.com/yaml/pyyaml/pull/731.patch + BuildRequires: gcc BuildRequires: libyaml-devel BuildRequires: python3-devel -BuildRequires: python3-pytest %global _description\ @@ -45,6 +48,9 @@ chmod a-x examples/yaml-highlight/yaml_hl.py # remove pre-generated file rm -rf ext/_yaml.c +# we have a patch for Cython 3 +sed -i 's/Cython<3.0/Cython/' pyproject.toml + %generate_buildrequires %pyproject_buildrequires @@ -60,7 +66,7 @@ rm -rf ext/_yaml.c %check -%pytest +%{py3_test_envvars} %{python3} tests/lib/test_all.py %files -n python3-pyyaml -f %{pyproject_files} diff --git a/plan.fmf b/plan.fmf deleted file mode 100644 index e6427de..0000000 --- a/plan.fmf +++ /dev/null @@ -1,4 +0,0 @@ -discover: - how: fmf -execute: - how: tmt diff --git a/sources b/sources index b7b81fd..e041a66 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (6.0.3.tar.gz) = a0da43e32d127409ad61b11dc1d733b2e9c743977b3d72c05c81fc2ab183b40bc284452b0874dbeae1a736e1cd4a34f0df641ceefd5e9df38b3e53155fc5f633 +SHA512 (6.0.1.tar.gz) = 1c74a92a4ad7d47854dc7bcb2e89b3c8e0b14fa815c7dbfbc22b24480dbba6c81e971c77ee384c494a960914b95f06edf943d7431925a5ed674a0ba830d258e0 diff --git a/tests/smoke/main.fmf b/tests/smoke/main.fmf deleted file mode 100644 index 7d9c513..0000000 --- a/tests/smoke/main.fmf +++ /dev/null @@ -1,5 +0,0 @@ -test: ./runtest.sh -framework: beakerlib -require: - - python3-pyyaml -duration: 5m diff --git a/tests/smoke/pyyaml_dump.py b/tests/smoke/pyyaml_dump.py deleted file mode 100644 index a6f4a6d..0000000 --- a/tests/smoke/pyyaml_dump.py +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env python -import yaml -print(yaml.dump({'name': 'Silenthand Olleander', 'race': 'Human', 'traits': ['ONE_HAND', 'ONE_EYE']})) diff --git a/tests/smoke/pyyaml_load.py b/tests/smoke/pyyaml_load.py deleted file mode 100644 index 6bf48f2..0000000 --- a/tests/smoke/pyyaml_load.py +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env python -import yaml -documents = """ ---- -name: foo ---- -name: bar ---- -name: foobar -""" - -for data in yaml.load_all(documents, Loader=yaml.SafeLoader): - print(data) diff --git a/tests/smoke/pyyaml_object.py b/tests/smoke/pyyaml_object.py deleted file mode 100644 index b689c05..0000000 --- a/tests/smoke/pyyaml_object.py +++ /dev/null @@ -1,24 +0,0 @@ -import yaml -class Hero: - def __init__(self, name, hp, sp): - self.name = name - self.hp = hp - self.sp = sp - def __repr__(self): - return "%s(name=%r, hp=%r, sp=%r)" % ( - self.__class__.__name__, self.name, self.hp, self.sp) - -STRING = """ -!!python/object:__main__.Hero -name: Welthyr Syxgon -hp: 1200 -sp: 0 -""" - -try: - yaml.load(STRING, Loader=yaml.SafeLoader) - raise RuntimeError("Didn't raise exception") -except yaml.constructor.ConstructorError: - pass - -print(yaml.unsafe_load(STRING)) diff --git a/tests/smoke/pyyaml_parse.py b/tests/smoke/pyyaml_parse.py deleted file mode 100644 index 3850b78..0000000 --- a/tests/smoke/pyyaml_parse.py +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env python -import yaml -document = """ - a: 1 - b: - c: 3 - d: 4 -""" -print(yaml.dump(yaml.load(document, Loader=yaml.SafeLoader))) diff --git a/tests/smoke/runtest.sh b/tests/smoke/runtest.sh deleted file mode 100755 index 72451ed..0000000 --- a/tests/smoke/runtest.sh +++ /dev/null @@ -1,74 +0,0 @@ -#!/bin/bash -# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# runtest.sh of /CoreOS/PyYAML/Sanity/Smoke -# Description: Smoke test for this component -# Author: Stepan Sigut -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Copyright (c) 2016 Red Hat, Inc. -# -# This program is free software: you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation, either version 2 of -# the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be -# useful, but WITHOUT ANY WARRANTY; without even the implied -# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -# PURPOSE. See the GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see http://www.gnu.org/licenses/. -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -# Include Beaker environment -. /usr/share/beakerlib/beakerlib.sh || exit 1 - -PYTHON=${PYTHON:-"python3"} - -PATTERN1="{'name': 'foo'} -{'name': 'bar'} -{'name': 'foobar'}" -PATTERN3="name: Silenthand Olleander -race: Human -traits: [ONE_HAND, ONE_EYE]" -PATTERN4="a: 1 -b: {c: 3, d: 4}" -PATTERN5="Hero(name='Welthyr Syxgon', hp=1200, sp=0)" - -set -o pipefail - -rlJournalStart - rlPhaseStartSetup - # export python's MAJOR and MINOR version - rlRun "export $($PYTHON -c \ - 'import sys; print("MAJOR={0} MINOR={1}".format(\ - sys.version_info[0],sys.version_info[1]))')" - rlPhaseEnd - - rlPhaseStartTest "Running pyyaml_load.py" - rlRun -s "$PYTHON pyyaml_load.py" - rlAssertGrep "$PATTERN1" "$rlRun_LOG" - rlPhaseEnd - - rlPhaseStartTest "Running pyyaml_dump.py" - rlRun -s "$PYTHON pyyaml_dump.py" - rlAssertGrep "$PATTERN3" "$rlRun_LOG" - rlPhaseEnd - - rlPhaseStartTest "Running pyyaml_parse.py" - rlRun -s "$PYTHON pyyaml_parse.py" - rlAssertGrep "$PATTERN4" "$rlRun_LOG" - rlPhaseEnd - - rlPhaseStartTest "Running pyyaml_object.py" - rlRun -s "$PYTHON pyyaml_object.py" - rlAssertGrep "$PATTERN5" "$rlRun_LOG" - rlPhaseEnd - -rlJournalPrintText -rlJournalEnd