[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
01/03: gnu: python2: Fix build with newer Expat.
From: |
guix-commits |
Subject: |
01/03: gnu: python2: Fix build with newer Expat. |
Date: |
Mon, 27 Jun 2022 18:18:07 -0400 (EDT) |
mbakke pushed a commit to branch core-updates
in repository guix.
commit 0e691ae1004686fd0b53454d90c760c4fb3995e9
Author: Marius Bakke <marius@gnu.org>
AuthorDate: Tue Jun 28 00:06:37 2022 +0200
gnu: python2: Fix build with newer Expat.
* gnu/packages/patches/python-2.7-expat-compat.patch: New file.
* gnu/local.mk (dist_patch_DATA): Adjust accordingly.
* gnu/packages/python.scm (python-2.7)[source](patches): Add it.
---
gnu/local.mk | 1 +
gnu/packages/patches/python-2.7-expat-compat.patch | 59 ++++++++++++++++++++++
gnu/packages/python.scm | 1 +
3 files changed, 61 insertions(+)
diff --git a/gnu/local.mk b/gnu/local.mk
index d2617f771f..f28498126e 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1652,6 +1652,7 @@ dist_patch_DATA =
\
%D%/packages/patches/pyqt-configure.patch \
%D%/packages/patches/python-2-deterministic-build-info.patch \
%D%/packages/patches/python-2.7-adjust-tests.patch \
+ %D%/packages/patches/python-2.7-expat-compat.patch \
%D%/packages/patches/python-2.7-search-paths.patch \
%D%/packages/patches/python-2.7-site-prefixes.patch \
%D%/packages/patches/python-2.7-source-date-epoch.patch \
diff --git a/gnu/packages/patches/python-2.7-expat-compat.patch
b/gnu/packages/patches/python-2.7-expat-compat.patch
new file mode 100644
index 0000000000..9cbdf8bd6a
--- /dev/null
+++ b/gnu/packages/patches/python-2.7-expat-compat.patch
@@ -0,0 +1,59 @@
+Fix test failure with newer Expat:
+
+ https://bugs.python.org/issue46811
+
+This is a backport of this upstream commit:
+
+
https://github.com/python/cpython/commit/2cae93832f46b245847bdc252456ddf7742ef45e
+
+diff --git a/Lib/test/test_minidom.py b/Lib/test/test_minidom.py
+index 2eb642395b..1793f9365d 100644
+--- a/Lib/test/test_minidom.py
++++ b/Lib/test/test_minidom.py
+@@ -6,12 +6,14 @@ from StringIO import StringIO
+ from test import support
+ import unittest
+
++import pyexpat
+ import xml.dom
+ import xml.dom.minidom
+ import xml.parsers.expat
+
+ from xml.dom.minidom import parse, Node, Document, parseString
+ from xml.dom.minidom import getDOMImplementation
++from xml.parsers.expat import ExpatError
+
+
+ tstfile = support.findfile("test.xml", subdir="xmltestdata")
+@@ -1051,7 +1053,13 @@ class MinidomTest(unittest.TestCase):
+
+ # Verify that character decoding errors raise exceptions instead
+ # of crashing
+- self.assertRaises(UnicodeDecodeError, parseString,
++ if pyexpat.version_info >= (2, 4, 5):
++ self.assertRaises(ExpatError, parseString,
++ b'<fran\xe7ais></fran\xe7ais>')
++ self.assertRaises(ExpatError, parseString,
++ b'<franais>Comment \xe7a va ? Tr\xe8s bien ?</franais>')
++ else:
++ self.assertRaises(UnicodeDecodeError, parseString,
+ '<fran\xe7ais>Comment \xe7a va ? Tr\xe8s bien
?</fran\xe7ais>')
+
+ doc.unlink()
+diff --git a/Lib/test/test_xml_etree.py b/Lib/test/test_xml_etree.py
+index c75d55f05c..0855bc07ca 100644
+--- a/Lib/test/test_xml_etree.py
++++ b/Lib/test/test_xml_etree.py
+@@ -1482,12 +1482,6 @@ class BugsTest(unittest.TestCase):
+ b"<?xml version='1.0' encoding='ascii'?>\n"
+ b'<body>tãg</body>')
+
+- def test_issue3151(self):
+- e = ET.XML('<prefix:localname xmlns:prefix="${stuff}"/>')
+- self.assertEqual(e.tag, '{${stuff}}localname')
+- t = ET.ElementTree(e)
+- self.assertEqual(ET.tostring(e), b'<ns0:localname
xmlns:ns0="${stuff}" />')
+-
+ def test_issue6565(self):
+ elem = ET.XML("<body><tag/></body>")
+ self.assertEqual(summarize_list(elem), ['tag'])
diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index 0922fd44a6..699af0d897 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -150,6 +150,7 @@
"python-2.7-adjust-tests.patch"
"python-cross-compile.patch"
"python-2.7-CVE-2021-3177.patch"
+ "python-2.7-expat-compat.patch"
"python-2.7-no-static-lib.patch"))
(modules '((guix build utils)))
(snippet