summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dev-python/configobj/Manifest1
-rw-r--r--dev-python/configobj/configobj-5.0.6-r1.ebuild25
-rw-r--r--dev-python/configobj/files/configobj-5.0.6-fix-py2-tests.patch55
3 files changed, 81 insertions, 0 deletions
diff --git a/dev-python/configobj/Manifest b/dev-python/configobj/Manifest
index 09a7a68b348..a606bd2e893 100644
--- a/dev-python/configobj/Manifest
+++ b/dev-python/configobj/Manifest
@@ -1 +1,2 @@
+DIST configobj-5.0.6.gh.tar.gz 143664 BLAKE2B b554d0aec903aecb55387a0164cd6f8d442e9fc1ab231ce7f7123e7a5041e07a86f5f7bf70492ca93fcdc1bd3caa5b855c427f060842e3b4a7524afbcc417a76 SHA512 326eb86e362f281ebf07abcb1cf7616abb270c482eafe842371cda8708245ca5e8262f1644b7164664ecc10e9004ed061c9de18cd233a657d4697dbc3ba3c59d
DIST configobj-5.0.6.tar.gz 33248 BLAKE2B b58a22fdf247f1c3022108e24abb4de55620ce75f6aeb5f269f008a5668e07b8c1d0c49e4059d7f4c4c361d269ead39c3784377635c7718f92c2381e69c56cb5 SHA512 f253fdd0bc3fcd37f56c9ceb28f5c8c739b0861e099b07a3929645907c97b2261f0529850a95c1a42507846f72d88a0992fcd1e1d6fa8654dc713d120f769963
diff --git a/dev-python/configobj/configobj-5.0.6-r1.ebuild b/dev-python/configobj/configobj-5.0.6-r1.ebuild
new file mode 100644
index 00000000000..469eee85be8
--- /dev/null
+++ b/dev-python/configobj/configobj-5.0.6-r1.ebuild
@@ -0,0 +1,25 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python2_7 python3_{6,7,8,9} )
+DISTUTILS_USE_SETUPTOOLS=no
+
+inherit distutils-r1
+
+DESCRIPTION="Simple config file reader and writer"
+HOMEPAGE="http://www.voidspace.org.uk/python/configobj.html https://pypi.org/project/configobj/"
+SRC_URI="https://github.com/DiffSK/${PN}/archive/v${PV}.tar.gz -> ${P}.gh.tar.gz"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+
+RDEPEND="dev-python/six[${PYTHON_USEDEP}]"
+
+PATCHES=( "${FILESDIR}/${P}-fix-py2-tests.patch" )
+
+python_test() {
+ "${EPYTHON}" validate.py -v || die "Tests fail with ${EPYTHON}"
+}
diff --git a/dev-python/configobj/files/configobj-5.0.6-fix-py2-tests.patch b/dev-python/configobj/files/configobj-5.0.6-fix-py2-tests.patch
new file mode 100644
index 00000000000..5ac64a256cb
--- /dev/null
+++ b/dev-python/configobj/files/configobj-5.0.6-fix-py2-tests.patch
@@ -0,0 +1,55 @@
+Upstream: https://github.com/DiffSK/configobj/commit/e2731538d1a37a5b67a6e518848be6a8988043ae
+
+diff --git a/tests/test_validate.py b/tests/test_validate.py
+index bffb0dc..4eed7e9 100644
+--- a/tests/test_validate.py
++++ b/tests/test_validate.py
+@@ -161,3 +161,26 @@ class TestBasic(object):
+ 'test3': 3,
+ 'test4': 6.0
+ }}}
++
++
++class TestDottedQuadToNum(object):
++
++ def test_stripped(self):
++ assert dottedQuadToNum('192.0.2.0') == 3221225984
++ assert dottedQuadToNum('192.0.2.1 ') == 3221225985
++ assert dottedQuadToNum(' 192.0.2.2') == 3221225986
++ assert dottedQuadToNum('\t\t192.0.2.3\n') == 3221225987
++ with pytest.raises(ValueError) as excinfo:
++ dottedQuadToNum('192. 0. 2. 4')
++ assert str(excinfo.value) == 'Not a good dotted-quad IP: 192. 0. 2. 4'
++
++ def test_boundaries(self):
++ assert dottedQuadToNum('0.0.0.0') == 0
++ assert dottedQuadToNum('255.255.255.255') == 4294967295
++ with pytest.raises(ValueError) as excinfo:
++ dottedQuadToNum('255.255.255.256')
++ assert str(excinfo.value) == (
++ 'Not a good dotted-quad IP: 255.255.255.256')
++ with pytest.raises(ValueError) as excinfo:
++ dottedQuadToNum('-1')
++ assert str(excinfo.value) == 'Not a good dotted-quad IP: -1'
+diff --git a/validate.py b/validate.py
+index b7a964c..9d8c94d 100644
+--- a/validate.py
++++ b/validate.py
+@@ -277,17 +277,8 @@ def dottedQuadToNum(ip):
+
+ >>> int(dottedQuadToNum('1 '))
+ 1
+- >>> int(dottedQuadToNum(' 1.2'))
+- 16777218
+- >>> int(dottedQuadToNum(' 1.2.3 '))
+- 16908291
+ >>> int(dottedQuadToNum('1.2.3.4'))
+ 16909060
+- >>> dottedQuadToNum('255.255.255.255')
+- 4294967295
+- >>> dottedQuadToNum('255.255.255.256')
+- Traceback (most recent call last):
+- ValueError: Not a good dotted-quad IP: 255.255.255.256
+ """
+
+ # import here to avoid it when ip_addr values are not used