public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/Babel/, dev-python/Babel/files/
Date: Sun, 31 May 2020 16:33:43 +0000 (UTC)	[thread overview]
Message-ID: <1590942815.d0d8b0b1036bbb5fcd6ef7a375adbd8f087bc0d0.mgorny@gentoo> (raw)

commit:     d0d8b0b1036bbb5fcd6ef7a375adbd8f087bc0d0
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun May 31 16:08:37 2020 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun May 31 16:33:35 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d0d8b0b1

dev-python/Babel: Port to py39, fix tests

Closes: https://bugs.gentoo.org/714854
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 dev-python/Babel/Babel-2.8.0-r1.ebuild        |  11 +-
 dev-python/Babel/files/Babel-2.8.0-py39.patch | 169 ++++++++++++++++++++++++++
 2 files changed, 179 insertions(+), 1 deletion(-)

diff --git a/dev-python/Babel/Babel-2.8.0-r1.ebuild b/dev-python/Babel/Babel-2.8.0-r1.ebuild
index f970db31cb9..8dc11d6ec29 100644
--- a/dev-python/Babel/Babel-2.8.0-r1.ebuild
+++ b/dev-python/Babel/Babel-2.8.0-r1.ebuild
@@ -3,7 +3,7 @@
 
 EAPI=7
 
-PYTHON_COMPAT=( pypy3 python{2_7,3_{6,7,8}} )
+PYTHON_COMPAT=( pypy3 python{2_7,3_{6..9}} )
 PYTHON_REQ_USE="threads(+)"
 DISTUTILS_USE_SETUPTOOLS=rdepend
 
@@ -24,3 +24,12 @@ DEPEND="${DEPEND}
 
 distutils_enable_sphinx docs
 distutils_enable_tests pytest
+
+PATCHES=(
+	"${FILESDIR}"/${P}-py39.patch
+)
+
+src_test() {
+	local -x TZ=UTC
+	distutils-r1_src_test
+}

diff --git a/dev-python/Babel/files/Babel-2.8.0-py39.patch b/dev-python/Babel/files/Babel-2.8.0-py39.patch
new file mode 100644
index 00000000000..efada9c1d08
--- /dev/null
+++ b/dev-python/Babel/files/Babel-2.8.0-py39.patch
@@ -0,0 +1,169 @@
+From 167b71421f113e2210e4deefef5020402492e5be Mon Sep 17 00:00:00 2001
+From: Felix Schwarz <felix.schwarz@oss.schwarz.eu>
+Date: Tue, 5 May 2020 09:58:01 +0200
+Subject: [PATCH] stop using deprecated ElementTree methods "getchildren()" and
+ "getiterator()"
+
+Both methods were removed in Python 3.9 as mentioned in the release notes:
+
+> Methods getchildren() and getiterator() of classes ElementTree and Element in
+> the ElementTree module have been removed. They were deprecated in Python 3.2.
+> Use iter(x) or list(x) instead of x.getchildren() and x.iter() or
+> list(x.iter()) instead of x.getiterator().
+---
+ scripts/import_cldr.py | 18 +++++++++---------
+ 1 file changed, 9 insertions(+), 9 deletions(-)
+
+diff --git a/scripts/import_cldr.py b/scripts/import_cldr.py
+index 8993b68e..2ed3af91 100755
+--- a/scripts/import_cldr.py
++++ b/scripts/import_cldr.py
+@@ -598,7 +598,7 @@ def parse_calendar_months(data, calendar):
+         for width in ctxt.findall('monthWidth'):
+             width_type = width.attrib['type']
+             widths = ctxts.setdefault(width_type, {})
+-            for elem in width.getiterator():
++            for elem in width.iter():
+                 if elem.tag == 'month':
+                     _import_type_text(widths, elem, int(elem.attrib['type']))
+                 elif elem.tag == 'alias':
+@@ -616,7 +616,7 @@ def parse_calendar_days(data, calendar):
+         for width in ctxt.findall('dayWidth'):
+             width_type = width.attrib['type']
+             widths = ctxts.setdefault(width_type, {})
+-            for elem in width.getiterator():
++            for elem in width.iter():
+                 if elem.tag == 'day':
+                     _import_type_text(widths, elem, weekdays[elem.attrib['type']])
+                 elif elem.tag == 'alias':
+@@ -634,7 +634,7 @@ def parse_calendar_quarters(data, calendar):
+         for width in ctxt.findall('quarterWidth'):
+             width_type = width.attrib['type']
+             widths = ctxts.setdefault(width_type, {})
+-            for elem in width.getiterator():
++            for elem in width.iter():
+                 if elem.tag == 'quarter':
+                     _import_type_text(widths, elem, int(elem.attrib['type']))
+                 elif elem.tag == 'alias':
+@@ -649,7 +649,7 @@ def parse_calendar_eras(data, calendar):
+     for width in calendar.findall('eras/*'):
+         width_type = NAME_MAP[width.tag]
+         widths = eras.setdefault(width_type, {})
+-        for elem in width.getiterator():
++        for elem in width.iter():
+             if elem.tag == 'era':
+                 _import_type_text(widths, elem, type=int(elem.attrib.get('type')))
+             elif elem.tag == 'alias':
+@@ -676,7 +676,7 @@ def parse_calendar_periods(data, calendar):
+ def parse_calendar_date_formats(data, calendar):
+     date_formats = data.setdefault('date_formats', {})
+     for format in calendar.findall('dateFormats'):
+-        for elem in format.getiterator():
++        for elem in format.iter():
+             if elem.tag == 'dateFormatLength':
+                 type = elem.attrib.get('type')
+                 if _should_skip_elem(elem, type, date_formats):
+@@ -696,7 +696,7 @@ def parse_calendar_date_formats(data, calendar):
+ def parse_calendar_time_formats(data, calendar):
+     time_formats = data.setdefault('time_formats', {})
+     for format in calendar.findall('timeFormats'):
+-        for elem in format.getiterator():
++        for elem in format.iter():
+             if elem.tag == 'timeFormatLength':
+                 type = elem.attrib.get('type')
+                 if _should_skip_elem(elem, type, time_formats):
+@@ -717,7 +717,7 @@ def parse_calendar_datetime_skeletons(data, calendar):
+     datetime_formats = data.setdefault('datetime_formats', {})
+     datetime_skeletons = data.setdefault('datetime_skeletons', {})
+     for format in calendar.findall('dateTimeFormats'):
+-        for elem in format.getiterator():
++        for elem in format.iter():
+             if elem.tag == 'dateTimeFormatLength':
+                 type = elem.attrib.get('type')
+                 if _should_skip_elem(elem, type, datetime_formats):
+@@ -880,7 +880,7 @@ def parse_interval_formats(data, tree):
+             interval_formats[None] = elem.text
+         elif elem.tag == "intervalFormatItem":
+             skel_data = interval_formats.setdefault(elem.attrib["id"], {})
+-            for item_sub in elem.getchildren():
++            for item_sub in elem:
+                 if item_sub.tag == "greatestDifference":
+                     skel_data[item_sub.attrib["id"]] = split_interval_pattern(item_sub.text)
+                 else:
+@@ -903,7 +903,7 @@ def parse_currency_formats(data, tree):
+                     type = '%s:%s' % (type, curr_length_type)
+                 if _should_skip_elem(elem, type, currency_formats):
+                     continue
+-                for child in elem.getiterator():
++                for child in elem.iter():
+                     if child.tag == 'alias':
+                         currency_formats[type] = Alias(
+                             _translate_alias(['currency_formats', elem.attrib['type']],
+From 7bdaa28a55e8d8228d5434effa4b1473ab7b3669 Mon Sep 17 00:00:00 2001
+From: Felix Schwarz <felix.schwarz@oss.schwarz.eu>
+Date: Tue, 5 May 2020 08:05:56 +0000
+Subject: [PATCH] fix tests when using Python 3.9a6
+
+In Python 3.9a6 integer values for future flags were changed to prevent
+collision with compiler flags. We need to retrieve these at runtime so
+the test suite works with Python <= 3.8 as well as Python 3.9.
+---
+ tests/test_util.py | 17 ++++++++++++-----
+ 1 file changed, 12 insertions(+), 5 deletions(-)
+
+diff --git a/tests/test_util.py b/tests/test_util.py
+index a6a4450c..b9343aaa 100644
+--- a/tests/test_util.py
++++ b/tests/test_util.py
+@@ -11,6 +11,7 @@
+ # individuals. For the exact contribution history, see the revision
+ # history and logs, available at http://babel.edgewall.org/log/.
+ 
++import __future__
+ import unittest
+ 
+ import pytest
+@@ -20,6 +21,12 @@
+ from babel.util import parse_future_flags
+ 
+ 
++class _FF:
++    division         = __future__.division.compiler_flag
++    print_function   = __future__.print_function.compiler_flag
++    with_statement   = __future__.with_statement.compiler_flag
++    unicode_literals = __future__.unicode_literals.compiler_flag
++
+ def test_distinct():
+     assert list(util.distinct([1, 2, 1, 3, 4, 4])) == [1, 2, 3, 4]
+     assert list(util.distinct('foobar')) == ['f', 'o', 'b', 'a', 'r']
+@@ -70,25 +77,25 @@ def test_parse_encoding_non_ascii():
+ from __future__ import print_function,
+     division, with_statement,
+     unicode_literals
+-''', 0x10000 | 0x2000 | 0x8000 | 0x20000),
++''', _FF.print_function | _FF.division | _FF.with_statement | _FF.unicode_literals),
+     ('''
+ from __future__ import print_function, division
+ print('hello')
+-''', 0x10000 | 0x2000),
++''', _FF.print_function | _FF.division),
+     ('''
+ from __future__ import print_function, division, unknown,,,,,
+ print 'hello'
+-''', 0x10000 | 0x2000),
++''', _FF.print_function | _FF.division),
+     ('''
+ from __future__ import (
+     print_function,
+     division)
+-''', 0x10000 | 0x2000),
++''', _FF.print_function | _FF.division),
+     ('''
+ from __future__ import \\
+     print_function, \\
+     division
+-''', 0x10000 | 0x2000),
++''', _FF.print_function | _FF.division),
+ ])
+ def test_parse_future(source, result):
+     fp = BytesIO(source.encode('latin-1'))


             reply	other threads:[~2020-05-31 16:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-31 16:33 Michał Górny [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-11-05 20:58 [gentoo-commits] repo/gentoo:master commit in: dev-python/Babel/, dev-python/Babel/files/ Michał Górny
2023-04-29 18:31 Michał Górny
2023-01-13 10:17 Sam James
2018-01-02 14:57 Michał Górny
2015-09-26 11:02 Justin Lecher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1590942815.d0d8b0b1036bbb5fcd6ef7a375adbd8f087bc0d0.mgorny@gentoo \
    --to=mgorny@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox