summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBritney Fransen <brfransen@gmail.com>2020-11-15 22:08:16 (GMT)
committerBritney Fransen <brfransen@gmail.com>2020-11-15 22:08:16 (GMT)
commit035983c13af8aa5d37a1aa4676b884e9cab73776 (patch)
treea8a21d7d4202f2ab5b57b446535fdf2373c9c7f7
parent629d75f0af7313a2cd2d47d0fa61ce731997479e (diff)
downloadlinhes_pkgbuild-035983c13af8aa5d37a1aa4676b884e9cab73776.zip
linhes_pkgbuild-035983c13af8aa5d37a1aa4676b884e9cab73776.tar.gz
linhes_pkgbuild-035983c13af8aa5d37a1aa4676b884e9cab73776.tar.bz2
python-babel: 2.8.1
-rw-r--r--abs/core/python_modules/python-babel/PKGBUILD54
-rw-r--r--abs/core/python_modules/python-babel/python-3.9.patch202
2 files changed, 226 insertions, 30 deletions
diff --git a/abs/core/python_modules/python-babel/PKGBUILD b/abs/core/python_modules/python-babel/PKGBUILD
index fcbdc4b..1b144f7 100644
--- a/abs/core/python_modules/python-babel/PKGBUILD
+++ b/abs/core/python_modules/python-babel/PKGBUILD
@@ -1,54 +1,48 @@
-# $Id$
# Maintainer: Morten Linderud <foxboron@archlinux.no>
# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
# Contributor : Giedrius Slavinskas <giedrius25@gmail.com>
-pkgbase=python-babel
-pkgname=(python-babel python2-babel)
-pkgver=2.5.3
-pkgrel=4
+pkgname=python-babel
+pkgver=2.8.1
+_core=36
+pkgrel=2
pkgdesc="A collection of tools for internationalizing Python applications"
url="http://babel.pocoo.org/"
license=("BSD")
arch=('any')
-makedepends=('python' 'python2'
- 'python-setuptools' 'python2-setuptools'
- 'python-pytz' 'python2-pytz')
-noextract=("core-28.zip")
-source=("$pkgbase-$pkgver.tar.gz::https://github.com/python-babel/babel/archive/v$pkgver.tar.gz"
- "core-29.zip::http://unicode.org/Public/cldr/29/core.zip")
-sha256sums=('4c231f28875552abe18c6c10829cec0884d7eeb27423b562357250dc32090cb9'
- 'b3308f8d3b4a80045ce4262b2784ac8d99775e80aaacafbf1277833f6b28ffda')
+depends=('python' 'python-pytz')
+makedepends=('python-setuptools')
+checkdepends=('python-pytest' 'python-pytest-runner' 'python-freezegun')
+noextract=("cldr-core-$_core.zip")
+source=("$pkgname-$pkgver.tar.gz::https://github.com/python-babel/babel/archive/v$pkgver.tar.gz"
+ "cldr-core-$_core.zip::http://unicode.org/Public/cldr/$_core/core.zip"
+ "python-3.9.patch")
+sha256sums=('2324e41ffb439a83748813e54718574c094222bb32996d466958a7a3d6c23a47'
+ '07279e56c1f4266d140b907ef3ec379dce0a99542303a9628562ac5fe460ba43'
+ '13adbc61cf0c59f215f38cd5b1a4dc3c29f2e35c9e9d054f64a9f03308401b0a')
prepare() {
- cp -a babel-$pkgver{,-py2}
- cp "$srcdir"/core-29.zip babel-$pkgver-py2/cldr/
- cp "$srcdir"/core-29.zip babel-$pkgver/cldr/
+ # Python 3.9 fixes
+ patch -Np1 -d babel-$pkgver <python-3.9.patch
+
+ cp "$srcdir"/cldr-core-$_core.zip babel-$pkgver/cldr/cldr-core-$_core.zip
}
build(){
cd "$srcdir/babel-$pkgver"
python setup.py import_cldr
python setup.py build
+}
- cd "$srcdir/babel-$pkgver-py2"
- python2 setup.py import_cldr
- python2 setup.py build
+check(){
+ cd "$srcdir/babel-$pkgver"
+ # the tests fail if running in the wrong timezone:
+ # https://github.com/python-babel/babel/issues/757
+ TZ=UTC python setup.py pytest
}
package_python-babel() {
- depends=('python' 'python-pytz')
-
cd "$srcdir"/babel-${pkgver}
python setup.py install --root="$pkgdir" --optimize=1 --skip-build
install -D -m0644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}
-
-package_python2-babel() {
- depends=('python2' 'python2-pytz')
-
- cd "$srcdir"/babel-${pkgver}-py2
- python2 setup.py install --root="$pkgdir" --optimize=1 --skip-build
- mv "$pkgdir"/usr/bin/pybabel "$pkgdir"/usr/bin/pybabel2
- install -D -m0644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
-}
diff --git a/abs/core/python_modules/python-babel/python-3.9.patch b/abs/core/python_modules/python-babel/python-3.9.patch
new file mode 100644
index 0000000..676c682
--- /dev/null
+++ b/abs/core/python_modules/python-babel/python-3.9.patch
@@ -0,0 +1,202 @@
+From 4fa749b918810b52a63b312d82e4003e24db0406 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
+Date: Mon, 6 Jan 2020 00:37:39 +0100
+Subject: [PATCH] Replace usage of parser.suite with ast.parse
+
+Replaced usage of the long-superseded "parser.suite" module in the
+mako.util package for parsing the python magic encoding comment with the
+"ast.parse" function introduced many years ago in Python 2.5, as
+"parser.suite" is emitting deprecation warnings in Python 3.9.
+
+Fixes https://github.com/sqlalchemy/mako/issues/310
+See also https://github.com/sqlalchemy/mako/commit/2dae7d2c3da73653e6de329dc15c55056a0b9ab6
+---
+ babel/util.py | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/babel/util.py b/babel/util.py
+index 73a90516..c371badb 100644
+--- a/babel/util.py
++++ b/babel/util.py
+@@ -68,8 +68,8 @@ def parse_encoding(fp):
+ m = PYTHON_MAGIC_COMMENT_re.match(line1)
+ if not m:
+ try:
+- import parser
+- parser.suite(line1.decode('latin-1'))
++ import ast
++ ast.parse(line1.decode('latin-1'))
+ except (ImportError, SyntaxError, UnicodeEncodeError):
+ # Either it's a real syntax error, in which case the source is
+ # not valid python source, or line2 is a continuation of line1,
+
+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'))