mirror of
https://git.savannah.gnu.org/git/guix.git
synced 2025-02-12 06:41:27 +01:00
gnu: Add python-3.11.
* gnu/packages/patches/python-3.11-fix-tests.patch: New file. * gnu/local.mk (dist_patch_DATA): Add patch. * gnu/packages/python.scm (python-3.11): New variable. Co-authored-by: Tanguy Le Carrour <tanguy@bioneland.org>. Change-Id: I4a05f75d7b8867166ab91e983abff1a99cd7c80e
This commit is contained in:
parent
44eb5ff3cd
commit
174ff870ff
3 changed files with 809 additions and 0 deletions
|
@ -1984,6 +1984,7 @@ dist_patch_DATA = \
|
|||
%D%/packages/patches/prusa-slicer-fix-tests.patch \
|
||||
%D%/packages/patches/prusa-wxwidgets-makefile-fix.patch \
|
||||
%D%/packages/patches/pthreadpool-system-libraries.patch \
|
||||
%D%/packages/patches/python-3.11-fix-tests.patch \
|
||||
%D%/packages/patches/python-3.12-fix-tests.patch \
|
||||
%D%/packages/patches/python-accupy-use-matplotx.patch \
|
||||
%D%/packages/patches/python-accupy-fix-use-of-perfplot.patch \
|
||||
|
|
430
gnu/packages/patches/python-3.11-fix-tests.patch
Normal file
430
gnu/packages/patches/python-3.11-fix-tests.patch
Normal file
|
@ -0,0 +1,430 @@
|
|||
From f0698133e7d6c353a3e6ae0fc62e57ba558a9bc0 Mon Sep 17 00:00:00 2001
|
||||
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
|
||||
Date: Wed, 28 Oct 2020 22:55:05 -0400
|
||||
Subject: [PATCH] Skip problematic Python 3 tests in Guix.
|
||||
|
||||
A subset of the hunks in this patch is tracked upstream at
|
||||
https://bugs.python.org/issue38845, which was contributed by Tanguy Le
|
||||
Carrour <tanguy@bioneland.org>.
|
||||
---
|
||||
Lib/ctypes/test/test_callbacks.py | 3 +++
|
||||
Lib/ctypes/test/test_find.py | 1 +
|
||||
Lib/ctypes/test/test_libc.py | 3 +++
|
||||
Lib/distutils/tests/test_archive_util.py | 2 ++
|
||||
Lib/distutils/tests/test_sdist.py | 1 +
|
||||
Lib/test/_test_multiprocessing.py | 2 ++
|
||||
Lib/test/test_asyncio/test_base_events.py | 2 ++
|
||||
Lib/test/test_generators.py | 1 +
|
||||
Lib/test/test_pathlib.py | 3 +--
|
||||
Lib/test/test_pdb.py | 4 ++--
|
||||
Lib/test/test_regrtest.py | 2 ++
|
||||
Lib/test/test_resource.py | 1 +
|
||||
Lib/test/test_shutil.py | 2 ++
|
||||
Lib/test/test_signal.py | 4 ++++
|
||||
Lib/test/test_socket.py | 8 ++++++++
|
||||
Lib/test/test_spwd.py | 6 ++----
|
||||
Lib/test/test_tarfile.py | 9 ++++++---
|
||||
Lib/test/test_threading.py | 3 +++
|
||||
Lib/test/test_unicodedata.py | 1 +
|
||||
Tools/scripts/run_tests.py | 2 +-
|
||||
20 files changed, 48 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/Lib/ctypes/test/test_callbacks.py b/Lib/ctypes/test/test_callbacks.py
|
||||
index d8e9c5a760..94fc5929c9 100644
|
||||
--- a/Lib/ctypes/test/test_callbacks.py
|
||||
+++ b/Lib/ctypes/test/test_callbacks.py
|
||||
@@ -5,6 +5,7 @@ from test import support
|
||||
from ctypes import *
|
||||
from ctypes.test import need_symbol
|
||||
import _ctypes_test
|
||||
+import platform
|
||||
|
||||
class Callbacks(unittest.TestCase):
|
||||
functype = CFUNCTYPE
|
||||
@@ -178,6 +179,8 @@ class SampleCallbacksTestCase(unittest.TestCase):
|
||||
|
||||
self.assertLess(diff, 0.01, "%s not less than 0.01" % diff)
|
||||
|
||||
+ @unittest.skipIf(platform.machine() in ['mips64'],
|
||||
+ "This test fails on this platform")
|
||||
def test_issue_8959_a(self):
|
||||
from ctypes.util import find_library
|
||||
libc_path = find_library("c")
|
||||
diff --git a/Lib/ctypes/test/test_find.py b/Lib/ctypes/test/test_find.py
|
||||
index 92ac1840ad..c8eb75dedd 100644
|
||||
--- a/Lib/ctypes/test/test_find.py
|
||||
+++ b/Lib/ctypes/test/test_find.py
|
||||
@@ -116,6 +116,7 @@ class FindLibraryLinux(unittest.TestCase):
|
||||
with unittest.mock.patch("ctypes.util._findSoname_ldconfig", lambda *args: None):
|
||||
self.assertNotEqual(find_library('c'), None)
|
||||
|
||||
+ @unittest.skipIf(True, "ldconfig is not used on Guix")
|
||||
def test_find_library_with_ld(self):
|
||||
with unittest.mock.patch("ctypes.util._findSoname_ldconfig", lambda *args: None), \
|
||||
unittest.mock.patch("ctypes.util._findLib_gcc", lambda *args: None):
|
||||
diff --git a/Lib/ctypes/test/test_libc.py b/Lib/ctypes/test/test_libc.py
|
||||
index 56285b5ff8..c088ab3db8 100644
|
||||
--- a/Lib/ctypes/test/test_libc.py
|
||||
+++ b/Lib/ctypes/test/test_libc.py
|
||||
@@ -2,6 +2,7 @@ import unittest
|
||||
|
||||
from ctypes import *
|
||||
import _ctypes_test
|
||||
+import platform
|
||||
|
||||
lib = CDLL(_ctypes_test.__file__)
|
||||
|
||||
@@ -17,6 +18,8 @@ class LibTest(unittest.TestCase):
|
||||
import math
|
||||
self.assertEqual(lib.my_sqrt(2.0), math.sqrt(2.0))
|
||||
|
||||
+ @unittest.skipIf(platform.machine() in ['mips64'],
|
||||
+ "This test fails on this platform")
|
||||
def test_qsort(self):
|
||||
comparefunc = CFUNCTYPE(c_int, POINTER(c_char), POINTER(c_char))
|
||||
lib.my_qsort.argtypes = c_void_p, c_size_t, c_size_t, comparefunc
|
||||
diff --git a/Lib/distutils/tests/test_archive_util.py b/Lib/distutils/tests/test_archive_util.py
|
||||
index e9aad0e40f..8bbaa51ee5 100644
|
||||
--- a/Lib/distutils/tests/test_archive_util.py
|
||||
+++ b/Lib/distutils/tests/test_archive_util.py
|
||||
@@ -333,6 +333,7 @@ class ArchiveUtilTestCase(support.TempdirManager,
|
||||
self.assertEqual(os.path.basename(res), 'archive.tar.xz')
|
||||
self.assertEqual(self._tarinfo(res), self._created_files)
|
||||
|
||||
+ @unittest.skipIf(True, "getgrgid(0)[0] raises a KeyError on Guix")
|
||||
def test_make_archive_owner_group(self):
|
||||
# testing make_archive with owner and group, with various combinations
|
||||
# this works even if there's not gid/uid support
|
||||
@@ -362,6 +363,7 @@ class ArchiveUtilTestCase(support.TempdirManager,
|
||||
|
||||
@unittest.skipUnless(ZLIB_SUPPORT, "Requires zlib")
|
||||
@unittest.skipUnless(UID_GID_SUPPORT, "Requires grp and pwd support")
|
||||
+ @unittest.skipIf(True, "getgrgid(0)[0] raises a KeyError on Guix")
|
||||
def test_tarfile_root_owner(self):
|
||||
tmpdir = self._create_files()
|
||||
base_name = os.path.join(self.mkdtemp(), 'archive')
|
||||
diff --git a/Lib/distutils/tests/test_sdist.py b/Lib/distutils/tests/test_sdist.py
|
||||
index 23db126959..6e2329df7d 100644
|
||||
--- a/Lib/distutils/tests/test_sdist.py
|
||||
+++ b/Lib/distutils/tests/test_sdist.py
|
||||
@@ -443,6 +443,7 @@ class SDistTestCase(BasePyPIRCCommandTestCase):
|
||||
"The tar command is not found")
|
||||
@unittest.skipIf(find_executable('gzip') is None,
|
||||
"The gzip command is not found")
|
||||
+ @unittest.skipIf(True, "getgrgid(0)[0] raises a KeyError on Guix")
|
||||
def test_make_distribution_owner_group(self):
|
||||
# now building a sdist
|
||||
dist, cmd = self.get_cmd()
|
||||
diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing.py
|
||||
index e47905c863..31a5a9c308 100644
|
||||
--- a/Lib/test/_test_multiprocessing.py
|
||||
+++ b/Lib/test/_test_multiprocessing.py
|
||||
@@ -1577,6 +1577,7 @@ class _TestCondition(BaseTestCase):
|
||||
if pid is not None:
|
||||
os.kill(pid, signal.SIGINT)
|
||||
|
||||
+ @unittest.skipIf(True, "This fails for unknown reasons on Guix")
|
||||
def test_wait_result(self):
|
||||
if isinstance(self, ProcessesMixin) and sys.platform != 'win32':
|
||||
pid = os.getpid()
|
||||
@@ -3905,6 +3906,7 @@ class _TestSharedMemory(BaseTestCase):
|
||||
sms.close()
|
||||
|
||||
@unittest.skipIf(os.name != "posix", "not feasible in non-posix platforms")
|
||||
+ @unittest.skipUnless(sys.stdin.isatty(), "KeyboardInterrupts require a TTY device")
|
||||
def test_shared_memory_SharedMemoryServer_ignores_sigint(self):
|
||||
# bpo-36368: protect SharedMemoryManager server process from
|
||||
# KeyboardInterrupt signals.
|
||||
diff --git a/Lib/test/test_asyncio/test_base_events.py b/Lib/test/test_asyncio/test_base_events.py
|
||||
index 533d5cc7f5..c4f860cc3b 100644
|
||||
--- a/Lib/test/test_asyncio/test_base_events.py
|
||||
+++ b/Lib/test/test_asyncio/test_base_events.py
|
||||
@@ -1341,6 +1341,8 @@ class BaseEventLoopWithSelectorTests(test_utils.TestCase):
|
||||
self._test_create_connection_ip_addr(m_socket, False)
|
||||
|
||||
@patch_socket
|
||||
+ @unittest.skipUnless(support.is_resource_enabled('network'),
|
||||
+ 'network is not enabled')
|
||||
def test_create_connection_service_name(self, m_socket):
|
||||
m_socket.getaddrinfo = socket.getaddrinfo
|
||||
sock = m_socket.socket.return_value
|
||||
diff --git a/Lib/test/test_generators.py b/Lib/test/test_generators.py
|
||||
index 3bf1522808..04bac8a7db 100644
|
||||
--- a/Lib/test/test_generators.py
|
||||
+++ b/Lib/test/test_generators.py
|
||||
@@ -33,6 +33,7 @@ class SignalAndYieldFromTest(unittest.TestCase):
|
||||
else:
|
||||
return "FAILED"
|
||||
|
||||
+ @unittest.skipIf(True, 'Keyboard interrupts do not work in the Guix build environment')
|
||||
def test_raise_and_yield_from(self):
|
||||
gen = self.generator1()
|
||||
gen.send(None)
|
||||
diff --git a/Lib/test/test_pathlib.py b/Lib/test/test_pathlib.py
|
||||
index 3da35710b9..5404f9193d 100644
|
||||
--- a/Lib/test/test_pathlib.py
|
||||
+++ b/Lib/test/test_pathlib.py
|
||||
@@ -2408,10 +2408,7 @@ class PosixPathTest(_BasePathTest, unittest.TestCase):
|
||||
self.assertEqual(given, expect)
|
||||
self.assertEqual(set(p.rglob("FILEd*")), set())
|
||||
|
||||
- @unittest.skipUnless(hasattr(pwd, 'getpwall'),
|
||||
- 'pwd module does not expose getpwall()')
|
||||
- @unittest.skipIf(sys.platform == "vxworks",
|
||||
- "no home directory on VxWorks")
|
||||
+ @unittest.skipIf(True, "Guix builder home is '/' which causes trouble for these tests")
|
||||
def test_expanduser(self):
|
||||
P = self.cls
|
||||
support.import_module('pwd')
|
||||
diff --git a/Lib/test/test_pdb.py b/Lib/test/test_pdb.py
|
||||
index 8016f81e5a..10190486b4 100644
|
||||
--- a/Lib/test/test_pdb.py
|
||||
+++ b/Lib/test/test_pdb.py
|
||||
@@ -1219,11 +1219,11 @@ def test_pdb_issue_20766():
|
||||
> <doctest test.test_pdb.test_pdb_issue_20766[0]>(6)test_function()
|
||||
-> print('pdb %d: %s' % (i, sess._previous_sigint_handler))
|
||||
(Pdb) continue
|
||||
- pdb 1: <built-in function default_int_handler>
|
||||
+ pdb 1: 1
|
||||
> <doctest test.test_pdb.test_pdb_issue_20766[0]>(6)test_function()
|
||||
-> print('pdb %d: %s' % (i, sess._previous_sigint_handler))
|
||||
(Pdb) continue
|
||||
- pdb 2: <built-in function default_int_handler>
|
||||
+ pdb 2: 1
|
||||
"""
|
||||
|
||||
|
||||
diff --git a/Lib/test/test_regrtest.py b/Lib/test/test_regrtest.py
|
||||
index a77638b10a..2069b349a8 100644
|
||||
--- a/Lib/test/test_regrtest.py
|
||||
+++ b/Lib/test/test_regrtest.py
|
||||
@@ -811,6 +811,7 @@ class ArgsTestCase(BaseTestCase):
|
||||
output = self.run_tests('--fromfile', filename)
|
||||
self.check_executed_tests(output, tests)
|
||||
|
||||
+ @unittest.skipIf(True, 'Keyboard interrupts do not work in the Guix build environment.')
|
||||
def test_interrupted(self):
|
||||
code = TEST_INTERRUPTED
|
||||
test = self.create_test('sigint', code=code)
|
||||
@@ -828,6 +829,7 @@ class ArgsTestCase(BaseTestCase):
|
||||
% (self.TESTNAME_REGEX, len(tests)))
|
||||
self.check_line(output, regex)
|
||||
|
||||
+ @unittest.skipIf(True, 'Keyboard interrupts do not work in the Guix build environment.')
|
||||
def test_slowest_interrupted(self):
|
||||
# Issue #25373: test --slowest with an interrupted test
|
||||
code = TEST_INTERRUPTED
|
||||
diff --git a/Lib/test/test_resource.py b/Lib/test/test_resource.py
|
||||
index e5ece5284c..5299e54507 100644
|
||||
--- a/Lib/test/test_resource.py
|
||||
+++ b/Lib/test/test_resource.py
|
||||
@@ -148,6 +148,7 @@ class ResourceTest(unittest.TestCase):
|
||||
|
||||
@unittest.skipUnless(hasattr(resource, 'prlimit'), 'no prlimit')
|
||||
@support.requires_linux_version(2, 6, 36)
|
||||
+ @unittest.skipIf(True, "Bug: the PermissionError is not raised")
|
||||
def test_prlimit(self):
|
||||
self.assertRaises(TypeError, resource.prlimit)
|
||||
self.assertRaises(ProcessLookupError, resource.prlimit,
|
||||
diff --git a/Lib/test/test_shutil.py b/Lib/test/test_shutil.py
|
||||
index e19af64be0..1b893df6fa 100644
|
||||
--- a/Lib/test/test_shutil.py
|
||||
+++ b/Lib/test/test_shutil.py
|
||||
@@ -1427,6 +1427,7 @@ class TestArchives(BaseTest, unittest.TestCase):
|
||||
base_name = os.path.join(tmpdir, 'archive')
|
||||
self.assertRaises(ValueError, make_archive, base_name, 'xxx')
|
||||
|
||||
+ @unittest.skipIf(True, "The Guix build container has no root user")
|
||||
@support.requires_zlib()
|
||||
def test_make_archive_owner_group(self):
|
||||
# testing make_archive with owner and group, with various combinations
|
||||
@@ -1455,6 +1456,7 @@ class TestArchives(BaseTest, unittest.TestCase):
|
||||
self.assertTrue(os.path.isfile(res))
|
||||
|
||||
|
||||
+ @unittest.skipIf(True, "The Guix build container has no root user")
|
||||
@support.requires_zlib()
|
||||
@unittest.skipUnless(UID_GID_SUPPORT, "Requires grp and pwd support")
|
||||
def test_tarfile_root_owner(self):
|
||||
diff --git a/Lib/test/test_signal.py b/Lib/test/test_signal.py
|
||||
index 45553a6a42..55623f01a3 100644
|
||||
--- a/Lib/test/test_signal.py
|
||||
+++ b/Lib/test/test_signal.py
|
||||
@@ -78,7 +78,8 @@ class PosixTests(unittest.TestCase):
|
||||
self.assertLess(len(s), signal.NSIG)
|
||||
|
||||
@unittest.skipUnless(sys.executable, "sys.executable required.")
|
||||
@support.requires_subprocess()
|
||||
+ @unittest.skipUnless(sys.stdin.isatty(), "KeyboardInterrupts require a TTY device")
|
||||
def test_keyboard_interrupt_exit_code(self):
|
||||
"""KeyboardInterrupt triggers exit via SIGINT."""
|
||||
process = subprocess.run(
|
||||
@@ -128,7 +129,8 @@ class WindowsSignalTests(unittest.TestCase):
|
||||
signal.signal(7, handler)
|
||||
|
||||
@unittest.skipUnless(sys.executable, "sys.executable required.")
|
||||
@support.requires_subprocess()
|
||||
+ @unittest.skipUnless(sys.stdin.isatty(), "KeyboardInterrupts require a TTY device")
|
||||
def test_keyboard_interrupt_exit_code(self):
|
||||
"""KeyboardInterrupt triggers an exit using STATUS_CONTROL_C_EXIT."""
|
||||
# We don't test via os.kill(os.getpid(), signal.CTRL_C_EVENT) here
|
||||
@@ -1245,6 +1247,7 @@ class StressTest(unittest.TestCase):
|
||||
|
||||
class RaiseSignalTest(unittest.TestCase):
|
||||
|
||||
+ @unittest.skipUnless(sys.stdin.isatty(), "KeyboardInterrupts require a TTY device")
|
||||
def test_sigint(self):
|
||||
with self.assertRaises(KeyboardInterrupt):
|
||||
signal.raise_signal(signal.SIGINT)
|
||||
@@ -1275,6 +1278,7 @@ class RaiseSignalTest(unittest.TestCase):
|
||||
|
||||
class PidfdSignalTest(unittest.TestCase):
|
||||
|
||||
+ @unittest.skipUnless(sys.stdin.isatty(), "KeyboardInterrupts require a TTY device")
|
||||
@unittest.skipUnless(
|
||||
hasattr(signal, "pidfd_send_signal"),
|
||||
"pidfd support not built in",
|
||||
diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py
|
||||
index aefba4f397..6c89f558d5 100755
|
||||
--- a/Lib/test/test_socket.py
|
||||
+++ b/Lib/test/test_socket.py
|
||||
@@ -1009,6 +1009,8 @@ class GeneralModuleTests(unittest.TestCase):
|
||||
if not fqhn in all_host_names:
|
||||
self.fail("Error testing host resolution mechanisms. (fqdn: %s, all: %s)" % (fqhn, repr(all_host_names)))
|
||||
|
||||
+ @unittest.skipUnless(support.is_resource_enabled('network'),
|
||||
+ 'network is not enabled')
|
||||
def test_host_resolution(self):
|
||||
for addr in [socket_helper.HOSTv4, '10.0.0.1', '255.255.255.255']:
|
||||
self.assertEqual(socket.gethostbyname(addr), addr)
|
||||
@@ -1140,6 +1142,8 @@ class GeneralModuleTests(unittest.TestCase):
|
||||
self.assertWarns(DeprecationWarning, socket.ntohs, k)
|
||||
self.assertWarns(DeprecationWarning, socket.htons, k)
|
||||
|
||||
+ @unittest.skipUnless(os.path.exists("/etc/services"),
|
||||
+ "getservbyname uses /etc/services, which is not in the chroot")
|
||||
def testGetServBy(self):
|
||||
eq = self.assertEqual
|
||||
# Find one service that exists, then check all the related interfaces.
|
||||
@@ -1489,6 +1493,8 @@ class GeneralModuleTests(unittest.TestCase):
|
||||
raise
|
||||
self.assertRaises(TypeError, s.ioctl, socket.SIO_LOOPBACK_FAST_PATH, None)
|
||||
|
||||
+ @unittest.skipUnless(os.path.exists("/etc/gai.conf"),
|
||||
+ "getaddrinfo() will fail")
|
||||
def testGetaddrinfo(self):
|
||||
try:
|
||||
socket.getaddrinfo('localhost', 80)
|
||||
@@ -1571,6 +1577,8 @@ class GeneralModuleTests(unittest.TestCase):
|
||||
# only IP addresses are allowed
|
||||
self.assertRaises(OSError, socket.getnameinfo, ('mail.python.org',0), 0)
|
||||
|
||||
+ @unittest.skipUnless(os.path.exists("/etc/gai.conf"),
|
||||
+ "getaddrinfo() will fail")
|
||||
@unittest.skipUnless(support.is_resource_enabled('network'),
|
||||
'network is not enabled')
|
||||
def test_idna(self):
|
||||
diff --git a/Lib/test/test_spwd.py b/Lib/test/test_spwd.py
|
||||
index 07793c84c8..fec672bcbe 100644
|
||||
--- a/Lib/test/test_spwd.py
|
||||
+++ b/Lib/test/test_spwd.py
|
||||
@@ -5,8 +5,7 @@ from test import support
|
||||
spwd = support.import_module('spwd')
|
||||
|
||||
|
||||
-@unittest.skipUnless(hasattr(os, 'geteuid') and os.geteuid() == 0,
|
||||
- 'root privileges required')
|
||||
+@unittest.skipUnless(os.path.exists("/etc/shadow"), 'spwd tests require /etc/shadow')
|
||||
class TestSpwdRoot(unittest.TestCase):
|
||||
|
||||
def test_getspall(self):
|
||||
@@ -56,8 +55,7 @@ class TestSpwdRoot(unittest.TestCase):
|
||||
self.assertRaises(TypeError, spwd.getspnam, bytes_name)
|
||||
|
||||
|
||||
-@unittest.skipUnless(hasattr(os, 'geteuid') and os.geteuid() != 0,
|
||||
- 'non-root user required')
|
||||
+@unittest.skipUnless(os.path.exists("/etc/shadow"), 'spwd tests require /etc/shadow')
|
||||
class TestSpwdNonRoot(unittest.TestCase):
|
||||
|
||||
def test_getspnam_exception(self):
|
||||
diff --git a/Lib/test/test_tarfile.py b/Lib/test/test_tarfile.py
|
||||
index 29cde91bf7..8d0f20e8bf 100644
|
||||
--- a/Lib/test/test_tarfile.py
|
||||
+++ b/Lib/test/test_tarfile.py
|
||||
@@ -2607,9 +2607,12 @@ def root_is_uid_gid_0():
|
||||
import pwd, grp
|
||||
except ImportError:
|
||||
return False
|
||||
- if pwd.getpwuid(0)[0] != 'root':
|
||||
- return False
|
||||
- if grp.getgrgid(0)[0] != 'root':
|
||||
+ try:
|
||||
+ if pwd.getpwuid(0)[0] != 'root':
|
||||
+ return False
|
||||
+ if grp.getgrgid(0)[0] != 'root':
|
||||
+ return False
|
||||
+ except KeyError:
|
||||
return False
|
||||
return True
|
||||
|
||||
diff --git a/Lib/test/test_tools/test_freeze.py b/Lib/test/test_tools/test_freeze.py
|
||||
index 0e7ed67de7..6539a2983b 100644
|
||||
--- a/Lib/test/test_tools/test_freeze.py
|
||||
+++ b/Lib/test/test_tools/test_freeze.py
|
||||
@@ -23,6 +23,7 @@
|
||||
'test is too slow with PGO')
|
||||
class TestFreeze(unittest.TestCase):
|
||||
|
||||
+ @unittest.skipIf(True, 'Fails on Guix.')
|
||||
@support.requires_resource('cpu') # Building Python is slow
|
||||
def test_freeze_simple_script(self):
|
||||
script = textwrap.dedent("""
|
||||
diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py
|
||||
index c21cdf8eb7..6c9d575032 100644
|
||||
--- a/Lib/test/test_threading.py
|
||||
+++ b/Lib/test/test_threading.py
|
||||
@@ -1398,5 +1398,6 @@ class MiscTestCase(unittest.TestCase):
|
||||
signal.signal(signum, handler)
|
||||
|
||||
+ @unittest.skipIf(True, 'Keyboard interrupts do not work in the Guix build container.')
|
||||
def test_interrupt_main_subthread(self):
|
||||
# Calling start_new_thread with a function that executes interrupt_main
|
||||
# should raise KeyboardInterrupt upon completion.
|
||||
@@ -1409,6 +1410,8 @@ class InterruptMainTests(unittest.TestCase):
|
||||
t.join()
|
||||
t.join()
|
||||
|
||||
+
|
||||
+ @unittest.skipIf(True, 'Keyboard interrupts do not work in the Guix build container.')
|
||||
def test_interrupt_main_mainthread(self):
|
||||
# Make sure that if interrupt_main is called in main thread that
|
||||
# KeyboardInterrupt is raised instantly.
|
||||
diff --git a/Lib/test/test_unicodedata.py b/Lib/test/test_unicodedata.py
|
||||
index b552d2bd17..28b1144e15 100644
|
||||
--- a/Lib/test/test_unicodedata.py
|
||||
+++ b/Lib/test/test_unicodedata.py
|
||||
@@ -309,6 +309,7 @@ class UnicodeMiscTest(UnicodeDatabaseTest):
|
||||
self.assertEqual(len(lines), 1,
|
||||
r"\u%.4x should not be a linebreak" % i)
|
||||
|
||||
+@requires_resource('network')
|
||||
class NormalizationTest(unittest.TestCase):
|
||||
@staticmethod
|
||||
def check_version(testfile):
|
||||
diff --git a/Tools/scripts/run_tests.py b/Tools/scripts/run_tests.py
|
||||
index bcfa5e943b..1f2484971b 100644
|
||||
--- a/Tools/scripts/run_tests.py
|
||||
+++ b/Tools/scripts/run_tests.py
|
||||
@@ -41,7 +41,7 @@ def main(regrtest_args):
|
||||
else:
|
||||
args.extend(['-j', '0']) # Use all CPU cores
|
||||
if not any(is_resource_use_flag(arg) for arg in regrtest_args):
|
||||
- args.extend(['-u', 'all,-largefile,-audio,-gui'])
|
||||
+ args.extend(['-u', 'all,-largefile,-audio,-gui,-network'])
|
||||
|
||||
if cross_compile and hostrunner:
|
||||
# If HOSTRUNNER is set and -p/--python option is not given, then
|
||||
--
|
||||
2.29.2
|
||||
|
|
@ -660,6 +660,384 @@ def contents() -> str:
|
|||
(variable "PYTHONTZPATH")
|
||||
(files (list "share/zoneinfo")))))))
|
||||
|
||||
(define-public python-3.11
|
||||
(package
|
||||
(inherit python-3.10)
|
||||
(name "python")
|
||||
(version "3.11.11")
|
||||
(source (origin
|
||||
(method url-fetch)
|
||||
(uri (string-append "https://www.python.org/ftp/python/"
|
||||
version "/Python-" version ".tar.xz"))
|
||||
(patches (search-patches
|
||||
"python-3-deterministic-build-info.patch"
|
||||
"python-3.11-fix-tests.patch"
|
||||
"python-3-hurd-configure.patch"
|
||||
"python-3-search-paths.patch"))
|
||||
(sha256
|
||||
(base32
|
||||
"1qrvsxg5g0b0pgz2iigxic2j3g6b2c59iva46vins8ydl33j169a"))
|
||||
(modules '((guix build utils)))
|
||||
(snippet
|
||||
'(begin
|
||||
;; Delete the bundled copy of libexpat.
|
||||
(delete-file-recursively "Modules/expat")
|
||||
(substitute* "Modules/Setup"
|
||||
;; Link Expat instead of embedding the bundled one.
|
||||
(("^#pyexpat.*") "pyexpat pyexpat.c -lexpat\n"))
|
||||
;; Delete windows binaries
|
||||
(for-each delete-file
|
||||
(find-files "Lib/distutils/command" "\\.exe$"))))))
|
||||
(arguments
|
||||
(list
|
||||
#:test-target "test"
|
||||
#:configure-flags
|
||||
#~(list "--enable-shared" ;allow embedding
|
||||
"--with-system-expat" ;for XML support
|
||||
"--with-system-ffi" ;build ctypes
|
||||
"--with-ensurepip=install" ;install pip and setuptools
|
||||
"--with-computed-gotos" ;main interpreter loop optimization
|
||||
"--enable-unicode=ucs4"
|
||||
"--without-static-libpython"
|
||||
"--enable-loadable-sqlite-extensions"
|
||||
|
||||
;; FIXME: These flags makes Python significantly faster,
|
||||
;; but leads to non-reproducible binaries.
|
||||
;; "--with-lto" ;increase size by 20MB, but 15% speedup
|
||||
;; "--enable-optimizations"
|
||||
|
||||
;; Prevent the installed _sysconfigdata.py from retaining
|
||||
;; a reference to coreutils.
|
||||
"INSTALL=install -c"
|
||||
"MKDIR_P=mkdir -p"
|
||||
|
||||
;; Disable runtime check failing if cross-compiling, see:
|
||||
;; https://lists.yoctoproject.org/pipermail/poky/2013-June/008997.html
|
||||
#$@(if (%current-target-system)
|
||||
'("ac_cv_buggy_getaddrinfo=no"
|
||||
"ac_cv_file__dev_ptmx=no"
|
||||
"ac_cv_file__dev_ptc=no")
|
||||
'())
|
||||
;; -fno-semantic-interposition reinstates some
|
||||
;; optimizations by gcc leading to around 15% speedup.
|
||||
;; This is the default starting from python 3.10.
|
||||
"CFLAGS=-fno-semantic-interposition"
|
||||
(string-append "LDFLAGS=-Wl,-rpath=" #$output "/lib"
|
||||
" -fno-semantic-interposition"))
|
||||
;; With no -j argument tests use all available cpus, so provide one.
|
||||
#:make-flags
|
||||
`(list (string-append (format #f "TESTOPTS=-j~d"
|
||||
(parallel-job-count))
|
||||
;; those tests fail on low-memory systems
|
||||
" --exclude"
|
||||
" test_mmap"
|
||||
" test_socket"
|
||||
" test_threading"
|
||||
" test_asyncio"
|
||||
" test_shutdown"
|
||||
,@(if (system-hurd?)
|
||||
'(" test_posix" ;multiple errors
|
||||
" test_time"
|
||||
" test_pty"
|
||||
" test_shutil"
|
||||
" test_tempfile" ;chflags: invalid argument:
|
||||
;; tbv14c9t/dir0/dir0/dir0/test0.txt
|
||||
" test_os" ;stty: 'standard input':
|
||||
;; Inappropriate ioctl for device
|
||||
" test_openpty" ;No such file or directory
|
||||
" test_selectors" ;assertEqual(NUM_FDS // 2, len(fds))
|
||||
;; 32752 != 4
|
||||
" test_compileall" ;multiple errors
|
||||
" test_poll" ;list index out of range
|
||||
" test_subprocess" ;runs over 10min
|
||||
" test_asyncore" ;multiple errors
|
||||
" test_threadsignals"
|
||||
" test_eintr" ;Process return code is -14
|
||||
" test_io" ;multiple errors
|
||||
" test_logging"
|
||||
" test_signal"
|
||||
" test_flags" ;ERROR
|
||||
" test_bidirectional_pty"
|
||||
" test_create_unix_connection"
|
||||
" test_unix_sock_client_ops"
|
||||
" test_open_unix_connection"
|
||||
" test_open_unix_connection_error"
|
||||
" test_read_pty_output"
|
||||
" test_write_pty"
|
||||
" test_concurrent_futures" ;freeze
|
||||
" test_venv" ;freeze
|
||||
" test_multiprocessing_forkserver" ;runs over 10min
|
||||
" test_multiprocessing_spawn" ;runs over 10min
|
||||
" test_builtin"
|
||||
" test_capi"
|
||||
" test_dbm_ndbm"
|
||||
" test_exceptions"
|
||||
" test_faulthandler"
|
||||
" test_getopt"
|
||||
" test_importlib"
|
||||
" test_json"
|
||||
" test_multiprocessing_fork"
|
||||
" test_multiprocessing_main_handling"
|
||||
" test_pdb "
|
||||
" test_regrtest"
|
||||
" test_sqlite")
|
||||
'())))
|
||||
|
||||
#:modules
|
||||
'((ice-9 ftw)
|
||||
(ice-9 match)
|
||||
(guix build utils)
|
||||
(guix build gnu-build-system))
|
||||
|
||||
#:phases
|
||||
`(modify-phases %standard-phases
|
||||
,@(if (system-hurd?)
|
||||
`((add-after 'unpack
|
||||
'disable-multi-processing
|
||||
(lambda _
|
||||
(substitute* "Makefile.pre.in"
|
||||
(("-j0")
|
||||
"-j1")))))
|
||||
'())
|
||||
(add-before 'configure 'patch-lib-shells
|
||||
(lambda _
|
||||
;; This variable is used in setup.py to enable cross compilation
|
||||
;; specific switches. As it is not set properly by configure
|
||||
;; script, set it manually.
|
||||
,@(if (%current-target-system)
|
||||
'((setenv "_PYTHON_HOST_PLATFORM" ""))
|
||||
'())
|
||||
;; Filter for existing files, since some may not exist in all
|
||||
;; versions of python that are built with this recipe.
|
||||
(substitute* (filter file-exists?
|
||||
'("Lib/subprocess.py"
|
||||
"Lib/popen2.py"
|
||||
"Lib/distutils/tests/test_spawn.py"
|
||||
"Lib/test/support/__init__.py"
|
||||
"Lib/test/test_subprocess.py"))
|
||||
(("/bin/sh")
|
||||
(which "sh")))))
|
||||
(add-before 'configure 'do-not-record-configure-flags
|
||||
(lambda* (#:key configure-flags #:allow-other-keys)
|
||||
;; Remove configure flags from the installed '_sysconfigdata.py'
|
||||
;; and 'Makefile' so we don't end up keeping references to the
|
||||
;; build tools.
|
||||
;;
|
||||
;; Preserve at least '--with-system-ffi' since otherwise the
|
||||
;; thing tries to build libffi, fails, and we end up with a
|
||||
;; Python that lacks ctypes.
|
||||
(substitute* "configure"
|
||||
(("^CONFIG_ARGS=.*$")
|
||||
(format #f "CONFIG_ARGS='~a'\n"
|
||||
(if (member "--with-system-ffi"
|
||||
configure-flags)
|
||||
"--with-system-ffi" ""))))))
|
||||
(add-before 'check 'pre-check
|
||||
(lambda _
|
||||
;; 'Lib/test/test_site.py' needs a valid $HOME
|
||||
(setenv "HOME"
|
||||
(getcwd))))
|
||||
(add-after 'unpack 'set-source-file-times-to-1980
|
||||
;; XXX One of the tests uses a ZIP library to pack up some of the
|
||||
;; source tree, and fails with "ZIP does not support timestamps
|
||||
;; before 1980". Work around this by setting the file times in the
|
||||
;; source tree to sometime in early 1980.
|
||||
(lambda _
|
||||
(let ((circa-1980 (* 10 366 24 60 60)))
|
||||
(ftw "."
|
||||
(lambda (file stat flag)
|
||||
(utime file circa-1980 circa-1980) #t)))))
|
||||
(add-after 'unpack 'remove-windows-binaries
|
||||
(lambda _
|
||||
;; Delete .exe from embedded .whl (zip) files
|
||||
(for-each (lambda (whl)
|
||||
(let ((dir "whl-content")
|
||||
(circa-1980 (* 10 366 24 60 60)))
|
||||
(mkdir-p dir)
|
||||
(with-directory-excursion dir
|
||||
(let ((whl (string-append "../" whl)))
|
||||
(invoke "unzip" whl)
|
||||
(for-each delete-file
|
||||
(find-files "." "\\.exe$"))
|
||||
(delete-file whl)
|
||||
;; Reset timestamps to prevent them from ending
|
||||
;; up in the Zip archive.
|
||||
(ftw "."
|
||||
(lambda (file stat flag)
|
||||
(utime file circa-1980
|
||||
circa-1980) #t))
|
||||
(apply invoke "zip" "-X" whl
|
||||
(find-files "."
|
||||
#:directories? #t))))
|
||||
(delete-file-recursively dir)))
|
||||
(find-files "Lib/ensurepip" "\\.whl$"))))
|
||||
(add-after 'install 'remove-tests
|
||||
;; Remove 25 MiB of unneeded unit tests. Keep test_support.*
|
||||
;; because these files are used by some libraries out there.
|
||||
(lambda* (#:key outputs #:allow-other-keys)
|
||||
(let ((out (assoc-ref outputs "out")))
|
||||
(match (scandir (string-append out "/lib")
|
||||
(lambda (name)
|
||||
(string-prefix? "python" name)))
|
||||
((pythonX.Y)
|
||||
(let ((testdir (string-append out "/lib/" pythonX.Y
|
||||
"/test")))
|
||||
(with-directory-excursion testdir
|
||||
(for-each delete-file-recursively
|
||||
(scandir testdir
|
||||
(match-lambda
|
||||
((or "." "..")
|
||||
#f)
|
||||
("support" #f)
|
||||
(file (not (string-prefix?
|
||||
"test_support."
|
||||
file))))))
|
||||
(call-with-output-file "__init__.py"
|
||||
(const #t))))
|
||||
(let ((libdir (string-append out "/lib/" pythonX.Y)))
|
||||
(for-each (lambda (directory)
|
||||
(let ((dir (string-append libdir "/"
|
||||
directory)))
|
||||
(when (file-exists? dir)
|
||||
(delete-file-recursively dir))))
|
||||
'("email/test" "ctypes/test"
|
||||
"unittest/test"
|
||||
"tkinter/test"
|
||||
"sqlite3/test"
|
||||
"bsddb/test"
|
||||
"lib-tk/test"
|
||||
"json/tests"
|
||||
"distutils/tests"))))))))
|
||||
(add-after 'remove-tests 'move-tk-inter
|
||||
(lambda* (#:key outputs inputs #:allow-other-keys)
|
||||
;; When Tkinter support is built move it to a separate output so
|
||||
;; that the main output doesn't contain a reference to Tcl/Tk.
|
||||
(let ((out (assoc-ref outputs "out"))
|
||||
(tk (assoc-ref outputs "tk")))
|
||||
(when tk
|
||||
(match (find-files out "tkinter.*\\.so")
|
||||
((tkinter.so)
|
||||
;; The .so is in OUT/lib/pythonX.Y/lib-dynload, but we
|
||||
;; want it under TK/lib/pythonX.Y/site-packages.
|
||||
(let* ((len (string-length out))
|
||||
(target (string-append tk "/"
|
||||
(string-drop (dirname
|
||||
(dirname
|
||||
tkinter.so))
|
||||
len)
|
||||
"/site-packages")))
|
||||
(install-file tkinter.so target)
|
||||
(delete-file tkinter.so))))
|
||||
;; Remove explicit store path references.
|
||||
(let ((tcl (assoc-ref inputs "tcl"))
|
||||
(tk (assoc-ref inputs "tk")))
|
||||
(substitute* (find-files (string-append out "/lib")
|
||||
"^(_sysconfigdata_.*\\.py|Makefile)$")
|
||||
(((string-append "-L" tk "/lib"))
|
||||
"")
|
||||
(((string-append "-L" tcl "/lib"))
|
||||
"")))))))
|
||||
(add-after 'move-tk-inter 'move-idle
|
||||
(lambda* (#:key outputs #:allow-other-keys)
|
||||
;; when idle is built, move it to a separate output to save some
|
||||
;; space (5MB)
|
||||
(let ((out (assoc-ref outputs "out"))
|
||||
(idle (assoc-ref outputs "idle")))
|
||||
(when idle
|
||||
(for-each (lambda (file)
|
||||
(let ((target (string-append idle
|
||||
"/bin/"
|
||||
(basename
|
||||
file))))
|
||||
(install-file file
|
||||
(dirname target))
|
||||
(delete-file file)))
|
||||
(find-files (string-append out "/bin")
|
||||
"^idle"))
|
||||
(match (find-files out "^idlelib$"
|
||||
#:directories? #t)
|
||||
((idlelib)
|
||||
(let* ((len (string-length out))
|
||||
(target (string-append idle "/"
|
||||
(string-drop
|
||||
idlelib len)
|
||||
"/site-packages")))
|
||||
(mkdir-p (dirname target))
|
||||
(rename-file idlelib target))))))))
|
||||
(add-after 'move-idle 'rebuild-bytecode
|
||||
(lambda* (#:key outputs #:allow-other-keys)
|
||||
(let ((out (assoc-ref outputs "out")))
|
||||
;; Disable hash randomization to ensure the generated .pycs
|
||||
;; are reproducible.
|
||||
(setenv "PYTHONHASHSEED" "0")
|
||||
|
||||
(for-each (lambda (output)
|
||||
;; XXX: Delete existing pycs generated by the build
|
||||
;; system beforehand because the -f argument does
|
||||
;; not necessarily overwrite all files, leading to
|
||||
;; indeterministic results.
|
||||
(for-each (lambda (pyc)
|
||||
(delete-file pyc))
|
||||
(find-files output "\\.pyc$"))
|
||||
|
||||
(apply invoke
|
||||
`(,,(if (%current-target-system)
|
||||
"python3"
|
||||
'(string-append out
|
||||
"/bin/python3")) "-m"
|
||||
"compileall"
|
||||
"-o"
|
||||
"0"
|
||||
"-o"
|
||||
"1"
|
||||
"-o"
|
||||
"2"
|
||||
"-f" ;force rebuild
|
||||
"--invalidation-mode=unchecked-hash"
|
||||
;; Don't build lib2to3, because it's
|
||||
;; Python 2 code.
|
||||
"-x"
|
||||
"lib2to3/.*"
|
||||
,output)))
|
||||
(map cdr outputs)))))
|
||||
(add-before 'check 'set-TZDIR
|
||||
(lambda* (#:key inputs native-inputs #:allow-other-keys)
|
||||
;; test_email requires the Olson time zone database.
|
||||
(setenv "TZDIR"
|
||||
(string-append (assoc-ref (or native-inputs
|
||||
inputs) "tzdata")
|
||||
"/share/zoneinfo"))))
|
||||
(add-after 'install 'install-sitecustomize.py
|
||||
,(customize-site version)))))
|
||||
(inputs (list bzip2
|
||||
expat
|
||||
gdbm
|
||||
libffi ;for ctypes
|
||||
sqlite ;for sqlite extension
|
||||
openssl
|
||||
readline
|
||||
zlib
|
||||
tcl
|
||||
tk)) ;for tkinter
|
||||
(native-inputs `(("tzdata" ,tzdata-for-tests)
|
||||
("unzip" ,unzip)
|
||||
("zip" ,(@ (gnu packages compression) zip))
|
||||
("pkg-config" ,pkg-config)
|
||||
("sitecustomize.py" ,(local-file (search-auxiliary-file
|
||||
"python/sitecustomize.py")))
|
||||
;; When cross-compiling, a native version of Python itself is needed.
|
||||
,@(if (%current-target-system)
|
||||
`(("python" ,this-package)
|
||||
("which" ,which))
|
||||
'())))
|
||||
(native-search-paths
|
||||
(list (guix-pythonpath-search-path version)
|
||||
;; Used to locate tzdata by the zoneinfo module introduced in
|
||||
;; Python 3.9.
|
||||
(search-path-specification
|
||||
(variable "PYTHONTZPATH")
|
||||
(files (list "share/zoneinfo")))))))
|
||||
|
||||
(define-public python-3.12
|
||||
(package
|
||||
(name "python-next")
|
||||
|
|
Loading…
Add table
Reference in a new issue