[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
02/03: gnu: python-babel: Fix build.
From: |
guix-commits |
Subject: |
02/03: gnu: python-babel: Fix build. |
Date: |
Sun, 18 Oct 2020 12:30:48 -0400 (EDT) |
apteryx pushed a commit to branch core-updates
in repository guix.
commit d238188969b2ee827d966e79901a6b1fa364cd56
Author: Maxim Cournoyer <maxim.cournoyer@gmail.com>
AuthorDate: Sun Oct 18 09:27:20 2020 -0400
gnu: python-babel: Fix build.
* gnu/packages/patches/python-babel-fix-parse-future-test.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register it.
* gnu/packages/python-xyz.scm (python-babel): Use it.
---
gnu/local.mk | 1 +
.../python-babel-fix-parse-future-test.patch | 68 ++++++++++++++++++++++
gnu/packages/python-xyz.scm | 3 +-
3 files changed, 71 insertions(+), 1 deletion(-)
diff --git a/gnu/local.mk b/gnu/local.mk
index 8c93e19..a5f9039 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1475,6 +1475,7 @@ dist_patch_DATA =
\
%D%/packages/patches/python-aionotify-0.2.0-py3.8.patch \
%D%/packages/patches/python-argcomplete-1.11.1-fish31.patch \
%D%/packages/patches/python-axolotl-AES-fix.patch \
+ %D%/packages/patches/python-babel-fix-parse-future-test.patch \
%D%/packages/patches/python-cairocffi-dlopen-path.patch \
%D%/packages/patches/python-cross-compile.patch \
%D%/packages/patches/python2-larch-coverage-4.0a6-compatibility.patch \
diff --git a/gnu/packages/patches/python-babel-fix-parse-future-test.patch
b/gnu/packages/patches/python-babel-fix-parse-future-test.patch
new file mode 100644
index 0000000..8a90166
--- /dev/null
+++ b/gnu/packages/patches/python-babel-fix-parse-future-test.patch
@@ -0,0 +1,68 @@
+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'))
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 3e66e5a..30ef4fc 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -631,7 +631,8 @@ by @code{binstar}, @code{binstar-build}, and
@code{chalmers}.")
(uri (pypi-uri "Babel" version))
(sha256
(base32
- "0f0f2vvs1mpdpz2c0mg1mnc3sih8bizmc1h9m67kdsnqs3i2mb0s"))))
+ "0f0f2vvs1mpdpz2c0mg1mnc3sih8bizmc1h9m67kdsnqs3i2mb0s"))
+ (patches (search-patches "python-babel-fix-parse-future-test.patch"))))
(build-system python-build-system)
(native-inputs
`(("python-freezegun" ,python-freezegun)