diff --git a/.fmf/version b/.fmf/version new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/.fmf/version @@ -0,0 +1 @@ +1 diff --git a/.gitignore b/.gitignore index e3fb872..e28cffa 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ -/*.tar.gz +/*.tar.xz /*.zip diff --git a/plans/ci.fmf b/plans/ci.fmf new file mode 100644 index 0000000..d890aec --- /dev/null +++ b/plans/ci.fmf @@ -0,0 +1,6 @@ +summary: Run CI tests +discover: + how: fmf +execute: + how: tmt + diff --git a/python-ruamel-yaml.spec b/python-ruamel-yaml.spec index 4d24128..93c571e 100644 --- a/python-ruamel-yaml.spec +++ b/python-ruamel-yaml.spec @@ -1,10 +1,8 @@ # Breaks the circular dependency with ruamel.yaml.clib. %bcond_with bootstrap -%global commit 6f41eb6001661917fceb0e88ed0693ae1a7c50f4 - Name: python-ruamel-yaml -Version: 0.18.6 +Version: 0.19.1 Release: %autorelease Summary: YAML 1.2 loader/dumper package for Python @@ -12,7 +10,7 @@ Summary: YAML 1.2 loader/dumper package for Python License: MIT URL: https://sourceforge.net/projects/ruamel-yaml # The PyPI sdist does not contain tests, so we use a snapshot from SourceForge -Source: https://sourceforge.net/code-snapshots/hg/r/ru/ruamel-yaml/code/ruamel-yaml-code-%{commit}.zip +Source: https://yaml.dev/ruamel-dl-tagged-releases/ruamel.yaml-%{version}.tar.xz BuildArch: noarch @@ -30,20 +28,19 @@ BuildRequires: python3-pytest %py_provides python3-ruamel.yaml +%if !%{with bootstrap} +# ruamel.yaml.clibz is not available in Fedora (and probably never will +# be), so require the old clib backend +Requires: python3-ruamel-yaml+oldlibyaml = %{version}-%{release} +%endif + %description -n python3-ruamel-yaml %{_description} %prep -%autosetup -n ruamel-yaml-code-%{commit} -# Upstream upper-bounds the Python interpeter versions with which the C -# implementation (ruamel.yaml.clib dependency) may be used. Patch this out. -sed -r -i 's/( and python_version<"[^"]+")(.*ruamel\.yaml\.clib)/\2/' \ - __init__.py -%if %{with bootstrap} -sed -r -i 's/^([[:blank:]]*)(.*ruamel\.yaml\.clib)/\1# \2/' __init__.py -%endif +%autosetup -n ruamel.yaml-%{version} %generate_buildrequires -%pyproject_buildrequires +%pyproject_buildrequires %{!?with_bootstrap:-x oldlibyaml} %build %pyproject_wheel @@ -65,5 +62,7 @@ k="${k-}${k+ and }not test_dump_cyaml_1_2" %files -n python3-ruamel-yaml -f %{pyproject_files} %doc README.md +%pyproject_extras_subpkg -n python3-ruamel-yaml oldlibyaml + %changelog %autochangelog diff --git a/sources b/sources index f52e86d..f0e723c 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (ruamel-yaml-code-6f41eb6001661917fceb0e88ed0693ae1a7c50f4.zip) = 49fc9ef87e59b723803659300a8dc2c33d596bc2e1effa5235f26cf51fb08c0e6e0d2c386d54c290f97d63dc2a8956802a02c90e4a52881a2cd5d38daf1b0318 +SHA512 (ruamel.yaml-0.19.1.tar.xz) = bf9eb8e40f506d6f3f34aee5f5ec74eb93bfda2b27022f6ad62dfac724b9e0847d61e3159d284bada7dec147992aaf509804f7139818de5bc85aa328bc32601f diff --git a/tests/main.fmf b/tests/main.fmf new file mode 100644 index 0000000..1cfafe2 --- /dev/null +++ b/tests/main.fmf @@ -0,0 +1 @@ +component: python-ruamel-yaml diff --git a/tests/sf534/main.fmf b/tests/sf534/main.fmf new file mode 100644 index 0000000..5480ac5 --- /dev/null +++ b/tests/sf534/main.fmf @@ -0,0 +1,5 @@ +summary: Regression test for upstream ticket 534 +require: python3-ruamel-yaml +link: + - verifies: https://sourceforge.net/p/ruamel-yaml/tickets/534/ +test: python3 test.py diff --git a/tests/sf534/test.py b/tests/sf534/test.py new file mode 100644 index 0000000..8302605 --- /dev/null +++ b/tests/sf534/test.py @@ -0,0 +1,32 @@ +# Taken from https://sourceforge.net/p/ruamel-yaml/tickets/534/ + +from io import StringIO +from ruamel.yaml import YAML + +original = '0: foo\n' +py_original = {0: 'foo'} +prefix = '%YAML 1.1\n---\n' + +yaml = YAML() +yaml.version = (1, 1) + +loaded = yaml.load(original) +assert loaded == py_original + +print('Fresh') +stream = StringIO() +yaml.dump(py_original, stream) +fresh = stream.getvalue() +print(fresh) +assert fresh.startswith(prefix) +trimmed = fresh[len(prefix):] +assert trimmed == original, f"{trimmed!r} != {original!r}" + +print('Round trip') +stream = StringIO() +yaml.dump(loaded, stream) +round_tripped = stream.getvalue() +print(round_tripped) +assert round_tripped.startswith(prefix) +trimmed = round_tripped[len(prefix):] +assert trimmed == original, f"{trimmed!r} != {original!r}"