Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/tappy/, dev-python/tappy/files/
Date: Thu, 23 Apr 2020 11:23:51
Message-Id: 1587641012.3a78d40a6fc15db6326c1c5d36cbed78860dc7ec.mgorny@gentoo
1 commit: 3a78d40a6fc15db6326c1c5d36cbed78860dc7ec
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Thu Apr 23 11:12:54 2020 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Thu Apr 23 11:23:32 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3a78d40a
7
8 dev-python/tappy: Fix pyyaml usage
9
10 Closes: https://bugs.gentoo.org/701158
11 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
12
13 dev-python/tappy/files/tappy-2.4-yaml.patch | 61 ++++++++++++++++++++++
14 .../{tappy-2.4.ebuild => tappy-2.4-r1.ebuild} | 13 +++--
15 2 files changed, 67 insertions(+), 7 deletions(-)
16
17 diff --git a/dev-python/tappy/files/tappy-2.4-yaml.patch b/dev-python/tappy/files/tappy-2.4-yaml.patch
18 new file mode 100644
19 index 00000000000..dee5055ec2f
20 --- /dev/null
21 +++ b/dev-python/tappy/files/tappy-2.4-yaml.patch
22 @@ -0,0 +1,61 @@
23 +From 62205d0bb2427016938e00fe8e53aed7a947a20d Mon Sep 17 00:00:00 2001
24 +From: Matt Layman <matthewlayman@×××××.com>
25 +Date: Sat, 14 Dec 2019 21:20:22 -0500
26 +Subject: [PATCH] Use PyYAML safe loader and remove deprecation warning. (#103)
27 +
28 +Fixes #102
29 +---
30 + tap/line.py | 2 +-
31 + tap/tests/test_parser.py | 6 +++---
32 + 2 files changed, 4 insertions(+), 4 deletions(-)
33 +
34 +(mgorny: rebased for 2.4 and included test fixes that are part
35 + of irrelevant commit upstream)
36 +
37 +diff --git a/tap/line.py b/tap/line.py
38 +index 352bc1b..c4d0ca6 100644
39 +--- a/tap/line.py
40 ++++ b/tap/line.py
41 +@@ -88,7 +88,7 @@ class Result(Line):
42 + """
43 + if LOAD_YAML and self._yaml_block is not None:
44 + try:
45 +- yaml_dict = yaml.load(self._yaml_block)
46 ++ yaml_dict = yaml.load(self._yaml_block, Loader=yaml.SafeLoader)
47 + return yaml_dict
48 + except yaml.error.YAMLError:
49 + print('Error parsing yaml block. Check formatting.')
50 +diff --git a/tap/tests/test_parser.py b/tap/tests/test_parser.py
51 +index 4e919d1..1e78039 100644
52 +--- a/tap/tests/test_parser.py
53 ++++ b/tap/tests/test_parser.py
54 +@@ -235,7 +235,7 @@ class TestParser(unittest.TestCase):
55 + try:
56 + import yaml
57 + from more_itertools import peekable # noqa
58 +- converted_yaml = yaml.load(u"""test: sample yaml""")
59 ++ converted_yaml = yaml.safe_load(u"""test: sample yaml""")
60 + self.assertEqual(4, len(lines))
61 + self.assertEqual(13, lines[0].version)
62 + self.assertEqual(converted_yaml, lines[2].yaml_block)
63 +@@ -265,7 +265,7 @@ class TestParser(unittest.TestCase):
64 + try:
65 + import yaml
66 + from more_itertools import peekable # noqa
67 +- converted_yaml = yaml.load(u"""test: sample yaml""")
68 ++ converted_yaml = yaml.safe_load(u"""test: sample yaml""")
69 + self.assertEqual(4, len(lines))
70 + self.assertEqual(13, lines[0].version)
71 + self.assertEqual(converted_yaml, lines[2].yaml_block)
72 +@@ -300,7 +300,7 @@ class TestParser(unittest.TestCase):
73 + try:
74 + import yaml
75 + from more_itertools import peekable # noqa
76 +- converted_yaml = yaml.load(u"""
77 ++ converted_yaml = yaml.safe_load(u"""
78 + message: test
79 + severity: fail
80 + data:
81 +--
82 +2.26.2
83 +
84
85 diff --git a/dev-python/tappy/tappy-2.4.ebuild b/dev-python/tappy/tappy-2.4-r1.ebuild
86 similarity index 83%
87 rename from dev-python/tappy/tappy-2.4.ebuild
88 rename to dev-python/tappy/tappy-2.4-r1.ebuild
89 index 7cffc97077f..31c7271620f 100644
90 --- a/dev-python/tappy/tappy-2.4.ebuild
91 +++ b/dev-python/tappy/tappy-2.4-r1.ebuild
92 @@ -10,12 +10,12 @@ MY_PN=tap.py
93 DESCRIPTION="Test Anything Protocol (TAP) tools"
94 HOMEPAGE="https://github.com/python-tap/tappy https://pypi.org/project/tap.py/"
95 SRC_URI="mirror://pypi/${MY_PN::1}/${MY_PN}/${MY_PN}-${PV}.tar.gz"
96 +S=${WORKDIR}/${MY_PN}-${PV}
97
98 LICENSE="BSD-2"
99 SLOT="0"
100 KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 sparc ~x86"
101 -IUSE="test yaml"
102 -RESTRICT="!test? ( test )"
103 +IUSE="yaml"
104
105 RDEPEND="dev-python/setuptools[${PYTHON_USEDEP}]
106 yaml? (
107 @@ -23,7 +23,6 @@ RDEPEND="dev-python/setuptools[${PYTHON_USEDEP}]
108 dev-python/pyyaml[${PYTHON_USEDEP}]
109 )"
110 DEPEND="dev-python/Babel[${PYTHON_USEDEP}]
111 - dev-python/setuptools[${PYTHON_USEDEP}]
112 test? (
113 dev-python/more-itertools[${PYTHON_USEDEP}]
114 dev-python/pyyaml[${PYTHON_USEDEP}]
115 @@ -32,8 +31,8 @@ DEPEND="dev-python/Babel[${PYTHON_USEDEP}]
116 ' -2)
117 )"
118
119 -S=${WORKDIR}/${MY_PN}-${PV}
120 +distutils_enable_tests unittest
121
122 -python_test() {
123 - "${EPYTHON}" -m unittest discover -v || die "Tests fail with ${EPYTHON}"
124 -}
125 +PATCHES=(
126 + "${FILESDIR}"/${P}-yaml.patch
127 +)