diff --git a/babel-fix-integers-for-future-flags.patch b/babel-fix-integers-for-future-flags.patch new file mode 100644 index 0000000000000000000000000000000000000000..df10081ac71796f16ba610f6e380e51259e434f6 --- /dev/null +++ b/babel-fix-integers-for-future-flags.patch @@ -0,0 +1,68 @@ +From f3651bebd3216cc276f7642c3807cc8d08f2bd23 Mon Sep 17 00:00:00 2001 +From: Felix Schwarz +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')) diff --git a/babel.spec b/babel.spec index b0110f2bad505b64c50e325b0d5b79532bd9c4de..02ca320a6f3be6b8ad38f4acc027f9bbd9041cf7 100644 --- a/babel.spec +++ b/babel.spec @@ -1,6 +1,6 @@ Name: babel Version: 2.8.0 -Release: 3 +Release: 4 Summary: Tools for internationalizing and localizing Python applications License: BSD URL: http://babel.pocoo.org/ @@ -12,11 +12,11 @@ Patch4: catalog.rst-Add-__iter__-to-Catalog-documentation.patch Patch5: stop-using-deprecated-ElementTree-methods-getchildre.patch Patch6: backport-0001-CVE-2021-20095-Run-locale-identifiers-through-os.path.basename.patch Patch7: backport-0002-CVE-2021-20095-Disallow-special-filenames-on-Windows.patch +Patch8: babel-fix-integers-for-future-flags.patch BuildArch: noarch BuildRequires: gcc git make -BuildRequires: python2-devel python2-setuptools python2-pytz python2-pytest python2-freezegun BuildRequires: python3-devel python3-setuptools python3-pytz python3-pytest python3-freezegun python3-sphinx Requires: python3-babel python3-setuptools @@ -25,15 +25,6 @@ Requires: python3-babel python3-setuptools Babel is an integrated collection of utilities that assist in internationalizing and localizing Python applications, with an emphasis on web-based applications. -%package -n python2-babel -Summary: Library for internationalizing Python applications -Requires: python2-setuptools -Requires: python2-pytz - -%description -n python2-babel -Babel is an integrated collection of utilities that assist in internationalizing and -localizing Python applications, with an emphasis on web-based applications. - %package -n python3-babel Summary: Library for internationalizing Python applications Requires: python3-setuptools @@ -46,10 +37,8 @@ localizing Python applications, with an emphasis on web-based applications. %package help Summary: Documentation for Babel Provides: python-babel-doc = %{version}-%{release} -Provides: python2-babel-doc = %{version}-%{release} Provides: python3-babel-doc = %{version}-%{release} Provides: babel-doc -Obsoletes: babel-doc %description help Documentation for Babel @@ -58,26 +47,23 @@ Documentation for Babel %autosetup -n Babel-%{version} -p1 -Sgit %build -%py2_build %py3_build BUILDDIR="$PWD/built-docs" rm -rf "$BUILDDIR" pushd docs make \ - SPHINXBUILD=sphinx-build-3 \ + SPHINXBUILD=sphinx-build \ BUILDDIR="$BUILDDIR" \ html popd rm -f "$BUILDDIR/html/.buildinfo" %install -%py2_install %py3_install %check export TZ=Asia/Shanghai -%{__python2} -m pytest %{__python3} -m pytest %pre @@ -93,10 +79,6 @@ export TZ=Asia/Shanghai %license LICENSE %{_bindir}/pybabel -%files -n python2-babel -%{python2_sitelib}/Babel-%{version}-py*.egg-info -%{python2_sitelib}/babel - %files -n python3-babel %{python3_sitelib}/Babel-%{version}-py*.egg-info %{python3_sitelib}/babel @@ -105,6 +87,9 @@ export TZ=Asia/Shanghai %doc built-docs/html/* %changelog +* Wed Jan 26 2022 zhangy1317 - 2.8.0-4 +- Remove python2 and fix tests when using Python 3.9 + * Tue May 11 2021 yangzhuangzhuang - 2.8.0-3 - Fix CVE-2021-20095