From 5ba3e2feeff1f7222ee7a1e28111e6ead2347cfb Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Tue, 18 May 2021 13:42:20 +0000 Subject: [PATCH] import python-ruamel-yaml-0.15.100-1.el8 --- .gitignore | 2 +- .python-ruamel-yaml.metadata | 2 +- SOURCES/bz-1951852-test.py | 37 ++++++++++++ SOURCES/python-ruamel-yaml-pathlib.patch | 68 +++++++++++++++-------- SOURCES/python-ruamel-yaml-pytest27.patch | 15 +++-- SPECS/python-ruamel-yaml.spec | 21 +++++-- 6 files changed, 107 insertions(+), 38 deletions(-) create mode 100644 SOURCES/bz-1951852-test.py diff --git a/.gitignore b/.gitignore index 9ac8e48..8cd8d64 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -SOURCES/ruamel-yaml-0.15.41.tar.gz +SOURCES/ruamel-yaml-code-af9628b0d0479c35a60efc44b8d6dff9dc95aed2.zip diff --git a/.python-ruamel-yaml.metadata b/.python-ruamel-yaml.metadata index b6aad49..89c2abe 100644 --- a/.python-ruamel-yaml.metadata +++ b/.python-ruamel-yaml.metadata @@ -1 +1 @@ -d463529d6ebf589603129637c0dc5f01b4767aac SOURCES/ruamel-yaml-0.15.41.tar.gz +3ae1a7a253c3002766de4bd060e1d8d2b29e568f SOURCES/ruamel-yaml-code-af9628b0d0479c35a60efc44b8d6dff9dc95aed2.zip diff --git a/SOURCES/bz-1951852-test.py b/SOURCES/bz-1951852-test.py new file mode 100644 index 0000000..0287df2 --- /dev/null +++ b/SOURCES/bz-1951852-test.py @@ -0,0 +1,37 @@ +import io +import sys +import ruamel.yaml +from ruamel.yaml import YAML + +ruamel_yaml = YAML(typ="rt") +ruamel_yaml.default_flow_style = False +ruamel_yaml.preserve_quotes = True +ruamel_yaml.width = 1024 + +buf = """\ +# top level +top: + # next level 1 + - { here: 1, there: 2 } + # next level 2 + - { there: 1, here: 2 } +top2: + # next level 1-2 + - { here: 11, there: 22 } + # next level 2-2 + - { there: 11, here: 22 } +""" + +if len(sys.argv) > 1: + buf = open(sys.argv[1]).read() +ruamel_data = ruamel_yaml.load(buf) +ruamel_yaml.indent(mapping=2, sequence=4, offset=2) +outf = io.StringIO() +ruamel_yaml.dump(ruamel_data, outf) +buf = outf.getvalue() +print(buf) +ruamel_data = ruamel_yaml.load(buf) +outf = io.StringIO() +ruamel_yaml.dump(ruamel_data, outf) +buf = outf.getvalue() +print(buf) diff --git a/SOURCES/python-ruamel-yaml-pathlib.patch b/SOURCES/python-ruamel-yaml-pathlib.patch index 6cf8156..e18fff8 100644 --- a/SOURCES/python-ruamel-yaml-pathlib.patch +++ b/SOURCES/python-ruamel-yaml-pathlib.patch @@ -1,27 +1,23 @@ -diff --git a/_doc/conf.py b/_doc/conf.py -index 19a19a3..a2b852d 100644 ---- a/_doc/conf.py -+++ b/_doc/conf.py -@@ -68,7 +68,10 @@ print('ruamel.yaml version', version) +--- ruamel-yaml-code-af9628b0d0479c35a60efc44b8d6dff9dc95aed2/_doc/conf.py.orig 2021-04-20 17:11:58.090894727 -0600 ++++ ruamel-yaml-code-af9628b0d0479c35a60efc44b8d6dff9dc95aed2/_doc/conf.py 2021-04-20 17:13:38.946521358 -0600 +@@ -75,7 +75,10 @@ class ryd2rst: + if False: + try: + from ryd.__main__ import RYDCmd +- from ruamel.std.pathlib import Path ++ try: ++ from pathlib import Path ++ except ImportError: ++ from pathlib2 import Path - try: - from ryd.__main__ import RYDCmd -- from ruamel.std.pathlib import Path -+ try: -+ from pathlib import Path -+ except ImportError: -+ from pathlib2 import Path - oldargv = sys.argv - for fn in Path('.').glob('*.ryd'): - sys.argv = ['ryd', 'convert', '--no-pdf', str(fn)] -diff --git a/_test/test_api_change.py b/_test/test_api_change.py -index c0f492c..0b3f2d7 100644 ---- a/_test/test_api_change.py -+++ b/_test/test_api_change.py -@@ -11,7 +11,10 @@ import textwrap + oldargv = sys.argv + for fn in Path('.').glob('*.ryd'): +--- ruamel-yaml-code-af9628b0d0479c35a60efc44b8d6dff9dc95aed2/_test/test_api_change.py.orig 2021-04-20 17:12:13.434990060 -0600 ++++ ruamel-yaml-code-af9628b0d0479c35a60efc44b8d6dff9dc95aed2/_test/test_api_change.py 2021-04-20 17:13:58.317641717 -0600 +@@ -9,7 +9,10 @@ testing of anchors and the aliases refer + import sys + import textwrap import pytest - from ruamel.yaml import YAML - from ruamel.yaml.constructor import DuplicateKeyError -from ruamel.std.pathlib import Path +try: + from pathlib import Path @@ -30,3 +26,31 @@ index c0f492c..0b3f2d7 100644 class TestNewAPI: +--- ruamel-yaml-code-af9628b0d0479c35a60efc44b8d6dff9dc95aed2/_test/roundtrip.py.orig 2021-04-20 17:25:36.621971457 -0600 ++++ ruamel-yaml-code-af9628b0d0479c35a60efc44b8d6dff9dc95aed2/_test/roundtrip.py 2021-04-20 17:26:47.303408002 -0600 +@@ -7,7 +7,10 @@ helper routines for testing round trip o + """ + import sys + import textwrap +-from ruamel.std.pathlib import Path ++try: ++ from pathlib import Path ++except ImportError: ++ from pathlib2 import Path + + enforce = object() + +--- ruamel-yaml-code-af9628b0d0479c35a60efc44b8d6dff9dc95aed2/_test/test_z_data.py.orig 2021-04-20 17:26:30.851306390 -0600 ++++ ruamel-yaml-code-af9628b0d0479c35a60efc44b8d6dff9dc95aed2/_test/test_z_data.py 2021-04-20 17:26:40.850368147 -0600 +@@ -6,7 +6,10 @@ import sys + import pytest # NOQA + import warnings # NOQA + +-from ruamel.std.pathlib import Path ++try: ++ from pathlib import Path ++except ImportError: ++ from pathlib2 import Path + + base_path = Path('data') # that is ruamel.yaml.data + PY2 = sys.version_info[0] == 2 diff --git a/SOURCES/python-ruamel-yaml-pytest27.patch b/SOURCES/python-ruamel-yaml-pytest27.patch index 816ccb7..ef7d17a 100644 --- a/SOURCES/python-ruamel-yaml-pytest27.patch +++ b/SOURCES/python-ruamel-yaml-pytest27.patch @@ -1,7 +1,6 @@ -diff -up ruamel-yaml-171c3653fc01/_test/test_anchor.py.pytest27 ruamel-yaml-171c3653fc01/_test/test_anchor.py ---- ruamel-yaml-171c3653fc01/_test/test_anchor.py.pytest27 2016-09-21 02:09:18.000000000 -0600 -+++ ruamel-yaml-171c3653fc01/_test/test_anchor.py 2017-01-31 15:25:09.245847125 -0700 -@@ -5,6 +5,7 @@ testing of anchors and the aliases refer +--- ruamel-yaml-code-af9628b0d0479c35a60efc44b8d6dff9dc95aed2/_test/test_anchor.py.orig 2021-04-20 17:09:14.371877519 -0600 ++++ ruamel-yaml-code-af9628b0d0479c35a60efc44b8d6dff9dc95aed2/_test/test_anchor.py 2021-04-20 17:09:45.359070044 -0600 +@@ -7,6 +7,7 @@ testing of anchors and the aliases refer """ import pytest @@ -9,11 +8,11 @@ diff -up ruamel-yaml-171c3653fc01/_test/test_anchor.py.pytest27 ruamel-yaml-171c from textwrap import dedent import platform -@@ -231,6 +232,7 @@ class TestAnchorsAliases: - """) +@@ -248,6 +249,7 @@ class TestAnchorsAliases: + ) # this is an error in PyYAML + @pytest.mark.skipif(LooseVersion(pytest.__version__) < LooseVersion("2.8"), reason="Need pytest 2.7") def test_reused_anchor(self): - yaml = ''' - - &a + from ruamel.yaml.error import ReusedAnchorWarning + diff --git a/SPECS/python-ruamel-yaml.spec b/SPECS/python-ruamel-yaml.spec index 78af3e1..adee591 100644 --- a/SPECS/python-ruamel-yaml.spec +++ b/SPECS/python-ruamel-yaml.spec @@ -1,18 +1,22 @@ %global pypi_name ruamel.yaml %global pname ruamel-yaml -%global commit 75b1b39341d9 +%global commit af9628b0d0479c35a60efc44b8d6dff9dc95aed2 Name: python-%{pname} -Version: 0.15.41 -Release: 5%{?dist} +Version: 0.15.100 +Release: 1%{?dist} Summary: YAML 1.2 loader/dumper package for Python License: MIT -URL: https://bitbucket.org/ruamel/yaml +URL: https://sourceforge.net/projects/ruamel-yaml/ #Source0: https://files.pythonhosted.org/packages/source/r/%{pypi_name}/%{pypi_name}-%{version}.tar.gz # Use bitbucket sources so we can run the tests -Source0: https://bitbucket.org/ruamel/yaml/get/%{version}.tar.gz#/%{pname}-%{version}.tar.gz +#Source0: https://bitbucket.org/ruamel/yaml/get/%{version}.tar.gz#/%{pname}-%{version}.tar.gz +# moved to sourceforge +Source0: https://sourceforge.net/code-snapshots/hg/r/ru/%{pname}/code/%{pname}-code-%{commit}.zip +Source1: bz-1951852-test.py + # Works with pytest 2.7 Patch0: python-ruamel-yaml-pytest27.patch @@ -48,7 +52,7 @@ ruamel.yaml is a YAML 1.2 loader/dumper package for Python. It is a derivative of Kirill Simonov’s PyYAML 3.11 %prep -%autosetup -n %{pname}-%{commit} -p1 +%autosetup -n %{pname}-code-%{commit} -p1 rm -rf %{pypi_name}.egg-info %build @@ -59,6 +63,7 @@ rm -rf %{pypi_name}.egg-info %check PYTHONPATH=$(echo build/lib.*%{python3_version}) py.test-%{python3_version} _test/test_*.py +PYTHONPATH=$(echo build/lib.*%{python3_version}) %{__python3} %{SOURCE1} %files -n python%{python3_pkgversion}-%{pname} %license LICENSE @@ -69,6 +74,10 @@ PYTHONPATH=$(echo build/lib.*%{python3_version}) py.test-%{python3_version} _tes %{python3_sitearch}/%{pypi_name}-%{version}-py?.?.egg-info %changelog +* Tue Apr 20 2021 Rich Megginson - 0.15.100-1 +- Resolves: rhbz#1951852 + error converting lists with embedded comments + * Mon Nov 23 2020 Pavel Cahyna - 0.15.41-5 - Rebuild after adding to RHEL buildrood and configuring CI gating