summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2020-04-23 13:12:54 +0200
committerMichał Górny <mgorny@gentoo.org>2020-04-23 13:23:32 +0200
commit3a78d40a6fc15db6326c1c5d36cbed78860dc7ec (patch)
tree35b810f6b1512ead65e10d5ded0ff7d6eeb15771 /dev-python/tappy
parentnet-dns/rbldnsd: amd64 stable wrt bug #718622 (diff)
downloadgentoo-3a78d40a6fc15db6326c1c5d36cbed78860dc7ec.tar.gz
gentoo-3a78d40a6fc15db6326c1c5d36cbed78860dc7ec.tar.bz2
gentoo-3a78d40a6fc15db6326c1c5d36cbed78860dc7ec.zip
dev-python/tappy: Fix pyyaml usage
Closes: https://bugs.gentoo.org/701158 Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'dev-python/tappy')
-rw-r--r--dev-python/tappy/files/tappy-2.4-yaml.patch61
-rw-r--r--dev-python/tappy/tappy-2.4-r1.ebuild (renamed from dev-python/tappy/tappy-2.4.ebuild)13
2 files changed, 67 insertions, 7 deletions
diff --git a/dev-python/tappy/files/tappy-2.4-yaml.patch b/dev-python/tappy/files/tappy-2.4-yaml.patch
new file mode 100644
index 000000000000..dee5055ec2f1
--- /dev/null
+++ b/dev-python/tappy/files/tappy-2.4-yaml.patch
@@ -0,0 +1,61 @@
+From 62205d0bb2427016938e00fe8e53aed7a947a20d Mon Sep 17 00:00:00 2001
+From: Matt Layman <matthewlayman@gmail.com>
+Date: Sat, 14 Dec 2019 21:20:22 -0500
+Subject: [PATCH] Use PyYAML safe loader and remove deprecation warning. (#103)
+
+Fixes #102
+---
+ tap/line.py | 2 +-
+ tap/tests/test_parser.py | 6 +++---
+ 2 files changed, 4 insertions(+), 4 deletions(-)
+
+(mgorny: rebased for 2.4 and included test fixes that are part
+ of irrelevant commit upstream)
+
+diff --git a/tap/line.py b/tap/line.py
+index 352bc1b..c4d0ca6 100644
+--- a/tap/line.py
++++ b/tap/line.py
+@@ -88,7 +88,7 @@ class Result(Line):
+ """
+ if LOAD_YAML and self._yaml_block is not None:
+ try:
+- yaml_dict = yaml.load(self._yaml_block)
++ yaml_dict = yaml.load(self._yaml_block, Loader=yaml.SafeLoader)
+ return yaml_dict
+ except yaml.error.YAMLError:
+ print('Error parsing yaml block. Check formatting.')
+diff --git a/tap/tests/test_parser.py b/tap/tests/test_parser.py
+index 4e919d1..1e78039 100644
+--- a/tap/tests/test_parser.py
++++ b/tap/tests/test_parser.py
+@@ -235,7 +235,7 @@ class TestParser(unittest.TestCase):
+ try:
+ import yaml
+ from more_itertools import peekable # noqa
+- converted_yaml = yaml.load(u"""test: sample yaml""")
++ converted_yaml = yaml.safe_load(u"""test: sample yaml""")
+ self.assertEqual(4, len(lines))
+ self.assertEqual(13, lines[0].version)
+ self.assertEqual(converted_yaml, lines[2].yaml_block)
+@@ -265,7 +265,7 @@ class TestParser(unittest.TestCase):
+ try:
+ import yaml
+ from more_itertools import peekable # noqa
+- converted_yaml = yaml.load(u"""test: sample yaml""")
++ converted_yaml = yaml.safe_load(u"""test: sample yaml""")
+ self.assertEqual(4, len(lines))
+ self.assertEqual(13, lines[0].version)
+ self.assertEqual(converted_yaml, lines[2].yaml_block)
+@@ -300,7 +300,7 @@ class TestParser(unittest.TestCase):
+ try:
+ import yaml
+ from more_itertools import peekable # noqa
+- converted_yaml = yaml.load(u"""
++ converted_yaml = yaml.safe_load(u"""
+ message: test
+ severity: fail
+ data:
+--
+2.26.2
+
diff --git a/dev-python/tappy/tappy-2.4.ebuild b/dev-python/tappy/tappy-2.4-r1.ebuild
index 7cffc97077fc..31c7271620f1 100644
--- a/dev-python/tappy/tappy-2.4.ebuild
+++ b/dev-python/tappy/tappy-2.4-r1.ebuild
@@ -10,12 +10,12 @@ MY_PN=tap.py
DESCRIPTION="Test Anything Protocol (TAP) tools"
HOMEPAGE="https://github.com/python-tap/tappy https://pypi.org/project/tap.py/"
SRC_URI="mirror://pypi/${MY_PN::1}/${MY_PN}/${MY_PN}-${PV}.tar.gz"
+S=${WORKDIR}/${MY_PN}-${PV}
LICENSE="BSD-2"
SLOT="0"
KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 sparc ~x86"
-IUSE="test yaml"
-RESTRICT="!test? ( test )"
+IUSE="yaml"
RDEPEND="dev-python/setuptools[${PYTHON_USEDEP}]
yaml? (
@@ -23,7 +23,6 @@ RDEPEND="dev-python/setuptools[${PYTHON_USEDEP}]
dev-python/pyyaml[${PYTHON_USEDEP}]
)"
DEPEND="dev-python/Babel[${PYTHON_USEDEP}]
- dev-python/setuptools[${PYTHON_USEDEP}]
test? (
dev-python/more-itertools[${PYTHON_USEDEP}]
dev-python/pyyaml[${PYTHON_USEDEP}]
@@ -32,8 +31,8 @@ DEPEND="dev-python/Babel[${PYTHON_USEDEP}]
' -2)
)"
-S=${WORKDIR}/${MY_PN}-${PV}
+distutils_enable_tests unittest
-python_test() {
- "${EPYTHON}" -m unittest discover -v || die "Tests fail with ${EPYTHON}"
-}
+PATCHES=(
+ "${FILESDIR}"/${P}-yaml.patch
+)