python3: update 3.9.7 -> 3.10.0

native and target 0001-Lib-sysconfig.py-use-libdir-values-from-configuratio.patch
replaced by native-only 0001-Lib-sysconfig.py-use-prefix-value-from-build-configu.patch
which is more reboust against upstream changes, and keeps target code unmodified.

This however necessitated adding 0001-sysconfig.py-use-platlibdir-also-for-purelib.patch
to avoid hardcoding 'lib' on target builds as libdir.

Drop chunk from 0001-distutils-sysconfig-append-STAGING_LIBDIR-python-sys.patch as
upstream now uses sysconfig directly inside distutils.

Add 0001-Lib-pty.py-handle-stdin-I-O-errors-same-way-as-maste.patch and
0001-multiprocessing-disable-a-failing-test.patch to address ptest failures.

License-Update: copyright years, case corrections.

(From OE-Core rev: 72a75043a946f7db01d3ec04c8889e055f542cca)

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Alexander Kanavin
2021-10-11 11:40:40 +02:00
committed by Richard Purdie
parent 11df8c79a7
commit fae4ba632b
11 changed files with 160 additions and 84 deletions

View File

@@ -1,4 +1,4 @@
PYTHON_BASEVERSION = "3.9" PYTHON_BASEVERSION = "3.10"
PYTHON_ABI = "" PYTHON_ABI = ""
PYTHON_DIR = "python${PYTHON_BASEVERSION}" PYTHON_DIR = "python${PYTHON_BASEVERSION}"
PYTHON_PN = "python3" PYTHON_PN = "python3"

View File

@@ -1,4 +1,4 @@
From 9da913bf5f39c6fe737219af7419170574d6fbfb Mon Sep 17 00:00:00 2001 From cebb772d718a8f798ed5ae311a6e3e61534bea95 Mon Sep 17 00:00:00 2001
From: Jeremy Puhlman <jpuhlman@mvista.com> From: Jeremy Puhlman <jpuhlman@mvista.com>
Date: Wed, 4 Mar 2020 00:06:42 +0000 Date: Wed, 4 Mar 2020 00:06:42 +0000
Subject: [PATCH] Don't search system for headers/libraries Subject: [PATCH] Don't search system for headers/libraries
@@ -11,10 +11,10 @@ Signed-off-by: Jeremy Puhlman <jpuhlman@mvista.com>
1 file changed, 2 insertions(+), 2 deletions(-) 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/setup.py b/setup.py diff --git a/setup.py b/setup.py
index a0bf9ea..da099bf 100644 index 95e3e11..32a4d42 100644
--- a/setup.py --- a/setup.py
+++ b/setup.py +++ b/setup.py
@@ -674,8 +674,8 @@ class PyBuildExt(build_ext): @@ -840,8 +840,8 @@ class PyBuildExt(build_ext):
add_dir_to_list(self.compiler.include_dirs, add_dir_to_list(self.compiler.include_dirs,
sysconfig.get_config_var("INCLUDEDIR")) sysconfig.get_config_var("INCLUDEDIR"))

View File

@@ -0,0 +1,49 @@
From d8521ee967937184eadc59fff1a30740ad181a98 Mon Sep 17 00:00:00 2001
From: Alexander Kanavin <alex@linutronix.de>
Date: Thu, 16 Sep 2021 16:35:37 +0200
Subject: [PATCH] Lib/pty.py: handle stdin I/O errors same way as master I/O
errors
reading stdin can throw the same I/O errors as reading from master fd does,
e.g. when running under Yocto's test harness:
======================================================================
ERROR: test_spawn_doesnt_hang (test.test_pty.PtyTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/lib/python3.10/test/test_pty.py", line 316, in test_spawn_doesnt_hang
pty.spawn([sys.executable, '-c', 'print("hi there")'])
File "/usr/lib/python3.10/pty.py", line 181, in spawn
_copy(master_fd, master_read, stdin_read)
File "/usr/lib/python3.10/pty.py", line 157, in _copy
data = stdin_read(STDIN_FILENO)
File "/usr/lib/python3.10/pty.py", line 132, in _read
return os.read(fd, 1024)
OSError: [Errno 5] Input/output error
So let's treat both channels the same.
Upstream-Status: Submitted [https://github.com/python/cpython/pull/28388]
Signed-off-by: Alexander Kanavin <alex@linutronix.de>
---
Lib/pty.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/Lib/pty.py b/Lib/pty.py
index 8d8ce40df5..35439c6b96 100644
--- a/Lib/pty.py
+++ b/Lib/pty.py
@@ -154,7 +154,10 @@ def _copy(master_fd, master_read=_read, stdin_read=_read):
os.write(STDOUT_FILENO, data)
if STDIN_FILENO in rfds:
- data = stdin_read(STDIN_FILENO)
+ try:
+ data = stdin_read(STDIN_FILENO)
+ except OSError:
+ data = b""
if not data:
fds.remove(STDIN_FILENO)
else:
--
2.20.1

View File

@@ -1,35 +0,0 @@
From deeedd1b8799294ab276ab7dbbfdb59c1dacc9a2 Mon Sep 17 00:00:00 2001
From: Alexander Kanavin <alex.kanavin@gmail.com>
Date: Thu, 22 Oct 2020 13:10:34 +0200
Subject: [PATCH] Lib/sysconfig.py: use libdir values from configuration file
This allows correctly substituting them for target installs using
native python.
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
---
Lib/sysconfig.py | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py
index bf04ac5..ed0462b 100644
--- a/Lib/sysconfig.py
+++ b/Lib/sysconfig.py
@@ -20,10 +20,10 @@ __all__ = [
_INSTALL_SCHEMES = {
'posix_prefix': {
- 'stdlib': '{installed_base}/{platlibdir}/python{py_version_short}',
- 'platstdlib': '{platbase}/{platlibdir}/python{py_version_short}',
- 'purelib': '{base}/lib/python{py_version_short}/site-packages',
- 'platlib': '{platbase}/{platlibdir}/python{py_version_short}/site-packages',
+ 'stdlib': '{LIBDEST}',
+ 'platstdlib': '{LIBDEST}',
+ 'purelib': '{LIBDEST}/site-packages',
+ 'platlib': '{LIBDEST}/site-packages',
'include':
'{installed_base}/include/python{py_version_short}{abiflags}',
'platinclude':
--
2.24.0

View File

@@ -0,0 +1,34 @@
From aceaa16e25a8ab6a00f906c340843999635c8e23 Mon Sep 17 00:00:00 2001
From: Alexander Kanavin <alex@linutronix.de>
Date: Fri, 10 Sep 2021 12:28:31 +0200
Subject: [PATCH] Lib/sysconfig.py: use prefix value from build configuration
file
This allows correctly substituting them for target installs using
native python.
Upstream-Status: Inappropriate [oe-core cross builds]
Signed-off-by: Alexander Kanavin <alex@linutronix.de>
---
Lib/sysconfig.py | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py
index 95b48f6..84f6427 100644
--- a/Lib/sysconfig.py
+++ b/Lib/sysconfig.py
@@ -613,6 +613,11 @@ def get_config_vars(*args):
_init_non_posix(_CONFIG_VARS)
if os.name == 'posix':
_init_posix(_CONFIG_VARS)
+ _CONFIG_VARS['installed_base'] = _CONFIG_VARS['prefix']
+ _CONFIG_VARS['base'] = _CONFIG_VARS['prefix']
+ _CONFIG_VARS['installed_platbase'] = _CONFIG_VARS['prefix']
+ _CONFIG_VARS['platbase'] = _CONFIG_VARS['prefix']
+ _CONFIG_VARS['platlibdir'] = _CONFIG_VARS['PLATLIBDIR']
# For backward compatibility, see issue19555
SO = _CONFIG_VARS.get('EXT_SUFFIX')
if SO is not None:
--
2.20.1

View File

@@ -1,4 +1,4 @@
From e65bfe22c858872b08366aff49119d4145a77f40 Mon Sep 17 00:00:00 2001 From 3a98c2eab187289dc8c55e36738c2c0f4216d906 Mon Sep 17 00:00:00 2001
From: Alexander Kanavin <alex.kanavin@gmail.com> From: Alexander Kanavin <alex.kanavin@gmail.com>
Date: Thu, 31 Jan 2019 16:46:30 +0100 Date: Thu, 31 Jan 2019 16:46:30 +0100
Subject: [PATCH] distutils/sysconfig: append Subject: [PATCH] distutils/sysconfig: append
@@ -10,28 +10,14 @@ Upstream-Status: Inappropriate [oe-core specific]
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
--- ---
Lib/distutils/sysconfig.py | 2 ++ Lib/sysconfig.py | 2 ++
Lib/sysconfig.py | 2 ++ 1 file changed, 2 insertions(+)
2 files changed, 4 insertions(+)
diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py
index b51629e..2df348c 100644
--- a/Lib/distutils/sysconfig.py
+++ b/Lib/distutils/sysconfig.py
@@ -438,6 +438,8 @@ def _init_posix():
platform=sys.platform,
multiarch=getattr(sys.implementation, '_multiarch', ''),
))
+ if 'STAGING_LIBDIR' in os.environ:
+ sys.path.append(os.environ['STAGING_LIBDIR']+'/python-sysconfigdata')
_temp = __import__(name, globals(), locals(), ['build_time_vars'], 0)
build_time_vars = _temp.build_time_vars
global _config_vars
diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py
index b2d790b..405273c 100644 index a78c0b1..f5c5efe 100644
--- a/Lib/sysconfig.py --- a/Lib/sysconfig.py
+++ b/Lib/sysconfig.py +++ b/Lib/sysconfig.py
@@ -419,6 +419,8 @@ def _init_posix(vars): @@ -474,6 +474,8 @@ def _init_posix(vars):
"""Initialize the module as appropriate for POSIX systems.""" """Initialize the module as appropriate for POSIX systems."""
# _sysconfigdata is generated at build time, see _generate_posix_vars() # _sysconfigdata is generated at build time, see _generate_posix_vars()
name = _get_sysconfigdata_name() name = _get_sysconfigdata_name()

View File

@@ -1,4 +1,4 @@
From 7019ba184b828ed7253750cf409fc5760ef90a54 Mon Sep 17 00:00:00 2001 From bad7e6a625436402a01d03021fb9ccd58bc9930f Mon Sep 17 00:00:00 2001
From: Alexander Kanavin <alex.kanavin@gmail.com> From: Alexander Kanavin <alex.kanavin@gmail.com>
Date: Thu, 9 Jan 2020 17:44:05 +0100 Date: Thu, 9 Jan 2020 17:44:05 +0100
Subject: [PATCH] setup.py: pass missing libraries to Extension for Subject: [PATCH] setup.py: pass missing libraries to Extension for
@@ -50,20 +50,21 @@ Upstream-Status: Pending
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
--- ---
setup.py | 2 +- setup.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-) 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/setup.py b/setup.py diff --git a/setup.py b/setup.py
index ec3f2a4..b0f1541 100644 index d92face..f42bcbb 100644
--- a/setup.py --- a/setup.py
+++ b/setup.py +++ b/setup.py
@@ -1671,7 +1671,7 @@ class PyBuildExt(build_ext): @@ -1836,7 +1836,7 @@ class PyBuildExt(build_ext):
libraries=libs, if (sysconfig.get_config_var('HAVE_SEM_OPEN') and not
include_dirs=["Modules/_multiprocessing"])) sysconfig.get_config_var('POSIX_SEMAPHORES_NOT_ENABLED')):
multiprocessing_srcs.append('_multiprocessing/semaphore.c')
- self.add(Extension('_multiprocessing', multiprocessing_srcs, - self.add(Extension('_multiprocessing', multiprocessing_srcs,
+ self.add(Extension('_multiprocessing', multiprocessing_srcs, libraries=['pthread'], + self.add(Extension('_multiprocessing', multiprocessing_srcs, libraries=['pthread'],
include_dirs=["Modules/_multiprocessing"])) include_dirs=["Modules/_multiprocessing"]))
def detect_uuid(self): if (not MS_WINDOWS and

View File

@@ -0,0 +1,30 @@
From 93346d1a2f5d4f7085391bc7c1230d85ebe00606 Mon Sep 17 00:00:00 2001
From: Alexander Kanavin <alex@linutronix.de>
Date: Sun, 12 Sep 2021 21:44:36 +0200
Subject: [PATCH] sysconfig.py: use platlibdir also for purelib
This is needed in multilib configurations where hardcoding 'lib'
is not correct.
Upstream-Status: Inappropriate [oe-core specific]
Signed-off-by: Alexander Kanavin <alex@linutronix.de>
---
Lib/sysconfig.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py
index b70d392..c418acd 100644
--- a/Lib/sysconfig.py
+++ b/Lib/sysconfig.py
@@ -27,7 +27,7 @@ _INSTALL_SCHEMES = {
'posix_prefix': {
'stdlib': '{installed_base}/{platlibdir}/python{py_version_short}',
'platstdlib': '{platbase}/{platlibdir}/python{py_version_short}',
- 'purelib': '{base}/lib/python{py_version_short}/site-packages',
+ 'purelib': '{base}/{platlibdir}/python{py_version_short}/site-packages',
'platlib': '{platbase}/{platlibdir}/python{py_version_short}/site-packages',
'include':
'{installed_base}/include/python{py_version_short}{abiflags}',
--
2.20.1

View File

@@ -1,7 +1,7 @@
From c52fa7948ef109db1132fdc1aee0b68f8d767b4e Mon Sep 17 00:00:00 2001 From f6411021856bafedd784748ec33494151e783b51 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com> From: Khem Raj <raj.khem@gmail.com>
Date: Tue, 14 May 2013 15:00:26 -0700 Date: Tue, 14 May 2013 15:00:26 -0700
Subject: [PATCH 1/2] python3: Add target and native recipes Subject: [PATCH] python3: Add target and native recipes
Upstream-Status: Inappropriate [embedded specific] Upstream-Status: Inappropriate [embedded specific]
@@ -17,10 +17,10 @@ Signed-off-by: Alejandro Hernandez <alejandro.hernandez@linux.intel.com>
1 file changed, 11 insertions(+), 3 deletions(-) 1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py
index 4774e12..ccf7d58 100644 index 3414a76..361d3a1 100644
--- a/Lib/distutils/sysconfig.py --- a/Lib/distutils/sysconfig.py
+++ b/Lib/distutils/sysconfig.py +++ b/Lib/distutils/sysconfig.py
@@ -95,7 +95,9 @@ def get_python_inc(plat_specific=0, prefix=None): @@ -277,7 +277,9 @@ def get_python_inc(plat_specific=0, prefix=None):
If 'prefix' is supplied, use it instead of sys.base_prefix or If 'prefix' is supplied, use it instead of sys.base_prefix or
sys.base_exec_prefix -- i.e., ignore 'plat_specific'. sys.base_exec_prefix -- i.e., ignore 'plat_specific'.
""" """
@@ -31,7 +31,7 @@ index 4774e12..ccf7d58 100644
prefix = plat_specific and BASE_EXEC_PREFIX or BASE_PREFIX prefix = plat_specific and BASE_EXEC_PREFIX or BASE_PREFIX
if os.name == "posix": if os.name == "posix":
if python_build: if python_build:
@@ -138,7 +140,13 @@ def get_python_lib(plat_specific=0, standard_lib=0, prefix=None): @@ -320,7 +322,13 @@ def get_python_lib(plat_specific=0, standard_lib=0, prefix=None):
If 'prefix' is supplied, use it instead of sys.base_prefix or If 'prefix' is supplied, use it instead of sys.base_prefix or
sys.base_exec_prefix -- i.e., ignore 'plat_specific'. sys.base_exec_prefix -- i.e., ignore 'plat_specific'.
""" """
@@ -46,7 +46,7 @@ index 4774e12..ccf7d58 100644
if standard_lib: if standard_lib:
prefix = plat_specific and BASE_EXEC_PREFIX or BASE_PREFIX prefix = plat_specific and BASE_EXEC_PREFIX or BASE_PREFIX
else: else:
@@ -152,7 +160,7 @@ def get_python_lib(plat_specific=0, standard_lib=0, prefix=None): @@ -334,7 +342,7 @@ def get_python_lib(plat_specific=0, standard_lib=0, prefix=None):
else: else:
# Pure Python # Pure Python
libdir = "lib" libdir = "lib"
@@ -56,5 +56,5 @@ index 4774e12..ccf7d58 100644
if standard_lib: if standard_lib:
return libpython return libpython
-- --
2.24.0 2.20.1

View File

@@ -1,3 +1,8 @@
From 8b8583fb4f2bb3421e31ef06d17c04deec431c7e Mon Sep 17 00:00:00 2001
From: Richard Purdie <richard.purdie@linuxfoundation.org>
Date: Tue, 13 Jul 2021 23:19:29 +0100
Subject: [PATCH] python3: Fix make race
libainstall installs python-config.py but the .pyc cache files are generated libainstall installs python-config.py but the .pyc cache files are generated
by the libinstall target. This means some builds may not generate the pyc files by the libinstall target. This means some builds may not generate the pyc files
for python-config.py depending on the order things happen in. This means builds for python-config.py depending on the order things happen in. This means builds
@@ -8,14 +13,18 @@ Add a dependency to avoid the race.
Upstream-Status: Pending Upstream-Status: Pending
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Index: Python-3.9.6/Makefile.pre.in ---
=================================================================== Makefile.pre.in | 2 +-
--- Python-3.9.6.orig/Makefile.pre.in 1 file changed, 1 insertion(+), 1 deletion(-)
+++ Python-3.9.6/Makefile.pre.in
@@ -1486,7 +1486,7 @@ LIBSUBDIRS= tkinter tkinter/test tkinter diff --git a/Makefile.pre.in b/Makefile.pre.in
venv venv/scripts venv/scripts/common venv/scripts/posix \ index 69d47a2..c471b60 100644
curses pydoc_data \ --- a/Makefile.pre.in
zoneinfo +++ b/Makefile.pre.in
@@ -1528,7 +1528,7 @@ TESTSUBDIRS= ctypes/test \
unittest/test unittest/test/testmock
TEST_MODULES=@TEST_MODULES@
-libinstall: build_all $(srcdir)/Modules/xxmodule.c -libinstall: build_all $(srcdir)/Modules/xxmodule.c
+libinstall: build_all $(srcdir)/Modules/xxmodule.c libainstall +libinstall: build_all $(srcdir)/Modules/xxmodule.c libainstall
@for i in $(SCRIPTDIR) $(LIBDEST); \ @for i in $(SCRIPTDIR) $(LIBDEST); \

View File

@@ -4,7 +4,7 @@ DESCRIPTION = "Python is a programming language that lets you work more quickly
LICENSE = "PSFv2" LICENSE = "PSFv2"
SECTION = "devel/python" SECTION = "devel/python"
LIC_FILES_CHKSUM = "file://LICENSE;md5=c22d2438294c784731bf9dd224a467b7" LIC_FILES_CHKSUM = "file://LICENSE;md5=3dd7bed622743ef9b77169b3736f7990"
SRC_URI = "http://www.python.org/ftp/python/${PV}/Python-${PV}.tar.xz \ SRC_URI = "http://www.python.org/ftp/python/${PV}/Python-${PV}.tar.xz \
file://run-ptest \ file://run-ptest \
@@ -28,18 +28,20 @@ SRC_URI = "http://www.python.org/ftp/python/${PV}/Python-${PV}.tar.xz \
file://0001-setup.py-pass-missing-libraries-to-Extension-for-mul.patch \ file://0001-setup.py-pass-missing-libraries-to-Extension-for-mul.patch \
file://0001-Makefile-do-not-compile-.pyc-in-parallel.patch \ file://0001-Makefile-do-not-compile-.pyc-in-parallel.patch \
file://0020-configure.ac-setup.py-do-not-add-a-curses-include-pa.patch \ file://0020-configure.ac-setup.py-do-not-add-a-curses-include-pa.patch \
file://0001-Lib-sysconfig.py-use-libdir-values-from-configuratio.patch \
file://0001-Skip-failing-tests-due-to-load-variability-on-YP-AB.patch \ file://0001-Skip-failing-tests-due-to-load-variability-on-YP-AB.patch \
file://0001-test_ctypes.test_find-skip-without-tools-sdk.patch \ file://0001-test_ctypes.test_find-skip-without-tools-sdk.patch \
file://makerace.patch \ file://makerace.patch \
file://0001-sysconfig.py-use-platlibdir-also-for-purelib.patch \
file://0001-Lib-pty.py-handle-stdin-I-O-errors-same-way-as-maste.patch \
" "
SRC_URI:append:class-native = " \ SRC_URI:append:class-native = " \
file://0001-Lib-sysconfig.py-use-prefix-value-from-build-configu.patch \
file://0001-distutils-sysconfig-append-STAGING_LIBDIR-python-sys.patch \ file://0001-distutils-sysconfig-append-STAGING_LIBDIR-python-sys.patch \
file://12-distutils-prefix-is-inside-staging-area.patch \ file://12-distutils-prefix-is-inside-staging-area.patch \
file://0001-Don-t-search-system-for-headers-libraries.patch \ file://0001-Don-t-search-system-for-headers-libraries.patch \
" "
SRC_URI[sha256sum] = "f8145616e68c00041d1a6399b76387390388f8359581abc24432bb969b5e3c57" SRC_URI[sha256sum] = "5a99f8e7a6a11a7b98b4e75e0d1303d3832cada5534068f69c7b6222a7b1b002"
# exclude pre-releases for both python 2.x and 3.x # exclude pre-releases for both python 2.x and 3.x
UPSTREAM_CHECK_REGEX = "[Pp]ython-(?P<pver>\d+(\.\d+)+).tar" UPSTREAM_CHECK_REGEX = "[Pp]ython-(?P<pver>\d+(\.\d+)+).tar"
@@ -55,7 +57,7 @@ CVE_CHECK_WHITELIST += "CVE-2019-18348"
# This is windows only issue. # This is windows only issue.
CVE_CHECK_WHITELIST += "CVE-2020-15523" CVE_CHECK_WHITELIST += "CVE-2020-15523"
PYTHON_MAJMIN = "3.9" PYTHON_MAJMIN = "3.10"
S = "${WORKDIR}/Python-${PV}" S = "${WORKDIR}/Python-${PV}"