summaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorTanguy Le Carrour <tanguy@bioneland.org>2020-12-14 09:42:40 +0100
committerLudovic Courtès <ludo@gnu.org>2020-12-14 10:34:31 +0100
commit5fe87ef51c0b6c41ad8f53579f0fd515f0ab059e (patch)
treede59d443927d91df31473eb3f5224affbcad9998 /gnu
parent9f3cb56038392e76c001d3da4176d5363186871a (diff)
gnu: Add python-3.9.
* gnu/packages/python.scm (python-3.9): New variable. * gnu/packages/patches/python-3.9-fix-tests.patch: New file. * gnu/local.mk (dist_patch_DATA): Add it. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'gnu')
-rw-r--r--gnu/local.mk1
-rw-r--r--gnu/packages/patches/python-3.9-fix-tests.patch370
-rw-r--r--gnu/packages/python.scm25
3 files changed, 396 insertions, 0 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index 7d0458ca058..0b4cf238387 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1513,6 +1513,7 @@ dist_patch_DATA = \
1513 %D%/packages/patches/python-3-search-paths.patch \ 1513 %D%/packages/patches/python-3-search-paths.patch \
1514 %D%/packages/patches/python-3-fix-tests.patch \ 1514 %D%/packages/patches/python-3-fix-tests.patch \
1515 %D%/packages/patches/python-3.8-fix-tests.patch \ 1515 %D%/packages/patches/python-3.8-fix-tests.patch \
1516 %D%/packages/patches/python-3.9-fix-tests.patch \
1516 %D%/packages/patches/python-CVE-2018-14647.patch \ 1517 %D%/packages/patches/python-CVE-2018-14647.patch \
1517 %D%/packages/patches/python-aionotify-0.2.0-py3.8.patch \ 1518 %D%/packages/patches/python-aionotify-0.2.0-py3.8.patch \
1518 %D%/packages/patches/python-argcomplete-1.11.1-fish31.patch \ 1519 %D%/packages/patches/python-argcomplete-1.11.1-fish31.patch \
diff --git a/gnu/packages/patches/python-3.9-fix-tests.patch b/gnu/packages/patches/python-3.9-fix-tests.patch
new file mode 100644
index 00000000000..dc6b8c4cc8d
--- /dev/null
+++ b/gnu/packages/patches/python-3.9-fix-tests.patch
@@ -0,0 +1,370 @@
1See the discussion about the issues fixed here at:
2http://bugs.python.org/issue20868 .
3
4diff --git a/Lib/ctypes/test/test_callbacks.py b/Lib/ctypes/test/test_callbacks.py
5--- a/Lib/ctypes/test/test_callbacks.py
6+++ b/Lib/ctypes/test/test_callbacks.py
7@@ -3,6 +3,7 @@ import unittest
8 from ctypes import *
9 from ctypes.test import need_symbol
10 import _ctypes_test
11+import platform
12
13 class Callbacks(unittest.TestCase):
14 functype = CFUNCTYPE
15@@ -176,6 +177,8 @@ class SampleCallbacksTestCase(unittest.TestCase):
16
17 self.assertLess(diff, 0.01, "%s not less than 0.01" % diff)
18
19+ @unittest.skipIf(platform.machine() in ['mips64'],
20+ "This test fails on this platform")
21 def test_issue_8959_a(self):
22 from ctypes.util import find_library
23 libc_path = find_library("c")
24diff --git a/Lib/ctypes/test/test_libc.py b/Lib/ctypes/test/test_libc.py
25--- a/Lib/ctypes/test/test_libc.py
26+++ b/Lib/ctypes/test/test_libc.py
27@@ -2,6 +2,7 @@ import unittest
28
29 from ctypes import *
30 import _ctypes_test
31+import platform
32
33 lib = CDLL(_ctypes_test.__file__)
34
35@@ -17,6 +18,8 @@ class LibTest(unittest.TestCase):
36 import math
37 self.assertEqual(lib.my_sqrt(2.0), math.sqrt(2.0))
38
39+ @unittest.skipIf(platform.machine() in ['mips64'],
40+ "This test fails on this platform")
41 def test_qsort(self):
42 comparefunc = CFUNCTYPE(c_int, POINTER(c_char), POINTER(c_char))
43 lib.my_qsort.argtypes = c_void_p, c_size_t, c_size_t, comparefunc
44diff --git a/Lib/distutils/tests/test_archive_util.py b/Lib/distutils/tests/test_archive_util.py
45--- a/Lib/distutils/tests/test_archive_util.py
46+++ b/Lib/distutils/tests/test_archive_util.py
47@@ -333,6 +333,7 @@ class ArchiveUtilTestCase(support.TempdirManager,
48 self.assertEqual(os.path.basename(res), 'archive.tar.xz')
49 self.assertEqual(self._tarinfo(res), self._created_files)
50
51+ @unittest.skipIf(True, "getgrgid(0)[0] raises a KeyError on Guix")
52 def test_make_archive_owner_group(self):
53 # testing make_archive with owner and group, with various combinations
54 # this works even if there's not gid/uid support
55@@ -362,6 +363,7 @@ class ArchiveUtilTestCase(support.TempdirManager,
56
57 @unittest.skipUnless(ZLIB_SUPPORT, "Requires zlib")
58 @unittest.skipUnless(UID_GID_SUPPORT, "Requires grp and pwd support")
59+ @unittest.skipIf(True, "getgrgid(0)[0] raises a KeyError on Guix")
60 def test_tarfile_root_owner(self):
61 tmpdir = self._create_files()
62 base_name = os.path.join(self.mkdtemp(), 'archive')
63diff --git a/Lib/distutils/tests/test_sdist.py b/Lib/distutils/tests/test_sdist.py
64--- a/Lib/distutils/tests/test_sdist.py
65+++ b/Lib/distutils/tests/test_sdist.py
66@@ -443,6 +443,7 @@ class SDistTestCase(BasePyPIRCCommandTestCase):
67 "The tar command is not found")
68 @unittest.skipIf(find_executable('gzip') is None,
69 "The gzip command is not found")
70+ @unittest.skipIf(True, "getgrgid(0)[0] raises a KeyError on Guix")
71 def test_make_distribution_owner_group(self):
72 # now building a sdist
73 dist, cmd = self.get_cmd()
74diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing.py
75--- a/Lib/test/_test_multiprocessing.py
76+++ b/Lib/test/_test_multiprocessing.py
77@@ -1473,6 +1473,7 @@ class _TestCondition(BaseTestCase):
78 if pid is not None:
79 os.kill(pid, signal.SIGINT)
80
81+ @unittest.skipIf(True, "This fails for unknown reasons on Guix")
82 def test_wait_result(self):
83 if isinstance(self, ProcessesMixin) and sys.platform != 'win32':
84 pid = os.getpid()
85diff --git a/Lib/test/test_asyncio/test_base_events.py b/Lib/test/test_asyncio/test_base_events.py
86--- a/Lib/test/test_asyncio/test_base_events.py
87+++ b/Lib/test/test_asyncio/test_base_events.py
88@@ -1323,6 +1323,8 @@ class BaseEventLoopWithSelectorTests(test_utils.TestCase):
89 self._test_create_connection_ip_addr(m_socket, False)
90
91 @patch_socket
92+ @unittest.skipUnless(support.is_resource_enabled('network'),
93+ 'network is not enabled')
94 def test_create_connection_service_name(self, m_socket):
95 m_socket.getaddrinfo = socket.getaddrinfo
96 sock = m_socket.socket.return_value
97diff --git a/Lib/test/test_generators.py b/Lib/test/test_generators.py
98--- a/Lib/test/test_generators.py
99+++ b/Lib/test/test_generators.py
100@@ -34,6 +34,7 @@ class SignalAndYieldFromTest(unittest.TestCase):
101 else:
102 return "FAILED"
103
104+ @unittest.skipIf(True, 'Keyboard interrupts do not work in the Guix build environment')
105 def test_raise_and_yield_from(self):
106 gen = self.generator1()
107 gen.send(None)
108diff --git a/Lib/test/test_pathlib.py b/Lib/test/test_pathlib.py
109--- a/Lib/test/test_pathlib.py
110+++ b/Lib/test/test_pathlib.py
111@@ -2134,8 +2134,7 @@ class PosixPathTest(_BasePathTest, unittest.TestCase):
112 self.assertEqual(given, expect)
113 self.assertEqual(set(p.rglob("FILEd*")), set())
114
115- @unittest.skipUnless(hasattr(pwd, 'getpwall'),
116- 'pwd module does not expose getpwall()')
117+ @unittest.skipIf(True, "Guix builder home is '/' which causes trouble for these tests")
118 def test_expanduser(self):
119 P = self.cls
120 support.import_module('pwd')
121diff --git a/Lib/test/test_pdb.py b/Lib/test/test_pdb.py
122--- a/Lib/test/test_pdb.py
123+++ b/Lib/test/test_pdb.py
124@@ -1150,11 +1150,11 @@ def test_pdb_issue_20766():
125 > <doctest test.test_pdb.test_pdb_issue_20766[0]>(6)test_function()
126 -> print('pdb %d: %s' % (i, sess._previous_sigint_handler))
127 (Pdb) continue
128- pdb 1: <built-in function default_int_handler>
129+ pdb 1: Handlers.SIG_IGN
130 > <doctest test.test_pdb.test_pdb_issue_20766[0]>(5)test_function()
131 -> sess.set_trace(sys._getframe())
132 (Pdb) continue
133- pdb 2: <built-in function default_int_handler>
134+ pdb 2: Handlers.SIG_IGN
135 """
136
137
138diff --git a/Lib/test/test_regrtest.py b/Lib/test/test_regrtest.py
139--- a/Lib/test/test_regrtest.py
140+++ b/Lib/test/test_regrtest.py
141@@ -762,6 +762,7 @@ class ArgsTestCase(BaseTestCase):
142 output = self.run_tests('--fromfile', filename)
143 self.check_executed_tests(output, tests)
144
145+ @unittest.skipIf(True, 'Keyboard interrupts do not work in the Guix build environment.')
146 def test_interrupted(self):
147 code = TEST_INTERRUPTED
148 test = self.create_test('sigint', code=code)
149@@ -779,6 +780,7 @@ class ArgsTestCase(BaseTestCase):
150 % (self.TESTNAME_REGEX, len(tests)))
151 self.check_line(output, regex)
152
153+ @unittest.skipIf(True, 'Keyboard interrupts do not work in the Guix build environment.')
154 def test_slowest_interrupted(self):
155 # Issue #25373: test --slowest with an interrupted test
156 code = TEST_INTERRUPTED
157diff --git a/Lib/test/test_resource.py b/Lib/test/test_resource.py
158--- a/Lib/test/test_resource.py
159+++ b/Lib/test/test_resource.py
160@@ -145,6 +145,7 @@ class ResourceTest(unittest.TestCase):
161
162 @unittest.skipUnless(hasattr(resource, 'prlimit'), 'no prlimit')
163 @support.requires_linux_version(2, 6, 36)
164+ @unittest.skipIf(True, "Bug: the PermissionError is not raised")
165 def test_prlimit(self):
166 self.assertRaises(TypeError, resource.prlimit)
167 self.assertRaises(ProcessLookupError, resource.prlimit,
168diff --git a/Lib/test/test_shutil.py b/Lib/test/test_shutil.py
169--- a/Lib/test/test_shutil.py
170+++ b/Lib/test/test_shutil.py
171@@ -1428,6 +1428,7 @@ class TestArchives(BaseTest, unittest.TestCase):
172 self.assertRaises(ValueError, make_archive, base_name, 'xxx')
173
174 @support.requires_zlib()
175+ @unittest.skipIf(True, "getgrgid(0)[0] raises a KeyError on Guix")
176 def test_make_archive_owner_group(self):
177 # testing make_archive with owner and group, with various combinations
178 # this works even if there's not gid/uid support
179@@ -1456,6 +1457,7 @@ class TestArchives(BaseTest, unittest.TestCase):
180
181
182 @support.requires_zlib()
183+ @unittest.skipIf(True, "getgrgid(0)[0] raises a KeyError on Guix")
184 @unittest.skipUnless(UID_GID_SUPPORT, "Requires grp and pwd support")
185 def test_tarfile_root_owner(self):
186 root_dir, base_dir = self._create_files()
187diff --git a/Lib/test/test_unicodedata.py b/Lib/test/test_unicodedata.py
188--- a/Lib/test/test_unicodedata.py
189+++ b/Lib/test/test_unicodedata.py
190@@ -320,6 +320,7 @@ class NormalizationTest(unittest.TestCase):
191 data = [int(x, 16) for x in data.split(" ")]
192 return "".join([chr(x) for x in data])
193
194+ @unittest.skipIf(True, 'Network is not available in the Guix build environment')
195 def test_normalization(self):
196 TESTDATAFILE = "NormalizationTest.txt"
197 TESTDATAURL = f"http://www.pythontest.net/unicode/{unicodedata.unidata_version}/{TESTDATAFILE}"
198diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py
199--- a/Lib/test/test_socket.py
200+++ b/Lib/test/test_socket.py
201@@ -875,6 +875,8 @@ class GeneralModuleTests(unittest.TestCase):
202 if not fqhn in all_host_names:
203 self.fail("Error testing host resolution mechanisms. (fqdn: %s, all: %s)" % (fqhn, repr(all_host_names)))
204
205+ @unittest.skipUnless(support.is_resource_enabled('network'),
206+ 'network is not enabled')
207 def test_host_resolution(self):
208 for addr in [support.HOSTv4, '10.0.0.1', '255.255.255.255']:
209 self.assertEqual(socket.gethostbyname(addr), addr)
210@@ -1004,6 +1006,8 @@ class GeneralModuleTests(unittest.TestCase):
211 self.assertWarns(DeprecationWarning, socket.ntohs, k)
212 self.assertWarns(DeprecationWarning, socket.htons, k)
213
214+ @unittest.skipUnless(os.path.exists("/etc/services"),
215+ "getservbyname uses /etc/services, which is not in the chroot")
216 def testGetServBy(self):
217 eq = self.assertEqual
218 # Find one service that exists, then check all the related interfaces.
219@@ -1358,6 +1362,8 @@ class GeneralModuleTests(unittest.TestCase):
220 raise
221 self.assertRaises(TypeError, s.ioctl, socket.SIO_LOOPBACK_FAST_PATH, None)
222
223+ @unittest.skipUnless(os.path.exists("/etc/gai.conf"),
224+ "getaddrinfo() will fail")
225 def testGetaddrinfo(self):
226 try:
227 socket.getaddrinfo('localhost', 80)
228@@ -1440,6 +1446,8 @@ class GeneralModuleTests(unittest.TestCase):
229 # only IP addresses are allowed
230 self.assertRaises(OSError, socket.getnameinfo, ('mail.python.org',0), 0)
231
232+ @unittest.skipUnless(os.path.exists("/etc/gai.conf"),
233+ "getaddrinfo() will fail")
234 @unittest.skipUnless(support.is_resource_enabled('network'),
235 'network is not enabled')
236 def test_idna(self):
237diff --git a/Lib/test/test_spwd.py b/Lib/test/test_spwd.py
238--- a/Lib/test/test_spwd.py
239+++ b/Lib/test/test_spwd.py
240@@ -5,8 +5,7 @@ from test import support
241 spwd = support.import_module('spwd')
242
243
244-@unittest.skipUnless(hasattr(os, 'geteuid') and os.geteuid() == 0,
245- 'root privileges required')
246+@unittest.skipUnless(os.path.exists("/etc/shadow"), 'spwd tests require /etc/shadow')
247 class TestSpwdRoot(unittest.TestCase):
248
249 def test_getspall(self):
250@@ -56,8 +55,7 @@ class TestSpwdRoot(unittest.TestCase):
251 self.assertRaises(TypeError, spwd.getspnam, bytes_name)
252
253
254-@unittest.skipUnless(hasattr(os, 'geteuid') and os.geteuid() != 0,
255- 'non-root user required')
256+@unittest.skipUnless(os.path.exists("/etc/shadow"), 'spwd tests require /etc/shadow')
257 class TestSpwdNonRoot(unittest.TestCase):
258
259 def test_getspnam_exception(self):
260diff --git a/Lib/test/test_tarfile.py b/Lib/test/test_tarfile.py
261--- a/Lib/test/test_tarfile.py
262+++ b/Lib/test/test_tarfile.py
263@@ -2509,9 +2509,12 @@ def root_is_uid_gid_0():
264 import pwd, grp
265 except ImportError:
266 return False
267- if pwd.getpwuid(0)[0] != 'root':
268- return False
269- if grp.getgrgid(0)[0] != 'root':
270+ try:
271+ if pwd.getpwuid(0)[0] != 'root':
272+ return False
273+ if grp.getgrgid(0)[0] != 'root':
274+ return False
275+ except KeyError:
276 return False
277 return True
278
279diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py
280--- a/Lib/test/test_threading.py
281+++ b/Lib/test/test_threading.py
282@@ -1249,6 +1249,7 @@ class MiscTestCase(unittest.TestCase):
283
284
285 class InterruptMainTests(unittest.TestCase):
286+ @unittest.skipIf(True, 'Keyboard interrupts do not work in the Guix build container.')
287 def test_interrupt_main_subthread(self):
288 # Calling start_new_thread with a function that executes interrupt_main
289 # should raise KeyboardInterrupt upon completion.
290@@ -1260,6 +1261,8 @@ class InterruptMainTests(unittest.TestCase):
291 t.join()
292 t.join()
293
294+
295+ @unittest.skipIf(True, 'Keyboard interrupts do not work in the Guix build container.')
296 def test_interrupt_main_mainthread(self):
297 # Make sure that if interrupt_main is called in main thread that
298 # KeyboardInterrupt is raised instantly.
299diff --git a/Tools/scripts/run_tests.py b/Tools/scripts/run_tests.py
300--- a/Tools/scripts/run_tests.py
301+++ b/Tools/scripts/run_tests.py
302@@ -39,7 +39,7 @@ def main(regrtest_args):
303 if not any(is_multiprocess_flag(arg) for arg in regrtest_args):
304 args.extend(['-j', '0']) # Use all CPU cores
305 if not any(is_resource_use_flag(arg) for arg in regrtest_args):
306- args.extend(['-u', 'all,-largefile,-audio,-gui'])
307+ args.extend(['-u', 'all,-largefile,-audio,-gui,-network'])
308 args.extend(regrtest_args)
309 print(' '.join(args))
310 if sys.platform == 'win32':
311diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing.py
312index 1474624..887f8ee 100644
313--- a/Lib/test/_test_multiprocessing.py
314+++ b/Lib/test/_test_multiprocessing.py
315@@ -3801,6 +3801,7 @@ class _TestSharedMemory(BaseTestCase):
316 sms.close()
317
318 @unittest.skipIf(os.name != "posix", "not feasible in non-posix platforms")
319+ @unittest.skipUnless(sys.stdin.isatty(), "KeyboardInterrupts require a TTY device")
320 def test_shared_memory_SharedMemoryServer_ignores_sigint(self):
321 # bpo-36368: protect SharedMemoryManager server process from
322 # KeyboardInterrupt signals.
323diff --git a/Lib/test/test_signal.py b/Lib/test/test_signal.py
324index d41e94b..a1c15e7 100644
325--- a/Lib/test/test_signal.py
326+++ b/Lib/test/test_signal.py
327@@ -78,6 +78,7 @@ class PosixTests(unittest.TestCase):
328 self.assertLess(len(s), signal.NSIG)
329
330 @unittest.skipUnless(sys.executable, "sys.executable required.")
331+ @unittest.skipUnless(sys.stdin.isatty(), "KeyboardInterrupts require a TTY device")
332 def test_keyboard_interrupt_exit_code(self):
333 """KeyboardInterrupt triggers exit via SIGINT."""
334 process = subprocess.run(
335@@ -128,6 +129,7 @@ class WindowsSignalTests(unittest.TestCase):
336 signal.signal(7, handler)
337
338 @unittest.skipUnless(sys.executable, "sys.executable required.")
339+ @unittest.skipUnless(sys.stdin.isatty(), "KeyboardInterrupts require a TTY device")
340 def test_keyboard_interrupt_exit_code(self):
341 """KeyboardInterrupt triggers an exit using STATUS_CONTROL_C_EXIT."""
342 # We don't test via os.kill(os.getpid(), signal.CTRL_C_EVENT) here
343@@ -1245,6 +1247,7 @@ class StressTest(unittest.TestCase):
344
345 class RaiseSignalTest(unittest.TestCase):
346
347+ @unittest.skipUnless(sys.stdin.isatty(), "KeyboardInterrupts require a TTY device")
348 def test_sigint(self):
349 with self.assertRaises(KeyboardInterrupt):
350 signal.raise_signal(signal.SIGINT)
351@@ -1279,6 +1279,7 @@ class PidfdSignalTest(unittest.TestCase):
352 hasattr(signal, "pidfd_send_signal"),
353 "pidfd support not built in",
354 )
355+ @unittest.skipUnless(sys.stdin.isatty(), "KeyboardInterrupts require a TTY device")
356 def test_pidfd_send_signal(self):
357 with self.assertRaises(OSError) as cm:
358 signal.pidfd_send_signal(0, signal.SIGINT)
359diff --git a/Lib/ctypes/test/test_find.py b/Lib/ctypes/test/test_find.py
360index 92ac184..49eec2c 100644
361--- a/Lib/ctypes/test/test_find.py
362+++ b/Lib/ctypes/test/test_find.py
363@@ -116,6 +116,7 @@ class FindLibraryLinux(unittest.TestCase):
364 with unittest.mock.patch("ctypes.util._findSoname_ldconfig", lambda *args: None):
365 self.assertNotEqual(find_library('c'), None)
366
367+ @unittest.skipIf(True, "This fails for unknown reasons on Guix")
368 def test_find_library_with_ld(self):
369 with unittest.mock.patch("ctypes.util._findSoname_ldconfig", lambda *args: None), \
370 unittest.mock.patch("ctypes.util._findLib_gcc", lambda *args: None):
diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index 43704bccae2..fa9bf10e074 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -520,6 +520,31 @@ data types.")
520 (version-major+minor version) 520 (version-major+minor version)
521 "/site-packages")))))))) 521 "/site-packages"))))))))
522 522
523(define-public python-3.9
524 (package (inherit python-3.8)
525 (name "python-next")
526 (version "3.9.1")
527 (source (origin
528 (method url-fetch)
529 (uri (string-append "https://www.python.org/ftp/python/"
530 version "/Python-" version ".tar.xz"))
531 (patches (search-patches
532 "python-3.9-fix-tests.patch"
533 "python-3-deterministic-build-info.patch"
534 "python-3-search-paths.patch"))
535 (sha256
536 (base32
537 "1zq3k4ymify5ig739zyvx9s2ainvchxb1zpy139z74krr653y74r"))
538 (modules '((guix build utils)))
539 (snippet
540 '(begin
541 ;; Delete the bundled copy of libexpat.
542 (delete-file-recursively "Modules/expat")
543 (substitute* "Modules/Setup"
544 ;; Link Expat instead of embedding the bundled one.
545 (("^#pyexpat.*") "pyexpat pyexpat.c -lexpat\n"))
546 #t))))))
547
523;; Current 3.x version. 548;; Current 3.x version.
524(define-public python-3 python-3.8) 549(define-public python-3 python-3.8)
525 550