dev-python/parse: version bump (including EAPI bump and py-3.5 support)

Package-Manager: portage-2.3.0
This commit is contained in:
Tiziano Müller
2016-09-09 14:33:01 +02:00
parent e4736e6634
commit d72614043d
3 changed files with 77 additions and 0 deletions

View File

@@ -1 +1,2 @@
DIST parse-1.6.4.tar.gz 24025 SHA256 a7cccad221632f1e2553d585b428b20d362738311e6f58933ef46b4389c16054 SHA512 2848e3331f1b2604bb5f1a8a0084ff0b7e0f12b2d3832395461f4b76729637783250d18a134048106ffa6768794f38fc51534dbe5a88db303f0426530587dcee WHIRLPOOL 2c3b91ec933ac206aaf2c2201b3108bb291a448f458d79aa2e6db5cdee676e05c200f1bf60f3f9810161e126c7ae4633efe498276fb2d1b270b10ebc4ca2047c
DIST parse-1.6.6.tar.gz 24638 SHA256 71435aaac494e08cec76de646de2aab8392c114e56fe3f81c565ecc7eb886178 SHA512 fae467b6f6e35f04d9e501162117423506701d101b2265e941b5b34420e833a0f4dbc44f62c33d51836a62ef51da9b5b8a3a1d39b3ec490f9eb77c5b6f302cdf WHIRLPOOL c206590ebea8f6b2ef552b0911b83c692a50b0dc395ac76e392a2b4eb16e8c544411da7b7475956183de3d189e6cc27b87752c0aa991dc5e7587e854eea6953c

View File

@@ -0,0 +1,50 @@
From 32f15cfefb7c7b6476360ac65cba807aa3dfccfa Mon Sep 17 00:00:00 2001
From: David King <dking@redhat.com>
Date: Mon, 14 Dec 2015 09:58:19 +0000
Subject: [PATCH] Fix test_too_many_fields with Python 3.5
Python versions before 3.5 had a limit of 100 groups in regular
expressions. This limit was removed during 3.5 development:
http://bugs.python.org/issue22437
https://hg.python.org/cpython/rev/0b85ea4bd1af
The test_too_many_fields test asserts that the limit exists by
attempting to parse a string with 15 fields, which triggers the 100
named groups limit.
Adjust the test so that if first checks to see whether the limit of 100
named groups exists, and only assert that parsing 15 fields fails if
that is the case.
---
test_parse.py | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/test_parse.py b/test_parse.py
index c524349..1d50568 100755
--- a/test_parse.py
+++ b/test_parse.py
@@ -6,6 +6,7 @@
import unittest
from datetime import datetime, time
+import re
import parse
@@ -624,8 +625,13 @@ def test_mixed_type_variant(self):
self.assertEqual(r.fixed[21], 'spam')
def test_too_many_fields(self):
- p = parse.compile('{:ti}' * 15)
- self.assertRaises(parse.TooManyFields, p.parse, '')
+ # Python 3.5 removed the limit of 100 named groups in a regular expression,
+ # so only test for the exception if the limit exists.
+ try:
+ re.compile("".join("(?P<n{n}>{n}-)".format(n=i) for i in range(101)))
+ except AssertionError:
+ p = parse.compile('{:ti}' * 15)
+ self.assertRaises(parse.TooManyFields, p.parse, '')
class TestSearch(unittest.TestCase):

View File

@@ -0,0 +1,26 @@
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
EAPI=6
PYTHON_COMPAT=( python2_7 python3_{4,5} )
inherit distutils-r1
DESCRIPTION="parse() is the opposite of format()"
HOMEPAGE="https://github.com/r1chardj0n3s/parse"
SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
LICENSE="BSD"
SLOT="0"
KEYWORDS="~amd64"
IUSE=""
DEPEND=""
RDEPEND=""
PATCHES=( "${FILESDIR}/${P}-python-3.5-tests-compat.patch" )
python_test() {
"${PYTHON}" test_parse.py || die "Tests failed under ${EPYTHON}"
}