add patch for compatibility with Python 3.9a6

This commit is contained in:
Felix Schwarz 2020-05-05 08:17:40 +00:00
parent 28a6b4ee28
commit c085291b31
2 changed files with 73 additions and 2 deletions

View File

@ -0,0 +1,66 @@
commit f3651bebd3216cc276f7642c3807cc8d08f2bd23
Author: Felix Schwarz <felix.schwarz@oss.schwarz.eu>
Date: Tue May 5 08:05:56 2020 +0000
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.
diff --git a/tests/test_util.py b/tests/test_util.py
index a6a4450..b9343aa 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._compat import BytesIO
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'))

View File

@ -22,12 +22,14 @@
Name: babel
Version: 2.8.0
Release: 2%{?dist}
Release: 3%{?dist}
Summary: Tools for internationalizing Python applications
License: BSD
URL: http://babel.pocoo.org/
Source0: https://files.pythonhosted.org/packages/source/B/%{srcname}/%{srcname}-%{version}.tar.gz
# https://github.com/python-babel/babel/pull/712
Patch0: babel-python39a6-compat.patch
BuildArch: noarch
@ -121,7 +123,7 @@ Documentation for Babel
%endif
%prep
%autosetup -n %{srcname}-%{version}
%autosetup -p1 -n %{srcname}-%{version}
%build
%if %{with python2}
@ -178,6 +180,9 @@ export TZ=America/New_York
%endif
%changelog
* Tue May 05 2020 Felix Schwarz <fschwarz@fedoraproject.org> - 2.8.0-3
- add patch for compatibility with Python 3.9a6
* Tue Jan 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.8.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild