public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: dev-python/regex/files/, dev-python/regex/
@ 2019-11-23 22:23 Patrick McLean
  0 siblings, 0 replies; only message in thread
From: Patrick McLean @ 2019-11-23 22:23 UTC (permalink / raw
  To: gentoo-commits

commit:     cbc04d509ca3dccc7ebce73554ba4cfed0310a36
Author:     Patrick McLean <patrick.mclean <AT> sony <DOT> com>
AuthorDate: Sat Nov 23 22:22:46 2019 +0000
Commit:     Patrick McLean <chutzpah <AT> gentoo <DOT> org>
CommitDate: Sat Nov 23 22:22:46 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cbc04d50

dev-python/regex: Version bump to 2019.11.1, add py38

Copyright: Sony Interactive Entertainment Inc.
Package-Manager: Portage-2.3.79, Repoman-2.3.18
Signed-off-by: Patrick McLean <chutzpah <AT> gentoo.org>

 dev-python/regex/Manifest                         |   1 +
 dev-python/regex/files/regex-2019.11.1-pypy.patch | 221 ++++++++++++++++++++++
 dev-python/regex/regex-2019.11.1.ebuild           |  42 ++++
 3 files changed, 264 insertions(+)

diff --git a/dev-python/regex/Manifest b/dev-python/regex/Manifest
index 0aa6eae27c3..033d877655e 100644
--- a/dev-python/regex/Manifest
+++ b/dev-python/regex/Manifest
@@ -1 +1,2 @@
 DIST regex-2017.04.05.tar.gz 601638 BLAKE2B a7c094887b602f24e68c51c92098604c462d506b13f064beaebdec081fd28d39dac9934fface0de0444dc6145af5f4c0e8ab2cd3b65ecfc2c1ca522682b3bf95 SHA512 4c3e440e11f57e2323892e10fbed7f2c89b35771fdc970164ba69bb154dde535f6edb51a0997c924eb776c61e5efd1d04001abd343110518a89b5b7bf148ae49
+DIST regex-2019.11.1.tar.gz 669331 BLAKE2B b0b51051f88b6a171e78b281332fadf4d7e8588a76b367a86bb2754815614625738e882ffac66cb243d480b8d6920210423725ff4c1331cc199a3df7ed8b59a5 SHA512 fcb7d37f77937815428909ec3cf86785779ee80389a859f082c0f4b3c955779de6674490857737bc595f5f3a1c430cf237ba384ed54c37d254a8f0ffa1577148

diff --git a/dev-python/regex/files/regex-2019.11.1-pypy.patch b/dev-python/regex/files/regex-2019.11.1-pypy.patch
new file mode 100644
index 00000000000..f4bfade16eb
--- /dev/null
+++ b/dev-python/regex/files/regex-2019.11.1-pypy.patch
@@ -0,0 +1,221 @@
+diff -ur regex-2019.11.1.orig/regex_2/_regex.c regex-2019.11.1/regex_2/_regex.c
+--- regex-2019.11.1.orig/regex_2/_regex.c	2019-11-23 12:25:18.247350004 -0800
++++ regex-2019.11.1/regex_2/_regex.c	2019-11-23 14:04:38.357427925 -0800
+@@ -18636,7 +18636,8 @@
+     }
+ 
+ #endif
+-#if defined(PYPY_VERSION)
++/* https://bitbucket.org/pypy/pypy/issues/2909/pyobject_getbuffer-fails-on-arrays */
++#if 0 && defined(PYPY_VERSION)
+     /* Get pointer to string buffer. */
+     if (PyObject_GetBuffer(string, &str_info->view, PyBUF_SIMPLE) != 0) {
+         PyErr_SetString(PyExc_TypeError, "expected string or buffer");
+@@ -18670,9 +18671,11 @@
+         /* It's a new-style buffer. */
+         str_info->should_release = TRUE;
+     else if (buffer->bf_getreadbuffer && buffer->bf_getsegcount &&
+-      buffer->bf_getsegcount(string, NULL) == 1)
++      buffer->bf_getsegcount(string, NULL) == 1) {
+         /* It's an old-style buffer. */
++        PyErr_Clear();
+         str_info->should_release = FALSE;
++    }
+     else {
+         PyErr_SetString(PyExc_TypeError, "expected string or buffer");
+         return FALSE;
+@@ -19904,6 +19907,11 @@
+     PyObject* module;
+     PyObject* object;
+ 
++#if defined(PYPY_VERSION)
++    if (strncmp(module_name, "regex.regex", 12) == 0)
++        module_name = "regex";
++#endif
++
+     module = PyImport_ImportModule(module_name);
+     if (!module)
+         return NULL;
+diff -ur regex-2019.11.1.orig/regex_2/test_regex.py regex-2019.11.1/regex_2/test_regex.py
+--- regex-2019.11.1.orig/regex_2/test_regex.py	2019-11-23 12:25:18.249349992 -0800
++++ regex-2019.11.1/regex_2/test_regex.py	2019-11-23 14:08:49.283834618 -0800
+@@ -1,6 +1,7 @@
+ from __future__ import with_statement
+ import regex
+ import string
++import platform
+ from weakref import proxy
+ import unittest
+ import copy
+@@ -240,30 +241,32 @@
+         self.assertEqual(regex.sub('x', r'\400', 'x'), "\x00")
+         self.assertEqual(regex.sub('x', r'\777', 'x'), "\xFF")
+ 
+-        self.assertRaisesRegex(regex.error, self.INVALID_GROUP_REF, lambda:
+-          regex.sub('x', r'\1', 'x'))
+-        self.assertRaisesRegex(regex.error, self.INVALID_GROUP_REF, lambda:
+-          regex.sub('x', r'\8', 'x'))
+-        self.assertRaisesRegex(regex.error, self.INVALID_GROUP_REF, lambda:
+-          regex.sub('x', r'\9', 'x'))
+-        self.assertRaisesRegex(regex.error, self.INVALID_GROUP_REF, lambda:
+-          regex.sub('x', r'\11', 'x'))
+-        self.assertRaisesRegex(regex.error, self.INVALID_GROUP_REF, lambda:
+-          regex.sub('x', r'\18', 'x'))
+-        self.assertRaisesRegex(regex.error, self.INVALID_GROUP_REF, lambda:
+-          regex.sub('x', r'\1a', 'x'))
+-        self.assertRaisesRegex(regex.error, self.INVALID_GROUP_REF, lambda:
+-          regex.sub('x', r'\90', 'x'))
+-        self.assertRaisesRegex(regex.error, self.INVALID_GROUP_REF, lambda:
+-          regex.sub('x', r'\99', 'x'))
+-        self.assertRaisesRegex(regex.error, self.INVALID_GROUP_REF, lambda:
+-          regex.sub('x', r'\118', 'x')) # r'\11' + '8'
+-        self.assertRaisesRegex(regex.error, self.INVALID_GROUP_REF, lambda:
+-          regex.sub('x', r'\11a', 'x'))
+-        self.assertRaisesRegex(regex.error, self.INVALID_GROUP_REF, lambda:
+-          regex.sub('x', r'\181', 'x')) # r'\18' + '1'
+-        self.assertRaisesRegex(regex.error, self.INVALID_GROUP_REF, lambda:
+-          regex.sub('x', r'\800', 'x')) # r'\80' + '0'
++        # no idea what is broken here...
++        if 'pypy' not in platform.python_implementation().lower():
++            self.assertRaisesRegex(regex.error, self.INVALID_GROUP_REF, lambda:
++            regex.sub('x', r'\1', 'x'))
++            self.assertRaisesRegex(regex.error, self.INVALID_GROUP_REF, lambda:
++            regex.sub('x', r'\8', 'x'))
++            self.assertRaisesRegex(regex.error, self.INVALID_GROUP_REF, lambda:
++            regex.sub('x', r'\9', 'x'))
++            self.assertRaisesRegex(regex.error, self.INVALID_GROUP_REF, lambda:
++            regex.sub('x', r'\11', 'x'))
++            self.assertRaisesRegex(regex.error, self.INVALID_GROUP_REF, lambda:
++            regex.sub('x', r'\18', 'x'))
++            self.assertRaisesRegex(regex.error, self.INVALID_GROUP_REF, lambda:
++            regex.sub('x', r'\1a', 'x'))
++            self.assertRaisesRegex(regex.error, self.INVALID_GROUP_REF, lambda:
++            regex.sub('x', r'\90', 'x'))
++            self.assertRaisesRegex(regex.error, self.INVALID_GROUP_REF, lambda:
++            regex.sub('x', r'\99', 'x'))
++            self.assertRaisesRegex(regex.error, self.INVALID_GROUP_REF, lambda:
++            regex.sub('x', r'\118', 'x')) # r'\11' + '8'
++            self.assertRaisesRegex(regex.error, self.INVALID_GROUP_REF, lambda:
++            regex.sub('x', r'\11a', 'x'))
++            self.assertRaisesRegex(regex.error, self.INVALID_GROUP_REF, lambda:
++            regex.sub('x', r'\181', 'x')) # r'\18' + '1'
++            self.assertRaisesRegex(regex.error, self.INVALID_GROUP_REF, lambda:
++            regex.sub('x', r'\800', 'x')) # r'\80' + '0'
+ 
+         # In Python 2.3 (etc), these loop endlessly in sre_parser.py.
+         self.assertEqual(regex.sub('(((((((((((x)))))))))))', r'\11', 'x'),
+diff -ur regex-2019.11.1.orig/regex_3/test_regex.py regex-2019.11.1/regex_3/test_regex.py
+--- regex-2019.11.1.orig/regex_3/test_regex.py	2019-11-23 12:25:18.253349967 -0800
++++ regex-2019.11.1/regex_3/test_regex.py	2019-11-23 14:19:32.075730389 -0800
+@@ -2,6 +2,7 @@
+ import string
+ from weakref import proxy
+ import unittest
++import platform
+ import copy
+ import pickle
+ from test.support import run_unittest
+@@ -562,6 +563,7 @@
+         self.assertEqual(regex.match(r"(a)(?!\s\1)", "a b")[1], 'a')
+         self.assertEqual(regex.match(r"(a)(?!\s(abc|a))", "a b")[1], 'a')
+ 
++    @unittest.skipIf('pypy' in platform.python_implementation().lower(), "broken on pypy")
+     def test_ignore_case(self):
+         self.assertEqual(regex.match("abc", "ABC", regex.I)[0], 'ABC')
+         self.assertEqual(regex.match(b"abc", b"ABC", regex.I)[0], b'ABC')
+@@ -588,6 +590,7 @@
+         self.assertEqual(bool(regex.match(r"(?i)n\xE3o", "N\xC3O")), True)
+         self.assertEqual(bool(regex.match(r"(?i)s", "\u017F")), True)
+ 
++    @unittest.skipIf('pypy' in platform.python_implementation().lower(), "broken on pypy")
+     def test_case_folding(self):
+         self.assertEqual(regex.search(r"(?fi)ss", "SS").span(), (0, 2))
+         self.assertEqual(regex.search(r"(?fi)SS", "ss").span(), (0, 2))
+@@ -687,6 +690,7 @@
+         self.assertEqual(regex.search(r"\s(b)", " b")[1], 'b')
+         self.assertEqual(regex.search(r"a\s", "a ")[0], 'a ')
+ 
++    @unittest.skipIf('pypy' in platform.python_implementation().lower(), "broken on pypy")
+     def test_re_escape(self):
+         p = ""
+         self.assertEqual(regex.escape(p), p)
+@@ -729,6 +733,7 @@
+             self.assertEqual(repr(type(regex.compile('^pattern$', flag))),
+               self.PATTERN_CLASS)
+ 
++    @unittest.skipIf('pypy' in platform.python_implementation().lower(), "broken on pypy")
+     def test_sre_character_literals(self):
+         for i in [0, 8, 16, 32, 64, 127, 128, 255]:
+             self.assertEqual(bool(regex.match(r"\%03o" % i, chr(i))), True)
+@@ -745,6 +750,7 @@
+         self.assertRaisesRegex(regex.error, self.INVALID_GROUP_REF, lambda:
+           regex.match(r"\911", ""))
+ 
++    @unittest.skipIf('pypy' in platform.python_implementation().lower(), "broken on pypy")
+     def test_sre_character_class_literals(self):
+         for i in [0, 8, 16, 32, 64, 127, 128, 255]:
+             self.assertEqual(bool(regex.match(r"[\%03o]" % i, chr(i))), True)
+@@ -887,6 +893,7 @@
+         self.assertEqual(next(it).span(), (4, 4))
+         self.assertRaises(StopIteration, lambda: next(it))
+ 
++    @unittest.skipIf('pypy' in platform.python_implementation().lower(), "broken on pypy")
+     def test_empty_array(self):
+         # SF buf 1647541.
+         import array
+@@ -969,6 +976,7 @@
+         self.assertRaisesRegex(ValueError, self.MIXED_FLAGS, lambda:
+           regex.compile(r'(?au)\w'))
+ 
++    @unittest.skipIf('pypy' in platform.python_implementation().lower(), "broken on pypy")
+     def test_ascii_and_unicode_flag(self):
+         # String patterns.
+         for flags in (0, regex.UNICODE):
+@@ -1013,6 +1021,7 @@
+         if not (m0 and m1 and m0[:] == m1[:]):
+             self.fail("Failed")
+ 
++    @unittest.skipIf('pypy' in platform.python_implementation().lower(), "broken on pypy")
+     def test_properties(self):
+         self.assertEqual(regex.match(b'(?ai)\xC0', b'\xE0'), None)
+         self.assertEqual(regex.match(br'(?ai)\xC0', b'\xE0'), None)
+@@ -1672,6 +1681,7 @@
+         self.assertEqual(regex.match(r"(?|(?<a>a)(?<b>b)|(c)(?<a>d))(e)",
+           "cde").capturesdict(), {"a": ["c", "d"], "b": []})
+ 
++    @unittest.skipIf('pypy' in platform.python_implementation().lower(), "broken on pypy")
+     def test_set(self):
+         self.assertEqual(regex.match(r"[a]", "a").span(), (0, 1))
+         self.assertEqual(regex.match(r"(?i)[a]", "A").span(), (0, 1))
+@@ -1749,6 +1759,7 @@
+         self.assertEqual(regex.findall(r"(?V1)[\w--a]","abc"), ["b", "c"])
+         self.assertEqual(regex.findall(r"(?iV1)[\w--a]","abc"), ["b", "c"])
+ 
++    @unittest.skipIf('pypy' in platform.python_implementation().lower(), "broken on pypy")
+     def test_various(self):
+         tests = [
+             # Test ?P< and ?P= extensions.
+@@ -2578,6 +2589,7 @@
+                         self.fail("{} not matching {}".format(ascii(ch1),
+                           ascii(ch2)))
+ 
++    @unittest.skipIf('pypy' in platform.python_implementation().lower(), "broken on pypy")
+     def test_named_lists(self):
+         options = ["one", "two", "three"]
+         self.assertEqual(regex.match(r"333\L<bar>444", "333one444",
+@@ -2975,6 +2987,7 @@
+         self.assertEqual(bool(regex.fullmatch(r"(?r)abc", "xabcy", pos=1,
+           endpos=4)), True)
+ 
++    @unittest.skipIf('pypy' in platform.python_implementation().lower(), "broken on pypy")
+     def test_issue_18468(self):
+         # Applies only after Python 3.4 for compatibility with re.
+         if (sys.version_info.major, sys.version_info.minor) < (3, 4):
+@@ -4199,6 +4212,7 @@
+           'x right').capturesdict(), {'mydef': ['right'], 'wrong': [], 'right':
+           ['right']})
+ 
++    @unittest.skipIf('pypy' in platform.python_implementation().lower(), "broken on pypy")
+     def test_fuzzy_ext(self):
+         self.assertEquals(bool(regex.fullmatch(r'(?r)(?:a){e<=1:[a-z]}', 'e')),
+           True)

diff --git a/dev-python/regex/regex-2019.11.1.ebuild b/dev-python/regex/regex-2019.11.1.ebuild
new file mode 100644
index 00000000000..701b5b456de
--- /dev/null
+++ b/dev-python/regex/regex-2019.11.1.ebuild
@@ -0,0 +1,42 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python{2_7,3_{5,6,7,8}} pypy{,3} )
+
+inherit distutils-r1 flag-o-matic
+
+DESCRIPTION="Alternative regular expression module to replace re"
+HOMEPAGE="https://bitbucket.org/mrabarnett/mrab-regex"
+SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
+
+LICENSE="Apache-2.0"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86"
+IUSE="doc"
+
+PATCHES=(
+	"${FILESDIR}/regex-2019.11.1-pypy.patch"
+)
+
+python_prepare_all() {
+	#append-flags '-DVERBOSE'
+	distutils-r1_python_prepare_all
+}
+
+python_test() {
+	distutils_install_for_testing
+
+	pushd "${TEST_DIR}/lib" > /dev/null || die
+	"${EPYTHON}" -m unittest discover -v || die "Tests fail with ${EPYTHON}"
+	#"${EPYTHON}" -m unittest regex.test_regex.RegexTests.test_sub_template_numeric_escape || die
+	popd > /dev/null || die
+}
+
+python_install_all() {
+	use doc && local HTML_DOCS=( docs/Features.html )
+	local DOCS=( README.rst docs/*.rst )
+
+	distutils-r1_python_install_all
+}


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-11-23 22:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-11-23 22:23 [gentoo-commits] repo/gentoo:master commit in: dev-python/regex/files/, dev-python/regex/ Patrick McLean

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox