summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/python
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/python')
-rw-r--r--meta/recipes-devtools/python/python3-native_3.5.6.bb104
-rw-r--r--meta/recipes-devtools/python/python3.inc43
-rw-r--r--meta/recipes-devtools/python/python3/0001-Do-not-add-usr-lib-termcap-to-linker-flags-to-avoid-.patch25
-rw-r--r--meta/recipes-devtools/python/python3/0001-Do-not-hardcode-lib-as-location-for-site-packages-an.patch196
-rw-r--r--meta/recipes-devtools/python/python3/0001-Do-not-use-the-shell-version-of-python-config-that-w.patch25
-rw-r--r--meta/recipes-devtools/python/python3/0001-Issue-21272-Use-_sysconfigdata.py-to-initialize-dist.patch66
-rw-r--r--meta/recipes-devtools/python/python3/0001-Issue-28043-SSLContext-has-improved-default-settings.patch272
-rw-r--r--meta/recipes-devtools/python/python3/0001-Makefile.pre-use-qemu-wrapper-when-gathering-profile.patch25
-rw-r--r--meta/recipes-devtools/python/python3/0001-distutils-sysconfig-append-STAGING_LIBDIR-python-sys.patch42
-rw-r--r--meta/recipes-devtools/python/python3/0001-h2py-Fix-issue-13032-where-it-fails-with-UnicodeDeco.patch37
-rw-r--r--meta/recipes-devtools/python/python3/0001-python3-use-cc_basename-to-replace-CC-for-checking-c.patch50
-rw-r--r--meta/recipes-devtools/python/python3/0002-Don-t-do-runtime-test-to-get-float-byte-order.patch (renamed from meta/recipes-devtools/python/python3/float-endian.patch)35
-rw-r--r--meta/recipes-devtools/python/python3/0002-Makefile-add-target-to-split-profile-generation.patch40
-rw-r--r--meta/recipes-devtools/python/python3/0002-bpo-29136-Add-TLS-1.3-cipher-suites-and-OP_NO_TLSv1_.patch227
-rw-r--r--meta/recipes-devtools/python/python3/0003-bpo-32947-Fixes-for-TLS-1.3-and-OpenSSL-1.1.1-GH-876.patch173
-rw-r--r--meta/recipes-devtools/python/python3/0003-setup.py-pass-missing-libraries-to-Extension-for-mul.patch (renamed from meta/recipes-devtools/python/python3/pass-missing-libraries-to-Extension-for-mul.patch)28
-rw-r--r--meta/recipes-devtools/python/python3/0004-bpo-33570-TLS-1.3-ciphers-for-OpenSSL-1.1.1-GH-6976.patch110
-rw-r--r--meta/recipes-devtools/python/python3/0005-bpo-30714-ALPN-changes-for-OpenSSL-1.1.0f-2305.patch68
-rw-r--r--meta/recipes-devtools/python/python3/03-fix-tkinter-detection.patch42
-rw-r--r--meta/recipes-devtools/python/python3/030-fixup-include-dirs.patch33
-rw-r--r--meta/recipes-devtools/python/python3/080-distutils-dont_adjust_files.patch92
-rw-r--r--meta/recipes-devtools/python/python3/12-distutils-prefix-is-inside-staging-area.patch13
-rw-r--r--meta/recipes-devtools/python/python3/130-readline-setup.patch55
-rw-r--r--meta/recipes-devtools/python/python3/150-fix-setupterm.patch17
-rw-r--r--meta/recipes-devtools/python/python3/Use-correct-CFLAGS-for-extensions-when-cross-compili.patch56
-rw-r--r--meta/recipes-devtools/python/python3/avoid-ncursesw-include-path.patch21
-rw-r--r--meta/recipes-devtools/python/python3/avoid_warning_about_tkinter.patch27
-rw-r--r--meta/recipes-devtools/python/python3/cgi_py.patch15
-rwxr-xr-xmeta/recipes-devtools/python/python3/check_build_completeness.py17
-rw-r--r--meta/recipes-devtools/python/python3/configure.ac-fix-LIBPL.patch30
-rw-r--r--meta/recipes-devtools/python/python3/fix_for_using_different_libdir.patch54
-rw-r--r--meta/recipes-devtools/python/python3/ftplib.patch60
-rw-r--r--meta/recipes-devtools/python/python3/host_include_contamination.patch28
-rw-r--r--meta/recipes-devtools/python/python3/python-3.3-multilib.patch363
-rw-r--r--meta/recipes-devtools/python/python3/python3-manifest.json56
-rw-r--r--meta/recipes-devtools/python/python3/python3-use-CROSSPYTHONPATH-for-PYTHON_FOR_BUILD.patch25
-rw-r--r--meta/recipes-devtools/python/python3/regen-all.patch25
-rw-r--r--meta/recipes-devtools/python/python3/setup.py-check-cross_compiling-when-get-FLAGS.patch50
-rw-r--r--meta/recipes-devtools/python/python3/setuptweaks.patch57
-rw-r--r--meta/recipes-devtools/python/python3/signal.patch56
-rw-r--r--meta/recipes-devtools/python/python3/sitecustomize.py37
-rw-r--r--meta/recipes-devtools/python/python3/support_SOURCE_DATE_EPOCH_in_py_compile.patch97
-rw-r--r--meta/recipes-devtools/python/python3/sysconfig.py-add-_PYTHON_PROJECT_SRC.patch51
-rw-r--r--meta/recipes-devtools/python/python3/sysroot-include-headers.patch35
-rw-r--r--meta/recipes-devtools/python/python3/tweak-MULTIARCH-for-powerpc-linux-gnuspe.patch52
-rw-r--r--meta/recipes-devtools/python/python3/tweak-MULTIARCH-for-powerpc-linux-musl.patch40
-rw-r--r--meta/recipes-devtools/python/python3/unixccompiler.patch35
-rw-r--r--meta/recipes-devtools/python/python3_3.5.6.bb334
-rw-r--r--meta/recipes-devtools/python/python3_3.7.2.bb287
49 files changed, 697 insertions, 3029 deletions
diff --git a/meta/recipes-devtools/python/python3-native_3.5.6.bb b/meta/recipes-devtools/python/python3-native_3.5.6.bb
deleted file mode 100644
index c41ee8bbd9..0000000000
--- a/meta/recipes-devtools/python/python3-native_3.5.6.bb
+++ /dev/null
@@ -1,104 +0,0 @@
1require recipes-devtools/python/python3.inc
2
3DISTRO_SRC_URI ?= "file://sitecustomize.py"
4DISTRO_SRC_URI_linuxstdbase = ""
5SRC_URI = "http://www.python.org/ftp/python/${PV}/Python-${PV}.tar.xz \
6file://12-distutils-prefix-is-inside-staging-area.patch \
7file://python-config.patch \
8file://030-fixup-include-dirs.patch \
9file://080-distutils-dont_adjust_files.patch \
10file://130-readline-setup.patch \
11file://150-fix-setupterm.patch \
12file://python-3.3-multilib.patch \
13file://03-fix-tkinter-detection.patch \
14${@bb.utils.contains('PACKAGECONFIG', 'tk', '', 'file://avoid_warning_about_tkinter.patch', d)} \
15file://0001-h2py-Fix-issue-13032-where-it-fails-with-UnicodeDeco.patch \
16file://sysroot-include-headers.patch \
17file://unixccompiler.patch \
18${DISTRO_SRC_URI} \
19file://sysconfig.py-add-_PYTHON_PROJECT_SRC.patch \
20file://setup.py-check-cross_compiling-when-get-FLAGS.patch \
21file://0001-Do-not-use-the-shell-version-of-python-config-that-w.patch \
22file://support_SOURCE_DATE_EPOCH_in_py_compile.patch \
23file://regen-all.patch \
24file://0001-Issue-28043-SSLContext-has-improved-default-settings.patch \
25file://0002-bpo-29136-Add-TLS-1.3-cipher-suites-and-OP_NO_TLSv1_.patch \
26file://0003-bpo-32947-Fixes-for-TLS-1.3-and-OpenSSL-1.1.1-GH-876.patch \
27file://0004-bpo-33570-TLS-1.3-ciphers-for-OpenSSL-1.1.1-GH-6976.patch \
28file://0005-bpo-30714-ALPN-changes-for-OpenSSL-1.1.0f-2305.patch \
29"
30PACKAGECONFIG[tk] = ",,tk-native"
31
32EXTRANATIVEPATH += "bzip2-native"
33DEPENDS = "openssl-native bzip2-replacement-native zlib-native readline-native sqlite3-native gdbm-native"
34
35inherit native
36
37EXTRA_OECONF_append = " --bindir=${bindir}/${PN} --without-ensurepip"
38
39EXTRA_OEMAKE = '\
40 LIBC="" \
41 STAGING_LIBDIR=${STAGING_LIBDIR_NATIVE} \
42 STAGING_INCDIR=${STAGING_INCDIR_NATIVE} \
43 LIB=${baselib} \
44 ARCH=${TARGET_ARCH} \
45'
46
47do_configure_append() {
48 autoreconf --verbose --install --force --exclude=autopoint ../Python-${PV}/Modules/_ctypes/libffi
49 sed -i -e 's,#define HAVE_GETRANDOM 1,/\* #undef HAVE_GETRANDOM \*/,' ${B}/pyconfig.h
50}
51
52# Regenerate all of the generated files
53# This ensures that pgen and friends get created during the compile phase
54#
55do_compile_prepend() {
56 # Assuming https://bugs.python.org/issue33080 has been addressed in Makefile.
57 oe_runmake regen-all
58}
59
60do_install() {
61 install -d ${D}${libdir}/pkgconfig
62 oe_runmake 'DESTDIR=${D}' install
63 if [ -e ${WORKDIR}/sitecustomize.py ]; then
64 install -m 0644 ${WORKDIR}/sitecustomize.py ${D}/${libdir}/python${PYTHON_MAJMIN}
65 fi
66 install -d ${D}${bindir}/${PN}
67 install -m 0755 Parser/pgen ${D}${bindir}/${PN}
68
69 # Make sure we use /usr/bin/env python
70 for PYTHSCRIPT in `grep -rIl ${bindir}/${PN}/python ${D}${bindir}/${PN}`; do
71 sed -i -e '1s|^#!.*|#!/usr/bin/env python3|' $PYTHSCRIPT
72 done
73
74 # Add a symlink to the native Python so that scripts can just invoke
75 # "nativepython" and get the right one without needing absolute paths
76 # (these often end up too long for the #! parser in the kernel as the
77 # buffer is 128 bytes long).
78 ln -s python3-native/python3 ${D}${bindir}/nativepython3
79}
80
81python(){
82
83 # Read JSON manifest
84 import json
85 pythondir = d.getVar('THISDIR')
86 with open(pythondir+'/python3/python3-manifest.json') as manifest_file:
87 manifest_str = manifest_file.read()
88 json_start = manifest_str.find('# EOC') + 6
89 manifest_file.seek(json_start)
90 manifest_str = manifest_file.read()
91 python_manifest = json.loads(manifest_str)
92
93 rprovides = d.getVar('RPROVIDES').split()
94
95 # Hardcoded since it cant be python3-native-foo, should be python3-foo-native
96 pn = 'python3'
97
98 for key in python_manifest:
99 pypackage = pn + '-' + key + '-native'
100 if pypackage not in rprovides:
101 rprovides.append(pypackage)
102
103 d.setVar('RPROVIDES', ' '.join(rprovides))
104}
diff --git a/meta/recipes-devtools/python/python3.inc b/meta/recipes-devtools/python/python3.inc
deleted file mode 100644
index f565b3f171..0000000000
--- a/meta/recipes-devtools/python/python3.inc
+++ /dev/null
@@ -1,43 +0,0 @@
1SUMMARY = "The Python Programming Language"
2HOMEPAGE = "http://www.python.org"
3LICENSE = "PSFv2"
4SECTION = "devel/python"
5
6# TODO Remove this when we upgrade
7INC_PR = "r1"
8PR = "${INC_PR}.0"
9
10LIC_FILES_CHKSUM = "file://LICENSE;md5=b6ec515b22618f55fa07276b897bacea"
11
12# TODO consolidate patch set
13SRC_URI[md5sum] = "f5a99f765e765336a3ebbb2a24ca2be3"
14SRC_URI[sha256sum] = "f55cde04f521f273c7cba08912921cc5642cfc15ca7b22d5829f0aff4371155f"
15
16# exclude pre-releases for both python 2.x and 3.x
17UPSTREAM_CHECK_REGEX = "[Pp]ython-(?P<pver>\d+(\.\d+)+).tar"
18
19CVE_PRODUCT = "python"
20
21PYTHON_MAJMIN = "3.5"
22PYTHON_BINABI = "${PYTHON_MAJMIN}m"
23
24S = "${WORKDIR}/Python-${PV}"
25
26inherit autotools bluetooth pkgconfig
27
28EXTRA_OECONF = "\
29 --with-threads \
30 --with-pymalloc \
31 --without-cxx-main \
32 --with-signal-module \
33 --enable-shared \
34 --enable-ipv6=${@bb.utils.contains('DISTRO_FEATURES', 'ipv6', 'yes', 'no', d)} \
35"
36
37PACKAGECONFIG[bluetooth] = ",ac_cv_header_bluetooth_bluetooth_h=no ac_cv_header_bluetooth_h=no,${BLUEZ}"
38
39do_install_append () {
40 sed -i -e 's:${HOSTTOOLS_DIR}/install:install:g' \
41 -e 's:${HOSTTOOLS_DIR}/mkdir:mkdir:g' \
42 ${D}/${libdir}/python${PYTHON_MAJMIN}/_sysconfigdata.py
43}
diff --git a/meta/recipes-devtools/python/python3/0001-Do-not-add-usr-lib-termcap-to-linker-flags-to-avoid-.patch b/meta/recipes-devtools/python/python3/0001-Do-not-add-usr-lib-termcap-to-linker-flags-to-avoid-.patch
new file mode 100644
index 0000000000..09f279ba1d
--- /dev/null
+++ b/meta/recipes-devtools/python/python3/0001-Do-not-add-usr-lib-termcap-to-linker-flags-to-avoid-.patch
@@ -0,0 +1,25 @@
1From 23294c6ba6896115828293fdb7e67b47b38ba675 Mon Sep 17 00:00:00 2001
2From: Alexander Kanavin <alex.kanavin@gmail.com>
3Date: Fri, 25 Jan 2019 19:04:13 +0100
4Subject: [PATCH] Do not add /usr/lib/termcap to linker flags to avoid host
5 contamination
6
7Upstream-Status: Inappropriate [oe-core specific]
8Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
9
10---
11 setup.py | 1 -
12 1 file changed, 1 deletion(-)
13
14diff --git a/setup.py b/setup.py
15index b4357e3..fbec00d 100644
16--- a/setup.py
17+++ b/setup.py
18@@ -856,7 +856,6 @@ class PyBuildExt(build_ext):
19 'termcap'):
20 readline_libs.append('termcap')
21 exts.append( Extension('readline', ['readline.c'],
22- library_dirs=['/usr/lib/termcap'],
23 extra_link_args=readline_extra_link_args,
24 libraries=readline_libs) )
25 else:
diff --git a/meta/recipes-devtools/python/python3/0001-Do-not-hardcode-lib-as-location-for-site-packages-an.patch b/meta/recipes-devtools/python/python3/0001-Do-not-hardcode-lib-as-location-for-site-packages-an.patch
new file mode 100644
index 0000000000..661f52d01f
--- /dev/null
+++ b/meta/recipes-devtools/python/python3/0001-Do-not-hardcode-lib-as-location-for-site-packages-an.patch
@@ -0,0 +1,196 @@
1From 0fbdad1eaf541a8e92be81f39514cd249b3b0801 Mon Sep 17 00:00:00 2001
2From: Alexander Kanavin <alex.kanavin@gmail.com>
3Date: Tue, 5 Feb 2019 15:52:02 +0100
4Subject: [PATCH] Do not hardcode "lib" as location for modules, site-packages
5 and lib-dynload
6
7Upstream-Status: Inappropriate [oe-core specific]
8Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
9
10---
11 Include/pythonrun.h | 2 ++
12 Lib/site.py | 4 ++--
13 Makefile.pre.in | 5 +++--
14 Modules/getpath.c | 18 ++++++++++++------
15 Python/getplatform.c | 10 ++++++++++
16 Python/sysmodule.c | 2 ++
17 6 files changed, 31 insertions(+), 10 deletions(-)
18
19diff --git a/Include/pythonrun.h b/Include/pythonrun.h
20index 6f0c6fc..0a17edd 100644
21--- a/Include/pythonrun.h
22+++ b/Include/pythonrun.h
23@@ -7,6 +7,8 @@
24 extern "C" {
25 #endif
26
27+PyAPI_FUNC(const char *) Py_GetLib(void);
28+
29 #ifndef Py_LIMITED_API
30 PyAPI_FUNC(int) PyRun_SimpleStringFlags(const char *, PyCompilerFlags *);
31 PyAPI_FUNC(int) PyRun_AnyFileFlags(FILE *, const char *, PyCompilerFlags *);
32diff --git a/Lib/site.py b/Lib/site.py
33index ffd132b..b55f6d8 100644
34--- a/Lib/site.py
35+++ b/Lib/site.py
36@@ -334,12 +334,12 @@ def getsitepackages(prefixes=None):
37 seen.add(prefix)
38
39 if os.sep == '/':
40- sitepackages.append(os.path.join(prefix, "lib",
41+ sitepackages.append(os.path.join(prefix, sys.lib,
42 "python%d.%d" % sys.version_info[:2],
43 "site-packages"))
44 else:
45 sitepackages.append(prefix)
46- sitepackages.append(os.path.join(prefix, "lib", "site-packages"))
47+ sitepackages.append(os.path.join(prefix, sys.lib, "site-packages"))
48 return sitepackages
49
50 def addsitepackages(known_paths, prefixes=None):
51diff --git a/Makefile.pre.in b/Makefile.pre.in
52index 6e81b2f..671a20e 100644
53--- a/Makefile.pre.in
54+++ b/Makefile.pre.in
55@@ -142,7 +142,7 @@ LIBDIR= @libdir@
56 MANDIR= @mandir@
57 INCLUDEDIR= @includedir@
58 CONFINCLUDEDIR= $(exec_prefix)/include
59-SCRIPTDIR= $(prefix)/lib
60+SCRIPTDIR= @libdir@
61 ABIFLAGS= @ABIFLAGS@
62
63 # Detailed destination directories
64@@ -768,6 +768,7 @@ Modules/getpath.o: $(srcdir)/Modules/getpath.c Makefile
65 -DEXEC_PREFIX='"$(exec_prefix)"' \
66 -DVERSION='"$(VERSION)"' \
67 -DVPATH='"$(VPATH)"' \
68+ -DLIB='"$(LIB)"' \
69 -o $@ $(srcdir)/Modules/getpath.c
70
71 Programs/python.o: $(srcdir)/Programs/python.c
72@@ -856,7 +857,7 @@ regen-opcode:
73 Python/compile.o Python/symtable.o Python/ast_unparse.o Python/ast.o: $(srcdir)/Include/graminit.h $(srcdir)/Include/Python-ast.h
74
75 Python/getplatform.o: $(srcdir)/Python/getplatform.c
76- $(CC) -c $(PY_CORE_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
77+ $(CC) -c $(PY_CORE_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -DLIB='"$(LIB)"' -o $@ $(srcdir)/Python/getplatform.c
78
79 Python/importdl.o: $(srcdir)/Python/importdl.c
80 $(CC) -c $(PY_CORE_CFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c
81diff --git a/Modules/getpath.c b/Modules/getpath.c
82index e6a3e8e..0c62af6 100644
83--- a/Modules/getpath.c
84+++ b/Modules/getpath.c
85@@ -123,6 +123,7 @@ typedef struct {
86 wchar_t *exec_prefix; /* EXEC_PREFIX define */
87
88 wchar_t *lib_python; /* "lib/pythonX.Y" */
89+ wchar_t *multilib_python; /* "lib[suffix]/pythonX.Y" */
90 wchar_t argv0_path[MAXPATHLEN+1];
91 wchar_t zip_path[MAXPATHLEN+1]; /* ".../lib/pythonXY.zip" */
92
93@@ -314,7 +315,7 @@ search_for_prefix(const _PyCoreConfig *core_config,
94 if (delim) {
95 *delim = L'\0';
96 }
97- joinpath(prefix, calculate->lib_python);
98+ joinpath(prefix, calculate->multilib_python);
99 joinpath(prefix, LANDMARK);
100 return 1;
101 }
102@@ -343,7 +344,7 @@ search_for_prefix(const _PyCoreConfig *core_config,
103 copy_absolute(prefix, calculate->argv0_path, MAXPATHLEN+1);
104 do {
105 n = wcslen(prefix);
106- joinpath(prefix, calculate->lib_python);
107+ joinpath(prefix, calculate->multilib_python);
108 joinpath(prefix, LANDMARK);
109 if (ismodule(prefix)) {
110 return 1;
111@@ -355,7 +356,7 @@ search_for_prefix(const _PyCoreConfig *core_config,
112 /* Look at configure's PREFIX */
113 wcsncpy(prefix, calculate->prefix, MAXPATHLEN);
114 prefix[MAXPATHLEN] = L'\0';
115- joinpath(prefix, calculate->lib_python);
116+ joinpath(prefix, calculate->multilib_python);
117 joinpath(prefix, LANDMARK);
118 if (ismodule(prefix)) {
119 return 1;
120@@ -427,7 +428,7 @@ search_for_exec_prefix(const _PyCoreConfig *core_config,
121 wcsncpy(exec_prefix, core_config->home, MAXPATHLEN);
122 }
123 exec_prefix[MAXPATHLEN] = L'\0';
124- joinpath(exec_prefix, calculate->lib_python);
125+ joinpath(exec_prefix, calculate->multilib_python);
126 joinpath(exec_prefix, L"lib-dynload");
127 return 1;
128 }
129@@ -464,7 +465,7 @@ search_for_exec_prefix(const _PyCoreConfig *core_config,
130 copy_absolute(exec_prefix, calculate->argv0_path, MAXPATHLEN+1);
131 do {
132 n = wcslen(exec_prefix);
133- joinpath(exec_prefix, calculate->lib_python);
134+ joinpath(exec_prefix, calculate->multilib_python);
135 joinpath(exec_prefix, L"lib-dynload");
136 if (isdir(exec_prefix)) {
137 return 1;
138@@ -476,7 +477,7 @@ search_for_exec_prefix(const _PyCoreConfig *core_config,
139 /* Look at configure's EXEC_PREFIX */
140 wcsncpy(exec_prefix, calculate->exec_prefix, MAXPATHLEN);
141 exec_prefix[MAXPATHLEN] = L'\0';
142- joinpath(exec_prefix, calculate->lib_python);
143+ joinpath(exec_prefix, calculate->multilib_python);
144 joinpath(exec_prefix, L"lib-dynload");
145 if (isdir(exec_prefix)) {
146 return 1;
147@@ -871,6 +872,10 @@ calculate_init(PyCalculatePath *calculate,
148 if (!calculate->lib_python) {
149 return DECODE_LOCALE_ERR("EXEC_PREFIX define", len);
150 }
151+ calculate->multilib_python = Py_DecodeLocale(LIB "/python" VERSION, &len);
152+ if (!calculate->multilib_python) {
153+ return DECODE_LOCALE_ERR("EXEC_PREFIX define", len);
154+ }
155 return _Py_INIT_OK();
156 }
157
158@@ -882,6 +887,7 @@ calculate_free(PyCalculatePath *calculate)
159 PyMem_RawFree(calculate->prefix);
160 PyMem_RawFree(calculate->exec_prefix);
161 PyMem_RawFree(calculate->lib_python);
162+ PyMem_RawFree(calculate->multilib_python);
163 PyMem_RawFree(calculate->path_env);
164 }
165
166diff --git a/Python/getplatform.c b/Python/getplatform.c
167index 81a0f7a..d55396b 100644
168--- a/Python/getplatform.c
169+++ b/Python/getplatform.c
170@@ -10,3 +10,13 @@ Py_GetPlatform(void)
171 {
172 return PLATFORM;
173 }
174+
175+#ifndef LIB
176+#define LIB "lib"
177+#endif
178+
179+const char *
180+Py_GetLib(void)
181+{
182+ return LIB;
183+}
184diff --git a/Python/sysmodule.c b/Python/sysmodule.c
185index efe5b29..de77b17 100644
186--- a/Python/sysmodule.c
187+++ b/Python/sysmodule.c
188@@ -2319,6 +2319,8 @@ _PySys_BeginInit(PyObject **sysmod)
189 PyUnicode_FromString(Py_GetCopyright()));
190 SET_SYS_FROM_STRING("platform",
191 PyUnicode_FromString(Py_GetPlatform()));
192+ SET_SYS_FROM_STRING("lib",
193+ PyUnicode_FromString(Py_GetLib()));
194 SET_SYS_FROM_STRING("maxsize",
195 PyLong_FromSsize_t(PY_SSIZE_T_MAX));
196 SET_SYS_FROM_STRING("float_info",
diff --git a/meta/recipes-devtools/python/python3/0001-Do-not-use-the-shell-version-of-python-config-that-w.patch b/meta/recipes-devtools/python/python3/0001-Do-not-use-the-shell-version-of-python-config-that-w.patch
index 8ea3f03fe0..83fd52d87f 100644
--- a/meta/recipes-devtools/python/python3/0001-Do-not-use-the-shell-version-of-python-config-that-w.patch
+++ b/meta/recipes-devtools/python/python3/0001-Do-not-use-the-shell-version-of-python-config-that-w.patch
@@ -1,6 +1,6 @@
1From 04df959365e2b54d7503edf0e5534ff094284f2d Mon Sep 17 00:00:00 2001 1From 148861fa16f2aaacd518770f337ea54b5182f981 Mon Sep 17 00:00:00 2001
2From: Alexander Kanavin <alex.kanavin@gmail.com> 2From: Alexander Kanavin <alex.kanavin@gmail.com>
3Date: Fri, 23 Oct 2015 12:25:09 +0300 3Date: Tue, 29 Jan 2019 15:03:01 +0100
4Subject: [PATCH] Do not use the shell version of python-config that was 4Subject: [PATCH] Do not use the shell version of python-config that was
5 introduced in 3.4 5 introduced in 3.4
6 6
@@ -14,25 +14,22 @@ Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
14 1 file changed, 3 insertions(+), 6 deletions(-) 14 1 file changed, 3 insertions(+), 6 deletions(-)
15 15
16diff --git a/Makefile.pre.in b/Makefile.pre.in 16diff --git a/Makefile.pre.in b/Makefile.pre.in
17index 236f005..5c4337f 100644 17index 2d2e11f..cc19942 100644
18--- a/Makefile.pre.in 18--- a/Makefile.pre.in
19+++ b/Makefile.pre.in 19+++ b/Makefile.pre.in
20@@ -1348,12 +1348,9 @@ python-config: $(srcdir)/Misc/python-config.in Misc/python-config.sh 20@@ -1431,12 +1431,9 @@ python-config: $(srcdir)/Misc/python-config.in Misc/python-config.sh
21 sed -e "s,@EXENAME@,$(BINDIR)/python$(LDVERSION)$(EXE)," < $(srcdir)/Misc/python-config.in >python-config.py 21 sed -e "s,@EXENAME@,$(BINDIR)/python$(LDVERSION)$(EXE)," < $(srcdir)/Misc/python-config.in >python-config.py
22 # Replace makefile compat. variable references with shell script compat. ones; $(VAR) -> ${VAR} 22 @ # Replace makefile compat. variable references with shell script compat. ones; $(VAR) -> ${VAR}
23 LC_ALL=C sed -e 's,\$$(\([A-Za-z0-9_]*\)),\$$\{\1\},g' < Misc/python-config.sh >python-config 23 LC_ALL=C sed -e 's,\$$(\([A-Za-z0-9_]*\)),\$$\{\1\},g' < Misc/python-config.sh >python-config
24- # On Darwin, always use the python version of the script, the shell 24- @ # On Darwin, always use the python version of the script, the shell
25- # version doesn't use the compiler customizations that are provided 25- @ # version doesn't use the compiler customizations that are provided
26- # in python (_osx_support.py). 26- @ # in python (_osx_support.py).
27- if test `uname -s` = Darwin; then \ 27- @if test `uname -s` = Darwin; then \
28- cp python-config.py python-config; \ 28- cp python-config.py python-config; \
29- fi 29- fi
30+ # In OpenEmbedded, always use the python version of the script, the shell 30+ @ # In OpenEmbedded, always use the python version of the script, the shell
31+ # version is broken in multiple ways, and doesn't return correct directories 31+ @ # version is broken in multiple ways, and doesn't return correct directories
32+ cp python-config.py python-config 32+ cp python-config.py python-config
33 33
34 34
35 # Install the include files 35 # Install the include files
36--
372.11.0
38
diff --git a/meta/recipes-devtools/python/python3/0001-Issue-21272-Use-_sysconfigdata.py-to-initialize-dist.patch b/meta/recipes-devtools/python/python3/0001-Issue-21272-Use-_sysconfigdata.py-to-initialize-dist.patch
deleted file mode 100644
index d1c92e9eed..0000000000
--- a/meta/recipes-devtools/python/python3/0001-Issue-21272-Use-_sysconfigdata.py-to-initialize-dist.patch
+++ /dev/null
@@ -1,66 +0,0 @@
1From bcddbf40c7f1b80336268cdddacc17369fb0ccea Mon Sep 17 00:00:00 2001
2From: Libin Dang <libin.dang@windriver.com>
3Date: Tue, 11 Apr 2017 14:12:15 +0800
4Subject: [PATCH] Issue #21272: Use _sysconfigdata.py to initialize
5 distutils.sysconfig
6
7Backport upstream commit
8https://github.com/python/cpython/commit/409482251b06fe75c4ee56e85ffbb4b23d934159
9
10Upstream-Status: Backport
11
12Signed-off-by: Li Zhou <li.zhou@windriver.com>
13---
14 Lib/distutils/sysconfig.py | 35 ++++-------------------------------
15 1 file changed, 4 insertions(+), 31 deletions(-)
16
17diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py
18index 6d5cfd0..9925d24 100644
19--- a/Lib/distutils/sysconfig.py
20+++ b/Lib/distutils/sysconfig.py
21@@ -424,38 +424,11 @@ _config_vars = None
22
23 def _init_posix():
24 """Initialize the module as appropriate for POSIX systems."""
25- g = {}
26- # load the installed Makefile:
27- try:
28- filename = get_makefile_filename()
29- parse_makefile(filename, g)
30- except OSError as msg:
31- my_msg = "invalid Python installation: unable to open %s" % filename
32- if hasattr(msg, "strerror"):
33- my_msg = my_msg + " (%s)" % msg.strerror
34-
35- raise DistutilsPlatformError(my_msg)
36-
37- # load the installed pyconfig.h:
38- try:
39- filename = get_config_h_filename()
40- with open(filename) as file:
41- parse_config_h(file, g)
42- except OSError as msg:
43- my_msg = "invalid Python installation: unable to open %s" % filename
44- if hasattr(msg, "strerror"):
45- my_msg = my_msg + " (%s)" % msg.strerror
46-
47- raise DistutilsPlatformError(my_msg)
48-
49- # On AIX, there are wrong paths to the linker scripts in the Makefile
50- # -- these paths are relative to the Python source, but when installed
51- # the scripts are in another directory.
52- if python_build:
53- g['LDSHARED'] = g['BLDSHARED']
54-
55+ # _sysconfigdata is generated at build time, see the sysconfig module
56+ from _sysconfigdata import build_time_vars
57 global _config_vars
58- _config_vars = g
59+ _config_vars = {}
60+ _config_vars.update(build_time_vars)
61
62
63 def _init_nt():
64--
651.8.3.1
66
diff --git a/meta/recipes-devtools/python/python3/0001-Issue-28043-SSLContext-has-improved-default-settings.patch b/meta/recipes-devtools/python/python3/0001-Issue-28043-SSLContext-has-improved-default-settings.patch
deleted file mode 100644
index 321b4afa12..0000000000
--- a/meta/recipes-devtools/python/python3/0001-Issue-28043-SSLContext-has-improved-default-settings.patch
+++ /dev/null
@@ -1,272 +0,0 @@
1From 758e7463c104f71b810c8588166747eeab6148d7 Mon Sep 17 00:00:00 2001
2From: Christian Heimes <christian@python.org>
3Date: Sat, 10 Sep 2016 22:43:48 +0200
4Subject: [PATCH 1/4] Issue 28043: SSLContext has improved default settings
5
6The options OP_NO_COMPRESSION, OP_CIPHER_SERVER_PREFERENCE, OP_SINGLE_DH_USE, OP_SINGLE_ECDH_USE, OP_NO_SSLv2 (except for PROTOCOL_SSLv2), and OP_NO_SSLv3 (except for PROTOCOL_SSLv3) are set by default. The initial cipher suite list contains only HIGH ciphers, no NULL ciphers and MD5 ciphers (except for PROTOCOL_SSLv2).
7
8Upstream-Status: Backport
9[https://github.com/python/cpython/commit/358cfd426ccc0fcd6a7940d306602138e76420ae]
10
11Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
12---
13 Doc/library/ssl.rst | 9 ++++++-
14 Lib/ssl.py | 30 +++++----------------
15 Lib/test/test_ssl.py | 62 +++++++++++++++++++++++---------------------
16 Modules/_ssl.c | 31 ++++++++++++++++++++++
17 4 files changed, 78 insertions(+), 54 deletions(-)
18
19diff --git a/Doc/library/ssl.rst b/Doc/library/ssl.rst
20index a2f008346b..14f2d68217 100644
21--- a/Doc/library/ssl.rst
22+++ b/Doc/library/ssl.rst
23@@ -1151,7 +1151,14 @@ to speed up repeated connections from the same clients.
24
25 .. versionchanged:: 3.5.3
26
27- :data:`PROTOCOL_TLS` is the default value.
28+ The context is created with secure default values. The options
29+ :data:`OP_NO_COMPRESSION`, :data:`OP_CIPHER_SERVER_PREFERENCE`,
30+ :data:`OP_SINGLE_DH_USE`, :data:`OP_SINGLE_ECDH_USE`,
31+ :data:`OP_NO_SSLv2` (except for :data:`PROTOCOL_SSLv2`),
32+ and :data:`OP_NO_SSLv3` (except for :data:`PROTOCOL_SSLv3`) are
33+ set by default. The initial cipher suite list contains only ``HIGH``
34+ ciphers, no ``NULL`` ciphers and no ``MD5`` ciphers (except for
35+ :data:`PROTOCOL_SSLv2`).
36
37
38 :class:`SSLContext` objects have the following methods and attributes:
39diff --git a/Lib/ssl.py b/Lib/ssl.py
40index e1913904f3..4d302a78fa 100644
41--- a/Lib/ssl.py
42+++ b/Lib/ssl.py
43@@ -446,32 +446,16 @@ def create_default_context(purpose=Purpose.SERVER_AUTH, *, cafile=None,
44 if not isinstance(purpose, _ASN1Object):
45 raise TypeError(purpose)
46
47+ # SSLContext sets OP_NO_SSLv2, OP_NO_SSLv3, OP_NO_COMPRESSION,
48+ # OP_CIPHER_SERVER_PREFERENCE, OP_SINGLE_DH_USE and OP_SINGLE_ECDH_USE
49+ # by default.
50 context = SSLContext(PROTOCOL_TLS)
51
52- # SSLv2 considered harmful.
53- context.options |= OP_NO_SSLv2
54-
55- # SSLv3 has problematic security and is only required for really old
56- # clients such as IE6 on Windows XP
57- context.options |= OP_NO_SSLv3
58-
59- # disable compression to prevent CRIME attacks (OpenSSL 1.0+)
60- context.options |= getattr(_ssl, "OP_NO_COMPRESSION", 0)
61-
62 if purpose == Purpose.SERVER_AUTH:
63 # verify certs and host name in client mode
64 context.verify_mode = CERT_REQUIRED
65 context.check_hostname = True
66 elif purpose == Purpose.CLIENT_AUTH:
67- # Prefer the server's ciphers by default so that we get stronger
68- # encryption
69- context.options |= getattr(_ssl, "OP_CIPHER_SERVER_PREFERENCE", 0)
70-
71- # Use single use keys in order to improve forward secrecy
72- context.options |= getattr(_ssl, "OP_SINGLE_DH_USE", 0)
73- context.options |= getattr(_ssl, "OP_SINGLE_ECDH_USE", 0)
74-
75- # disallow ciphers with known vulnerabilities
76 context.set_ciphers(_RESTRICTED_SERVER_CIPHERS)
77
78 if cafile or capath or cadata:
79@@ -497,12 +481,10 @@ def _create_unverified_context(protocol=PROTOCOL_TLS, *, cert_reqs=None,
80 if not isinstance(purpose, _ASN1Object):
81 raise TypeError(purpose)
82
83+ # SSLContext sets OP_NO_SSLv2, OP_NO_SSLv3, OP_NO_COMPRESSION,
84+ # OP_CIPHER_SERVER_PREFERENCE, OP_SINGLE_DH_USE and OP_SINGLE_ECDH_USE
85+ # by default.
86 context = SSLContext(protocol)
87- # SSLv2 considered harmful.
88- context.options |= OP_NO_SSLv2
89- # SSLv3 has problematic security and is only required for really old
90- # clients such as IE6 on Windows XP
91- context.options |= OP_NO_SSLv3
92
93 if cert_reqs is not None:
94 context.verify_mode = cert_reqs
95diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py
96index ffb7314f57..f91af7bd05 100644
97--- a/Lib/test/test_ssl.py
98+++ b/Lib/test/test_ssl.py
99@@ -73,6 +73,12 @@ NULLBYTECERT = data_file("nullbytecert.pem")
100 DHFILE = data_file("dh1024.pem")
101 BYTES_DHFILE = os.fsencode(DHFILE)
102
103+# Not defined in all versions of OpenSSL
104+OP_NO_COMPRESSION = getattr(ssl, "OP_NO_COMPRESSION", 0)
105+OP_SINGLE_DH_USE = getattr(ssl, "OP_SINGLE_DH_USE", 0)
106+OP_SINGLE_ECDH_USE = getattr(ssl, "OP_SINGLE_ECDH_USE", 0)
107+OP_CIPHER_SERVER_PREFERENCE = getattr(ssl, "OP_CIPHER_SERVER_PREFERENCE", 0)
108+
109
110 def handle_error(prefix):
111 exc_format = ' '.join(traceback.format_exception(*sys.exc_info()))
112@@ -839,8 +845,9 @@ class ContextTests(unittest.TestCase):
113 ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
114 # OP_ALL | OP_NO_SSLv2 | OP_NO_SSLv3 is the default value
115 default = (ssl.OP_ALL | ssl.OP_NO_SSLv2 | ssl.OP_NO_SSLv3)
116- if not IS_LIBRESSL and ssl.OPENSSL_VERSION_INFO >= (1, 1, 0):
117- default |= ssl.OP_NO_COMPRESSION
118+ # SSLContext also enables these by default
119+ default |= (OP_NO_COMPRESSION | OP_CIPHER_SERVER_PREFERENCE |
120+ OP_SINGLE_DH_USE | OP_SINGLE_ECDH_USE)
121 self.assertEqual(default, ctx.options)
122 ctx.options |= ssl.OP_NO_TLSv1
123 self.assertEqual(default | ssl.OP_NO_TLSv1, ctx.options)
124@@ -1205,16 +1212,29 @@ class ContextTests(unittest.TestCase):
125 stats["x509"] += 1
126 self.assertEqual(ctx.cert_store_stats(), stats)
127
128+ def _assert_context_options(self, ctx):
129+ self.assertEqual(ctx.options & ssl.OP_NO_SSLv2, ssl.OP_NO_SSLv2)
130+ if OP_NO_COMPRESSION != 0:
131+ self.assertEqual(ctx.options & OP_NO_COMPRESSION,
132+ OP_NO_COMPRESSION)
133+ if OP_SINGLE_DH_USE != 0:
134+ self.assertEqual(ctx.options & OP_SINGLE_DH_USE,
135+ OP_SINGLE_DH_USE)
136+ if OP_SINGLE_ECDH_USE != 0:
137+ self.assertEqual(ctx.options & OP_SINGLE_ECDH_USE,
138+ OP_SINGLE_ECDH_USE)
139+ if OP_CIPHER_SERVER_PREFERENCE != 0:
140+ self.assertEqual(ctx.options & OP_CIPHER_SERVER_PREFERENCE,
141+ OP_CIPHER_SERVER_PREFERENCE)
142+
143 def test_create_default_context(self):
144 ctx = ssl.create_default_context()
145+
146 self.assertEqual(ctx.protocol, ssl.PROTOCOL_SSLv23)
147 self.assertEqual(ctx.verify_mode, ssl.CERT_REQUIRED)
148 self.assertTrue(ctx.check_hostname)
149- self.assertEqual(ctx.options & ssl.OP_NO_SSLv2, ssl.OP_NO_SSLv2)
150- self.assertEqual(
151- ctx.options & getattr(ssl, "OP_NO_COMPRESSION", 0),
152- getattr(ssl, "OP_NO_COMPRESSION", 0),
153- )
154+ self._assert_context_options(ctx)
155+
156
157 with open(SIGNING_CA) as f:
158 cadata = f.read()
159@@ -1222,40 +1242,24 @@ class ContextTests(unittest.TestCase):
160 cadata=cadata)
161 self.assertEqual(ctx.protocol, ssl.PROTOCOL_SSLv23)
162 self.assertEqual(ctx.verify_mode, ssl.CERT_REQUIRED)
163- self.assertEqual(ctx.options & ssl.OP_NO_SSLv2, ssl.OP_NO_SSLv2)
164- self.assertEqual(
165- ctx.options & getattr(ssl, "OP_NO_COMPRESSION", 0),
166- getattr(ssl, "OP_NO_COMPRESSION", 0),
167- )
168+ self._assert_context_options(ctx)
169
170 ctx = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)
171 self.assertEqual(ctx.protocol, ssl.PROTOCOL_SSLv23)
172 self.assertEqual(ctx.verify_mode, ssl.CERT_NONE)
173- self.assertEqual(ctx.options & ssl.OP_NO_SSLv2, ssl.OP_NO_SSLv2)
174- self.assertEqual(
175- ctx.options & getattr(ssl, "OP_NO_COMPRESSION", 0),
176- getattr(ssl, "OP_NO_COMPRESSION", 0),
177- )
178- self.assertEqual(
179- ctx.options & getattr(ssl, "OP_SINGLE_DH_USE", 0),
180- getattr(ssl, "OP_SINGLE_DH_USE", 0),
181- )
182- self.assertEqual(
183- ctx.options & getattr(ssl, "OP_SINGLE_ECDH_USE", 0),
184- getattr(ssl, "OP_SINGLE_ECDH_USE", 0),
185- )
186+ self._assert_context_options(ctx)
187
188 def test__create_stdlib_context(self):
189 ctx = ssl._create_stdlib_context()
190 self.assertEqual(ctx.protocol, ssl.PROTOCOL_SSLv23)
191 self.assertEqual(ctx.verify_mode, ssl.CERT_NONE)
192 self.assertFalse(ctx.check_hostname)
193- self.assertEqual(ctx.options & ssl.OP_NO_SSLv2, ssl.OP_NO_SSLv2)
194+ self._assert_context_options(ctx)
195
196 ctx = ssl._create_stdlib_context(ssl.PROTOCOL_TLSv1)
197 self.assertEqual(ctx.protocol, ssl.PROTOCOL_TLSv1)
198 self.assertEqual(ctx.verify_mode, ssl.CERT_NONE)
199- self.assertEqual(ctx.options & ssl.OP_NO_SSLv2, ssl.OP_NO_SSLv2)
200+ self._assert_context_options(ctx)
201
202 ctx = ssl._create_stdlib_context(ssl.PROTOCOL_TLSv1,
203 cert_reqs=ssl.CERT_REQUIRED,
204@@ -1263,12 +1267,12 @@ class ContextTests(unittest.TestCase):
205 self.assertEqual(ctx.protocol, ssl.PROTOCOL_TLSv1)
206 self.assertEqual(ctx.verify_mode, ssl.CERT_REQUIRED)
207 self.assertTrue(ctx.check_hostname)
208- self.assertEqual(ctx.options & ssl.OP_NO_SSLv2, ssl.OP_NO_SSLv2)
209+ self._assert_context_options(ctx)
210
211 ctx = ssl._create_stdlib_context(purpose=ssl.Purpose.CLIENT_AUTH)
212 self.assertEqual(ctx.protocol, ssl.PROTOCOL_SSLv23)
213 self.assertEqual(ctx.verify_mode, ssl.CERT_NONE)
214- self.assertEqual(ctx.options & ssl.OP_NO_SSLv2, ssl.OP_NO_SSLv2)
215+ self._assert_context_options(ctx)
216
217 def test_check_hostname(self):
218 ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
219diff --git a/Modules/_ssl.c b/Modules/_ssl.c
220index 86482677ae..0d5c121d2c 100644
221--- a/Modules/_ssl.c
222+++ b/Modules/_ssl.c
223@@ -2330,6 +2330,7 @@ _ssl__SSLContext_impl(PyTypeObject *type, int proto_version)
224 PySSLContext *self;
225 long options;
226 SSL_CTX *ctx = NULL;
227+ int result;
228 #if defined(SSL_MODE_RELEASE_BUFFERS)
229 unsigned long libver;
230 #endif
231@@ -2393,8 +2394,38 @@ _ssl__SSLContext_impl(PyTypeObject *type, int proto_version)
232 options |= SSL_OP_NO_SSLv2;
233 if (proto_version != PY_SSL_VERSION_SSL3)
234 options |= SSL_OP_NO_SSLv3;
235+ /* Minimal security flags for server and client side context.
236+ * Client sockets ignore server-side parameters. */
237+#ifdef SSL_OP_NO_COMPRESSION
238+ options |= SSL_OP_NO_COMPRESSION;
239+#endif
240+#ifdef SSL_OP_CIPHER_SERVER_PREFERENCE
241+ options |= SSL_OP_CIPHER_SERVER_PREFERENCE;
242+#endif
243+#ifdef SSL_OP_SINGLE_DH_USE
244+ options |= SSL_OP_SINGLE_DH_USE;
245+#endif
246+#ifdef SSL_OP_SINGLE_ECDH_USE
247+ options |= SSL_OP_SINGLE_ECDH_USE;
248+#endif
249 SSL_CTX_set_options(self->ctx, options);
250
251+ /* A bare minimum cipher list without completly broken cipher suites.
252+ * It's far from perfect but gives users a better head start. */
253+ if (proto_version != PY_SSL_VERSION_SSL2) {
254+ result = SSL_CTX_set_cipher_list(ctx, "HIGH:!aNULL:!eNULL:!MD5");
255+ } else {
256+ /* SSLv2 needs MD5 */
257+ result = SSL_CTX_set_cipher_list(ctx, "HIGH:!aNULL:!eNULL");
258+ }
259+ if (result == 0) {
260+ Py_DECREF(self);
261+ ERR_clear_error();
262+ PyErr_SetString(PySSLErrorObject,
263+ "No cipher can be selected.");
264+ return NULL;
265+ }
266+
267 #if defined(SSL_MODE_RELEASE_BUFFERS)
268 /* Set SSL_MODE_RELEASE_BUFFERS. This potentially greatly reduces memory
269 usage for no cost at all. However, don't do this for OpenSSL versions
270--
2712.17.1
272
diff --git a/meta/recipes-devtools/python/python3/0001-Makefile.pre-use-qemu-wrapper-when-gathering-profile.patch b/meta/recipes-devtools/python/python3/0001-Makefile.pre-use-qemu-wrapper-when-gathering-profile.patch
new file mode 100644
index 0000000000..fa7735ff93
--- /dev/null
+++ b/meta/recipes-devtools/python/python3/0001-Makefile.pre-use-qemu-wrapper-when-gathering-profile.patch
@@ -0,0 +1,25 @@
1From cf6a9100902484e4d028ee88742dd2487b014a98 Mon Sep 17 00:00:00 2001
2From: Alexander Kanavin <alex.kanavin@gmail.com>
3Date: Wed, 30 Jan 2019 12:41:04 +0100
4Subject: [PATCH] Makefile.pre: use qemu wrapper when gathering profile data
5
6Upstream-Status: Inappropriate [oe-core specific]
7Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
8---
9 Makefile.pre.in | 3 +--
10 1 file changed, 1 insertion(+), 2 deletions(-)
11
12diff --git a/Makefile.pre.in b/Makefile.pre.in
13index a3a02a7..d5503dd 100644
14--- a/Makefile.pre.in
15+++ b/Makefile.pre.in
16@@ -507,8 +507,7 @@ build_all_generate_profile:
17 $(MAKE) @DEF_MAKE_RULE@ CFLAGS_NODIST="$(CFLAGS_NODIST) $(PGO_PROF_GEN_FLAG)" LDFLAGS_NODIST="$(LDFLAGS_NODIST) $(PGO_PROF_GEN_FLAG)" LIBS="$(LIBS)"
18
19 run_profile_task:
20- @ # FIXME: can't run for a cross build
21- $(LLVM_PROF_FILE) $(RUNSHARED) ./$(BUILDPYTHON) $(PROFILE_TASK) || true
22+ ./pgo-wrapper ./python -m test.regrtest --pgo test_grammar test_opcodes test_dict test_builtin test_exceptions test_types test_support || true
23
24 build_all_merge_profile:
25 $(LLVM_PROF_MERGER)
diff --git a/meta/recipes-devtools/python/python3/0001-distutils-sysconfig-append-STAGING_LIBDIR-python-sys.patch b/meta/recipes-devtools/python/python3/0001-distutils-sysconfig-append-STAGING_LIBDIR-python-sys.patch
new file mode 100644
index 0000000000..8083345a4e
--- /dev/null
+++ b/meta/recipes-devtools/python/python3/0001-distutils-sysconfig-append-STAGING_LIBDIR-python-sys.patch
@@ -0,0 +1,42 @@
1From 4865615a2bc2b78c739e4c33f536712c7f9af061 Mon Sep 17 00:00:00 2001
2From: Alexander Kanavin <alex.kanavin@gmail.com>
3Date: Thu, 31 Jan 2019 16:46:30 +0100
4Subject: [PATCH] distutils/sysconfig: append
5 STAGING_LIBDIR/python-sysconfigdata to sys.path
6
7So that target configuration can be used when running native python
8
9Upstream-Status: Inappropriate [oe-core specific]
10Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
11
12---
13 Lib/distutils/sysconfig.py | 2 ++
14 Lib/sysconfig.py | 2 ++
15 2 files changed, 4 insertions(+)
16
17diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py
18index e07a6c8..6b8c129 100644
19--- a/Lib/distutils/sysconfig.py
20+++ b/Lib/distutils/sysconfig.py
21@@ -421,6 +421,8 @@ def _init_posix():
22 platform=sys.platform,
23 multiarch=getattr(sys.implementation, '_multiarch', ''),
24 ))
25+ if 'STAGING_LIBDIR' in os.environ:
26+ sys.path.append(os.environ['STAGING_LIBDIR']+'/python-sysconfigdata')
27 _temp = __import__(name, globals(), locals(), ['build_time_vars'], 0)
28 build_time_vars = _temp.build_time_vars
29 global _config_vars
30diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py
31index 9ee4d31..e586abd 100644
32--- a/Lib/sysconfig.py
33+++ b/Lib/sysconfig.py
34@@ -412,6 +412,8 @@ def _init_posix(vars):
35 """Initialize the module as appropriate for POSIX systems."""
36 # _sysconfigdata is generated at build time, see _generate_posix_vars()
37 name = _get_sysconfigdata_name()
38+ if 'STAGING_LIBDIR' in os.environ:
39+ sys.path.append(os.environ['STAGING_LIBDIR']+'/python-sysconfigdata')
40 _temp = __import__(name, globals(), locals(), ['build_time_vars'], 0)
41 build_time_vars = _temp.build_time_vars
42 vars.update(build_time_vars)
diff --git a/meta/recipes-devtools/python/python3/0001-h2py-Fix-issue-13032-where-it-fails-with-UnicodeDeco.patch b/meta/recipes-devtools/python/python3/0001-h2py-Fix-issue-13032-where-it-fails-with-UnicodeDeco.patch
deleted file mode 100644
index dd6b24fe92..0000000000
--- a/meta/recipes-devtools/python/python3/0001-h2py-Fix-issue-13032-where-it-fails-with-UnicodeDeco.patch
+++ /dev/null
@@ -1,37 +0,0 @@
1From 2f5a4c708d90fa8db21f446ae879cff79387448d Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Mon, 20 May 2013 21:03:16 -0700
4Subject: [PATCH] h2py: Fix issue 13032 where it fails with UnicodeDecodeError
5
6use utf-8 to open the files
7
8Signed-off-by: Khem Raj <raj.khem@gmail.com>
9
10Upstream-Status: Pending
11---
12 Tools/scripts/h2py.py | 4 ++--
13 1 file changed, 2 insertions(+), 2 deletions(-)
14
15diff --git a/Tools/scripts/h2py.py b/Tools/scripts/h2py.py
16index 4f871d9..a53fbe0 100755
17--- a/Tools/scripts/h2py.py
18+++ b/Tools/scripts/h2py.py
19@@ -69,13 +69,13 @@ def main():
20 sys.stdout.write('# Generated by h2py from stdin\n')
21 process(sys.stdin, sys.stdout)
22 else:
23- fp = open(filename, 'r')
24+ fp = open(filename, 'r', encoding='utf-8')
25 outfile = os.path.basename(filename)
26 i = outfile.rfind('.')
27 if i > 0: outfile = outfile[:i]
28 modname = outfile.upper()
29 outfile = modname + '.py'
30- outfp = open(outfile, 'w')
31+ outfp = open(outfile, 'w', encoding='utf-8')
32 outfp.write('# Generated by h2py from %s\n' % filename)
33 filedict = {}
34 for dir in searchdirs:
35--
361.8.1.2
37
diff --git a/meta/recipes-devtools/python/python3/0001-python3-use-cc_basename-to-replace-CC-for-checking-c.patch b/meta/recipes-devtools/python/python3/0001-python3-use-cc_basename-to-replace-CC-for-checking-c.patch
index ae473661ec..5735954628 100644
--- a/meta/recipes-devtools/python/python3/0001-python3-use-cc_basename-to-replace-CC-for-checking-c.patch
+++ b/meta/recipes-devtools/python/python3/0001-python3-use-cc_basename-to-replace-CC-for-checking-c.patch
@@ -1,4 +1,4 @@
1From 564a5cc634028970dc2f9d8ecc0e464a4fb1dcb6 Mon Sep 17 00:00:00 2001 1From 2645317fef09afe31b01bb2c1d4fe5b9afdbb11a Mon Sep 17 00:00:00 2001
2From: Changqing Li <changqing.li@windriver.com> 2From: Changqing Li <changqing.li@windriver.com>
3Date: Mon, 22 Oct 2018 15:19:51 +0800 3Date: Mon, 22 Oct 2018 15:19:51 +0800
4Subject: [PATCH] python3: use cc_basename to replace CC for checking compiler 4Subject: [PATCH] python3: use cc_basename to replace CC for checking compiler
@@ -22,11 +22,11 @@ patch originally from Li Zhou, I just rework it to new version
22 22
23Signed-off-by: Changqing Li <changqing.li@windriver.com> 23Signed-off-by: Changqing Li <changqing.li@windriver.com>
24--- 24---
25 configure.ac | 23 ++++++++++++----------- 25 configure.ac | 19 ++++++++++---------
26 1 file changed, 12 insertions(+), 11 deletions(-) 26 1 file changed, 10 insertions(+), 9 deletions(-)
27 27
28diff --git a/configure.ac b/configure.ac 28diff --git a/configure.ac b/configure.ac
29index 95c98d1..1b9589e 100644 29index a7de901..4a3681f 100644
30--- a/configure.ac 30--- a/configure.ac
31+++ b/configure.ac 31+++ b/configure.ac
32@@ -54,6 +54,7 @@ AC_CONFIG_HEADER(pyconfig.h) 32@@ -54,6 +54,7 @@ AC_CONFIG_HEADER(pyconfig.h)
@@ -37,7 +37,7 @@ index 95c98d1..1b9589e 100644
37 37
38 # pybuilddir.txt will be created by --generate-posix-vars in the Makefile 38 # pybuilddir.txt will be created by --generate-posix-vars in the Makefile
39 rm -f pybuilddir.txt 39 rm -f pybuilddir.txt
40@@ -716,7 +717,7 @@ AC_MSG_RESULT($with_cxx_main) 40@@ -695,7 +696,7 @@ AC_MSG_RESULT($with_cxx_main)
41 preset_cxx="$CXX" 41 preset_cxx="$CXX"
42 if test -z "$CXX" 42 if test -z "$CXX"
43 then 43 then
@@ -46,15 +46,7 @@ index 95c98d1..1b9589e 100644
46 gcc) AC_PATH_TOOL(CXX, [g++], [g++], [notfound]) ;; 46 gcc) AC_PATH_TOOL(CXX, [g++], [g++], [notfound]) ;;
47 cc) AC_PATH_TOOL(CXX, [c++], [c++], [notfound]) ;; 47 cc) AC_PATH_TOOL(CXX, [c++], [c++], [notfound]) ;;
48 clang|*/clang) AC_PATH_TOOL(CXX, [clang++], [clang++], [notfound]) ;; 48 clang|*/clang) AC_PATH_TOOL(CXX, [clang++], [clang++], [notfound]) ;;
49@@ -978,14 +979,14 @@ rmdir CaseSensitiveTestDir 49@@ -979,7 +980,7 @@ rmdir CaseSensitiveTestDir
50
51 case $MACHDEP in
52 bsdos*)
53- case $CC in
54+ case $cc_basename in
55 gcc) CC="$CC -D_HAVE_BSDI";;
56 esac;;
57 esac
58 50
59 case $ac_sys_system in 51 case $ac_sys_system in
60 hp*|HP*) 52 hp*|HP*)
@@ -63,16 +55,16 @@ index 95c98d1..1b9589e 100644
63 cc|*/cc) CC="$CC -Ae";; 55 cc|*/cc) CC="$CC -Ae";;
64 esac;; 56 esac;;
65 esac 57 esac
66@@ -1310,7 +1311,7 @@ else 58@@ -1336,7 +1337,7 @@ else
67 fi], 59 fi],
68 [AC_MSG_RESULT(no)]) 60 [AC_MSG_RESULT(no)])
69 if test "$Py_LTO" = 'true' ; then 61 if test "$Py_LTO" = 'true' ; then
70- case $CC in 62- case $CC in
71+ case $cc_basename in 63+ case $cc_basename in
72 *clang*) 64 *clang*)
73 # Any changes made here should be reflected in the GCC+Darwin case below 65 AC_SUBST(LLVM_AR)
74 LTOFLAGS="-flto" 66 AC_PATH_TARGET_TOOL(LLVM_AR, llvm-ar, '', ${llvm_path})
75@@ -1374,7 +1375,7 @@ then 67@@ -1426,7 +1427,7 @@ then
76 fi 68 fi
77 fi 69 fi
78 LLVM_PROF_ERR=no 70 LLVM_PROF_ERR=no
@@ -81,7 +73,7 @@ index 95c98d1..1b9589e 100644
81 *clang*) 73 *clang*)
82 # Any changes made here should be reflected in the GCC+Darwin case below 74 # Any changes made here should be reflected in the GCC+Darwin case below
83 PGO_PROF_GEN_FLAG="-fprofile-instr-generate" 75 PGO_PROF_GEN_FLAG="-fprofile-instr-generate"
84@@ -1451,7 +1452,7 @@ then 76@@ -1500,7 +1501,7 @@ then
85 WRAP="-fwrapv" 77 WRAP="-fwrapv"
86 fi 78 fi
87 79
@@ -90,7 +82,7 @@ index 95c98d1..1b9589e 100644
90 *clang*) 82 *clang*)
91 cc_is_clang=1 83 cc_is_clang=1
92 ;; 84 ;;
93@@ -1553,7 +1554,7 @@ yes) 85@@ -1623,7 +1624,7 @@ yes)
94 86
95 # ICC doesn't recognize the option, but only emits a warning 87 # ICC doesn't recognize the option, but only emits a warning
96 ## XXX does it emit an unused result warning and can it be disabled? 88 ## XXX does it emit an unused result warning and can it be disabled?
@@ -99,7 +91,7 @@ index 95c98d1..1b9589e 100644
99 *icc*) 91 *icc*)
100 ac_cv_disable_unused_result_warning=no 92 ac_cv_disable_unused_result_warning=no
101 ;; 93 ;;
102@@ -1808,7 +1809,7 @@ yes) 94@@ -1965,7 +1966,7 @@ yes)
103 esac 95 esac
104 96
105 # ICC needs -fp-model strict or floats behave badly 97 # ICC needs -fp-model strict or floats behave badly
@@ -108,16 +100,7 @@ index 95c98d1..1b9589e 100644
108 *icc*) 100 *icc*)
109 CFLAGS_NODIST="$CFLAGS_NODIST -fp-model strict" 101 CFLAGS_NODIST="$CFLAGS_NODIST -fp-model strict"
110 ;; 102 ;;
111@@ -2574,7 +2575,7 @@ then 103@@ -2727,7 +2728,7 @@ then
112 then CCSHARED="-fPIC"
113 else CCSHARED="-Kpic -belf"
114 fi;;
115- IRIX*/6*) case $CC in
116+ IRIX*/6*) case $cc_basename in
117 *gcc*) CCSHARED="-shared";;
118 *) CCSHARED="";;
119 esac;;
120@@ -2615,7 +2616,7 @@ then
121 then 104 then
122 LINKFORSHARED="-Wl,--export-dynamic" 105 LINKFORSHARED="-Wl,--export-dynamic"
123 fi;; 106 fi;;
@@ -126,7 +109,7 @@ index 95c98d1..1b9589e 100644
126 *gcc*) 109 *gcc*)
127 if $CC -Xlinker --help 2>&1 | grep export-dynamic >/dev/null 110 if $CC -Xlinker --help 2>&1 | grep export-dynamic >/dev/null
128 then 111 then
129@@ -5187,7 +5188,7 @@ if test "$have_gcc_asm_for_x87" = yes; then 112@@ -5429,7 +5430,7 @@ if test "$have_gcc_asm_for_x87" = yes; then
130 # Some versions of gcc miscompile inline asm: 113 # Some versions of gcc miscompile inline asm:
131 # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46491 114 # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46491
132 # http://gcc.gnu.org/ml/gcc/2010-11/msg00366.html 115 # http://gcc.gnu.org/ml/gcc/2010-11/msg00366.html
@@ -135,6 +118,3 @@ index 95c98d1..1b9589e 100644
135 *gcc*) 118 *gcc*)
136 AC_MSG_CHECKING(for gcc ipa-pure-const bug) 119 AC_MSG_CHECKING(for gcc ipa-pure-const bug)
137 saved_cflags="$CFLAGS" 120 saved_cflags="$CFLAGS"
138--
1392.7.4
140
diff --git a/meta/recipes-devtools/python/python3/float-endian.patch b/meta/recipes-devtools/python/python3/0002-Don-t-do-runtime-test-to-get-float-byte-order.patch
index 6ba3f5c252..3721e7c2aa 100644
--- a/meta/recipes-devtools/python/python3/float-endian.patch
+++ b/meta/recipes-devtools/python/python3/0002-Don-t-do-runtime-test-to-get-float-byte-order.patch
@@ -1,3 +1,8 @@
1From fa96a7fd19e17b9c6b4dd01c3c3774fb382dddc6 Mon Sep 17 00:00:00 2001
2From: Ross Burton <ross.burton@intel.com>
3Date: Wed, 5 Sep 2018 11:45:52 +0100
4Subject: [PATCH] Don't do runtime test to get float byte order
5
1Python uses AC_RUN_IFELSE to determine the byte order for floats and doubles, 6Python uses AC_RUN_IFELSE to determine the byte order for floats and doubles,
2and falls back onto "I don't know" if it can't run code. This results in 7and falls back onto "I don't know" if it can't run code. This results in
3crippled floating point numbers in Python, and the regression tests fail. 8crippled floating point numbers in Python, and the regression tests fail.
@@ -8,32 +13,17 @@ binary to identify the format.
8 13
9Upstream-Status: Submitted [https://bugs.python.org/issue34585] 14Upstream-Status: Submitted [https://bugs.python.org/issue34585]
10Signed-off-by: Ross Burton <ross.burton@intel.com> 15Signed-off-by: Ross Burton <ross.burton@intel.com>
11
12From 50df2a4c3a65ed06322be7c26d42b06ce81730c1 Mon Sep 17 00:00:00 2001
13From: Ross Burton <ross.burton@intel.com>
14Date: Wed, 5 Sep 2018 11:45:52 +0100
15Subject: [PATCH] Don't do runtime test to get float byte order
16
17--- 16---
18 configure.ac | 74 +++++------------------------------ 17 configure.ac | 72 +++------------------------
19 m4/ax_c_float_words_bigendian.m4 | 83 ++++++++++++++++++++++++++++++++++++++++ 18 m4/ax_c_float_words_bigendian.m4 | 83 ++++++++++++++++++++++++++++++++
20 2 files changed, 92 insertions(+), 65 deletions(-) 19 2 files changed, 90 insertions(+), 65 deletions(-)
21 create mode 100644 m4/ax_c_float_words_bigendian.m4 20 create mode 100644 m4/ax_c_float_words_bigendian.m4
22 21
23diff --git a/configure.ac b/configure.ac 22diff --git a/configure.ac b/configure.ac
24index c9b755f0f4..1215969871 100644 23index 4a3681f..4ab19a6 100644
25--- a/configure.ac 24--- a/configure.ac
26+++ b/configure.ac 25+++ b/configure.ac
27@@ -9,6 +9,8 @@ AC_PREREQ(2.65) 26@@ -4328,77 +4328,19 @@ fi
28
29 AC_INIT(python, PYTHON_VERSION, https://bugs.python.org/)
30
31+AC_CONFIG_MACRO_DIR(m4)
32+
33 AC_SUBST(BASECPPFLAGS)
34 if test "$srcdir" != . -a "$srcdir" != "$(pwd)"; then
35 # If we're building out-of-tree, we need to make sure the following
36@@ -4128,77 +4130,19 @@ fi
37 # * Check for various properties of floating point * 27 # * Check for various properties of floating point *
38 # ************************************************** 28 # **************************************************
39 29
@@ -120,7 +110,7 @@ index c9b755f0f4..1215969871 100644
120 # The short float repr introduced in Python 3.1 requires the 110 # The short float repr introduced in Python 3.1 requires the
121diff --git a/m4/ax_c_float_words_bigendian.m4 b/m4/ax_c_float_words_bigendian.m4 111diff --git a/m4/ax_c_float_words_bigendian.m4 b/m4/ax_c_float_words_bigendian.m4
122new file mode 100644 112new file mode 100644
123index 0000000000..216b90d803 113index 0000000..216b90d
124--- /dev/null 114--- /dev/null
125+++ b/m4/ax_c_float_words_bigendian.m4 115+++ b/m4/ax_c_float_words_bigendian.m4
126@@ -0,0 +1,83 @@ 116@@ -0,0 +1,83 @@
@@ -207,6 +197,3 @@ index 0000000000..216b90d803
207+esac 197+esac
208+ 198+
209+])# AX_C_FLOAT_WORDS_BIGENDIAN 199+])# AX_C_FLOAT_WORDS_BIGENDIAN
210--
2112.11.0
212
diff --git a/meta/recipes-devtools/python/python3/0002-Makefile-add-target-to-split-profile-generation.patch b/meta/recipes-devtools/python/python3/0002-Makefile-add-target-to-split-profile-generation.patch
deleted file mode 100644
index 2b4ba316e4..0000000000
--- a/meta/recipes-devtools/python/python3/0002-Makefile-add-target-to-split-profile-generation.patch
+++ /dev/null
@@ -1,40 +0,0 @@
1From 98586d6dc598e40b8b821b0dde57599e188a7ca4 Mon Sep 17 00:00:00 2001
2From: Anuj Mittal <anuj.mittal@intel.com>
3Date: Tue, 7 Aug 2018 16:43:17 +0800
4Subject: [PATCH 2/2] Makefile: add target to split profile generation
5
6We don't want to have profile task invoked from here and want to use
7qemu-user instead. Split the profile-opt task so qemu can be invoked
8once binaries have been built with instrumentation and then we can go
9ahead and build again using the profile data generated.
10
11Upstream-Status: Inappropriate [OE-specific]
12
13Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
14---
15 Makefile.pre.in | 6 ++----
16 1 file changed, 2 insertions(+), 4 deletions(-)
17
18diff --git a/Makefile.pre.in b/Makefile.pre.in
19index 84bc3ff..017a2c4 100644
20--- a/Makefile.pre.in
21+++ b/Makefile.pre.in
22@@ -469,13 +469,12 @@ profile-opt:
23 $(MAKE) profile-removal
24 $(MAKE) build_all_generate_profile
25 $(MAKE) profile-removal
26- @echo "Running code to generate profile data (this can take a while):"
27- $(MAKE) run_profile_task
28- $(MAKE) build_all_merge_profile
29+
30+clean_and_use_profile:
31 @echo "Rebuilding with profile guided optimizations:"
32 $(MAKE) clean
33 $(MAKE) build_all_use_profile
34 $(MAKE) profile-removal
35
36 build_all_generate_profile:
37 $(MAKE) @DEF_MAKE_RULE@ CFLAGS_NODIST="$(CFLAGS) $(EXTRA_CFLAGS) $(PGO_PROF_GEN_FLAG) @LTOFLAGS@" LDFLAGS="$(LDFLAGS) $(PGO_PROF_GEN_FLAG) @LTOFLAGS@" LIBS="$(LIBS)"
38--
392.17.1
40
diff --git a/meta/recipes-devtools/python/python3/0002-bpo-29136-Add-TLS-1.3-cipher-suites-and-OP_NO_TLSv1_.patch b/meta/recipes-devtools/python/python3/0002-bpo-29136-Add-TLS-1.3-cipher-suites-and-OP_NO_TLSv1_.patch
deleted file mode 100644
index d48cad7586..0000000000
--- a/meta/recipes-devtools/python/python3/0002-bpo-29136-Add-TLS-1.3-cipher-suites-and-OP_NO_TLSv1_.patch
+++ /dev/null
@@ -1,227 +0,0 @@
1From e950ea68dab006944af194c9910b8f2341d1437d Mon Sep 17 00:00:00 2001
2From: Christian Heimes <christian@python.org>
3Date: Thu, 7 Sep 2017 20:23:52 -0700
4Subject: [PATCH] bpo-29136: Add TLS 1.3 cipher suites and OP_NO_TLSv1_3
5 (GH-1363) (#3444)
6
7* bpo-29136: Add TLS 1.3 support
8
9TLS 1.3 introduces a new, distinct set of cipher suites. The TLS 1.3
10cipher suites don't overlap with cipher suites from TLS 1.2 and earlier.
11Since Python sets its own set of permitted ciphers, TLS 1.3 handshake
12will fail as soon as OpenSSL 1.1.1 is released. Let's enable the common
13AES-GCM and ChaCha20 suites.
14
15Additionally the flag OP_NO_TLSv1_3 is added. It defaults to 0 (no op) with
16OpenSSL prior to 1.1.1. This allows applications to opt-out from TLS 1.3
17now.
18
19Signed-off-by: Christian Heimes <christian@python.org>.
20(cherry picked from commit cb5b68abdeb1b1d56c581d5b4d647018703d61e3)
21
22Upstream-Status: Backport
23[https://github.com/python/cpython/commit/cb5b68abdeb1b1d56c581d5b4d647018703d61e3]
24
25Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
26---
27 Doc/library/ssl.rst | 21 ++++++++++++++
28 Lib/ssl.py | 7 +++++
29 Lib/test/test_ssl.py | 29 ++++++++++++++++++-
30 .../2017-09-04-16-39-49.bpo-29136.vSn1oR.rst | 1 +
31 Modules/_ssl.c | 13 +++++++++
32 5 files changed, 70 insertions(+), 1 deletion(-)
33 create mode 100644 Misc/NEWS.d/next/Library/2017-09-04-16-39-49.bpo-29136.vSn1oR.rst
34
35diff --git a/Doc/library/ssl.rst b/Doc/library/ssl.rst
36index 14f2d68217..29c5e94cf6 100644
37--- a/Doc/library/ssl.rst
38+++ b/Doc/library/ssl.rst
39@@ -285,6 +285,11 @@ purposes.
40
41 3DES was dropped from the default cipher string.
42
43+ .. versionchanged:: 3.7
44+
45+ TLS 1.3 cipher suites TLS_AES_128_GCM_SHA256, TLS_AES_256_GCM_SHA384,
46+ and TLS_CHACHA20_POLY1305_SHA256 were added to the default cipher string.
47+
48
49 Random generation
50 ^^^^^^^^^^^^^^^^^
51@@ -719,6 +724,16 @@ Constants
52
53 .. versionadded:: 3.4
54
55+.. data:: OP_NO_TLSv1_3
56+
57+ Prevents a TLSv1.3 connection. This option is only applicable in conjunction
58+ with :const:`PROTOCOL_TLS`. It prevents the peers from choosing TLSv1.3 as
59+ the protocol version. TLS 1.3 is available with OpenSSL 1.1.1 or later.
60+ When Python has been compiled against an older version of OpenSSL, the
61+ flag defaults to *0*.
62+
63+ .. versionadded:: 3.7
64+
65 .. data:: OP_CIPHER_SERVER_PREFERENCE
66
67 Use the server's cipher ordering preference, rather than the client's.
68@@ -783,6 +798,12 @@ Constants
69
70 .. versionadded:: 3.3
71
72+.. data:: HAS_TLSv1_3
73+
74+ Whether the OpenSSL library has built-in support for the TLS 1.3 protocol.
75+
76+ .. versionadded:: 3.7
77+
78 .. data:: CHANNEL_BINDING_TYPES
79
80 List of supported TLS channel binding types. Strings in this list
81diff --git a/Lib/ssl.py b/Lib/ssl.py
82index 4d302a78fa..f233e72e1f 100644
83--- a/Lib/ssl.py
84+++ b/Lib/ssl.py
85@@ -122,6 +122,7 @@ _import_symbols('OP_')
86 _import_symbols('ALERT_DESCRIPTION_')
87 _import_symbols('SSL_ERROR_')
88 _import_symbols('VERIFY_')
89+from _ssl import HAS_SNI, HAS_ECDH, HAS_NPN, HAS_ALPN, HAS_TLSv1_3
90
91 from _ssl import HAS_SNI, HAS_ECDH, HAS_NPN, HAS_ALPN
92
93@@ -162,6 +163,7 @@ else:
94 # (OpenSSL's default setting is 'DEFAULT:!aNULL:!eNULL')
95 # Enable a better set of ciphers by default
96 # This list has been explicitly chosen to:
97+# * TLS 1.3 ChaCha20 and AES-GCM cipher suites
98 # * Prefer cipher suites that offer perfect forward secrecy (DHE/ECDHE)
99 # * Prefer ECDHE over DHE for better performance
100 # * Prefer AEAD over CBC for better performance and security
101@@ -173,6 +175,8 @@ else:
102 # * Disable NULL authentication, NULL encryption, 3DES and MD5 MACs
103 # for security reasons
104 _DEFAULT_CIPHERS = (
105+ 'TLS13-AES-256-GCM-SHA384:TLS13-CHACHA20-POLY1305-SHA256:'
106+ 'TLS13-AES-128-GCM-SHA256:'
107 'ECDH+AESGCM:ECDH+CHACHA20:DH+AESGCM:DH+CHACHA20:ECDH+AES256:DH+AES256:'
108 'ECDH+AES128:DH+AES:ECDH+HIGH:DH+HIGH:RSA+AESGCM:RSA+AES:RSA+HIGH:'
109 '!aNULL:!eNULL:!MD5:!3DES'
110@@ -180,6 +184,7 @@ _DEFAULT_CIPHERS = (
111
112 # Restricted and more secure ciphers for the server side
113 # This list has been explicitly chosen to:
114+# * TLS 1.3 ChaCha20 and AES-GCM cipher suites
115 # * Prefer cipher suites that offer perfect forward secrecy (DHE/ECDHE)
116 # * Prefer ECDHE over DHE for better performance
117 # * Prefer AEAD over CBC for better performance and security
118@@ -190,6 +195,8 @@ _DEFAULT_CIPHERS = (
119 # * Disable NULL authentication, NULL encryption, MD5 MACs, DSS, RC4, and
120 # 3DES for security reasons
121 _RESTRICTED_SERVER_CIPHERS = (
122+ 'TLS13-AES-256-GCM-SHA384:TLS13-CHACHA20-POLY1305-SHA256:'
123+ 'TLS13-AES-128-GCM-SHA256:'
124 'ECDH+AESGCM:ECDH+CHACHA20:DH+AESGCM:DH+CHACHA20:ECDH+AES256:DH+AES256:'
125 'ECDH+AES128:DH+AES:ECDH+HIGH:DH+HIGH:RSA+AESGCM:RSA+AES:RSA+HIGH:'
126 '!aNULL:!eNULL:!MD5:!DSS:!RC4:!3DES'
127diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py
128index f91af7bd05..1acc12ec2d 100644
129--- a/Lib/test/test_ssl.py
130+++ b/Lib/test/test_ssl.py
131@@ -150,6 +150,13 @@ class BasicSocketTests(unittest.TestCase):
132 ssl.OP_NO_COMPRESSION
133 self.assertIn(ssl.HAS_SNI, {True, False})
134 self.assertIn(ssl.HAS_ECDH, {True, False})
135+ ssl.OP_NO_SSLv2
136+ ssl.OP_NO_SSLv3
137+ ssl.OP_NO_TLSv1
138+ ssl.OP_NO_TLSv1_3
139+ if ssl.OPENSSL_VERSION_INFO >= (1, 0, 1):
140+ ssl.OP_NO_TLSv1_1
141+ ssl.OP_NO_TLSv1_2
142
143 def test_str_for_enums(self):
144 # Make sure that the PROTOCOL_* constants have enum-like string
145@@ -3028,12 +3035,33 @@ else:
146 self.assertEqual(s.version(), 'TLSv1')
147 self.assertIs(s.version(), None)
148
149+ @unittest.skipUnless(ssl.HAS_TLSv1_3,
150+ "test requires TLSv1.3 enabled OpenSSL")
151+ def test_tls1_3(self):
152+ context = ssl.SSLContext(ssl.PROTOCOL_TLS)
153+ context.load_cert_chain(CERTFILE)
154+ # disable all but TLS 1.3
155+ context.options |= (
156+ ssl.OP_NO_TLSv1 | ssl.OP_NO_TLSv1_1 | ssl.OP_NO_TLSv1_2
157+ )
158+ with ThreadedEchoServer(context=context) as server:
159+ with context.wrap_socket(socket.socket()) as s:
160+ s.connect((HOST, server.port))
161+ self.assertIn(s.cipher()[0], [
162+ 'TLS13-AES-256-GCM-SHA384',
163+ 'TLS13-CHACHA20-POLY1305-SHA256',
164+ 'TLS13-AES-128-GCM-SHA256',
165+ ])
166+
167 @unittest.skipUnless(ssl.HAS_ECDH, "test requires ECDH-enabled OpenSSL")
168 def test_default_ecdh_curve(self):
169 # Issue #21015: elliptic curve-based Diffie Hellman key exchange
170 # should be enabled by default on SSL contexts.
171 context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
172 context.load_cert_chain(CERTFILE)
173+ # TLSv1.3 defaults to PFS key agreement and no longer has KEA in
174+ # cipher name.
175+ context.options |= ssl.OP_NO_TLSv1_3
176 # Prior to OpenSSL 1.0.0, ECDH ciphers have to be enabled
177 # explicitly using the 'ECCdraft' cipher alias. Otherwise,
178 # our default cipher list should prefer ECDH-based ciphers
179@@ -3394,7 +3422,6 @@ else:
180 s.sendfile(file)
181 self.assertEqual(s.recv(1024), TEST_DATA)
182
183-
184 def test_main(verbose=False):
185 if support.verbose:
186 import warnings
187diff --git a/Misc/NEWS.d/next/Library/2017-09-04-16-39-49.bpo-29136.vSn1oR.rst b/Misc/NEWS.d/next/Library/2017-09-04-16-39-49.bpo-29136.vSn1oR.rst
188new file mode 100644
189index 0000000000..e76997ef83
190--- /dev/null
191+++ b/Misc/NEWS.d/next/Library/2017-09-04-16-39-49.bpo-29136.vSn1oR.rst
192@@ -0,0 +1 @@
193+Add TLS 1.3 cipher suites and OP_NO_TLSv1_3.
194diff --git a/Modules/_ssl.c b/Modules/_ssl.c
195index 0d5c121d2c..c71d89607c 100644
196--- a/Modules/_ssl.c
197+++ b/Modules/_ssl.c
198@@ -4842,6 +4842,11 @@ PyInit__ssl(void)
199 #if HAVE_TLSv1_2
200 PyModule_AddIntConstant(m, "OP_NO_TLSv1_1", SSL_OP_NO_TLSv1_1);
201 PyModule_AddIntConstant(m, "OP_NO_TLSv1_2", SSL_OP_NO_TLSv1_2);
202+#endif
203+#ifdef SSL_OP_NO_TLSv1_3
204+ PyModule_AddIntConstant(m, "OP_NO_TLSv1_3", SSL_OP_NO_TLSv1_3);
205+#else
206+ PyModule_AddIntConstant(m, "OP_NO_TLSv1_3", 0);
207 #endif
208 PyModule_AddIntConstant(m, "OP_CIPHER_SERVER_PREFERENCE",
209 SSL_OP_CIPHER_SERVER_PREFERENCE);
210@@ -4890,6 +4895,14 @@ PyInit__ssl(void)
211 Py_INCREF(r);
212 PyModule_AddObject(m, "HAS_ALPN", r);
213
214+#if defined(TLS1_3_VERSION) && !defined(OPENSSL_NO_TLS1_3)
215+ r = Py_True;
216+#else
217+ r = Py_False;
218+#endif
219+ Py_INCREF(r);
220+ PyModule_AddObject(m, "HAS_TLSv1_3", r);
221+
222 /* Mappings for error codes */
223 err_codes_to_names = PyDict_New();
224 err_names_to_codes = PyDict_New();
225--
2262.17.1
227
diff --git a/meta/recipes-devtools/python/python3/0003-bpo-32947-Fixes-for-TLS-1.3-and-OpenSSL-1.1.1-GH-876.patch b/meta/recipes-devtools/python/python3/0003-bpo-32947-Fixes-for-TLS-1.3-and-OpenSSL-1.1.1-GH-876.patch
deleted file mode 100644
index 56d591d1b5..0000000000
--- a/meta/recipes-devtools/python/python3/0003-bpo-32947-Fixes-for-TLS-1.3-and-OpenSSL-1.1.1-GH-876.patch
+++ /dev/null
@@ -1,173 +0,0 @@
1From 170a614904febd14ff6cfd7a75c9bccc114b3948 Mon Sep 17 00:00:00 2001
2From: Christian Heimes <christian@python.org>
3Date: Tue, 14 Aug 2018 16:56:32 +0200
4Subject: [PATCH] bpo-32947: Fixes for TLS 1.3 and OpenSSL 1.1.1 (GH-8761)
5
6Backport of TLS 1.3 related fixes from 3.7.
7
8Misc fixes and workarounds for compatibility with OpenSSL 1.1.1 from git
9master and TLS 1.3 support. With OpenSSL 1.1.1, Python negotiates TLS 1.3 by
10default. Some test cases only apply to TLS 1.2.
11
12OpenSSL 1.1.1 has added a new option OP_ENABLE_MIDDLEBOX_COMPAT for TLS
131.3. The feature is enabled by default for maximum compatibility with
14broken middle boxes. Users should be able to disable the hack and CPython's test suite needs
15it to verify default options
16
17Signed-off-by: Christian Heimes <christian@python.org>
18
19Upstream-Status: Backport
20[https://github.com/python/cpython/commit/2a4ee8aa01d61b6a9c8e9c65c211e61bdb471826]
21
22Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
23---
24 Doc/library/ssl.rst | 9 ++++++
25 Lib/test/test_asyncio/test_events.py | 6 +++-
26 Lib/test/test_ssl.py | 29 +++++++++++++++----
27 .../2018-08-14-08-57-01.bpo-32947.mqStVW.rst | 2 ++
28 Modules/_ssl.c | 4 +++
29 5 files changed, 44 insertions(+), 6 deletions(-)
30 create mode 100644 Misc/NEWS.d/next/Library/2018-08-14-08-57-01.bpo-32947.mqStVW.rst
31
32diff --git a/Doc/library/ssl.rst b/Doc/library/ssl.rst
33index 29c5e94cf6..f63a3deec5 100644
34--- a/Doc/library/ssl.rst
35+++ b/Doc/library/ssl.rst
36@@ -757,6 +757,15 @@ Constants
37
38 .. versionadded:: 3.3
39
40+.. data:: OP_ENABLE_MIDDLEBOX_COMPAT
41+
42+ Send dummy Change Cipher Spec (CCS) messages in TLS 1.3 handshake to make
43+ a TLS 1.3 connection look more like a TLS 1.2 connection.
44+
45+ This option is only available with OpenSSL 1.1.1 and later.
46+
47+ .. versionadded:: 3.6.7
48+
49 .. data:: OP_NO_COMPRESSION
50
51 Disable compression on the SSL channel. This is useful if the application
52diff --git a/Lib/test/test_asyncio/test_events.py b/Lib/test/test_asyncio/test_events.py
53index 492a84a231..6f208474b9 100644
54--- a/Lib/test/test_asyncio/test_events.py
55+++ b/Lib/test/test_asyncio/test_events.py
56@@ -1169,7 +1169,11 @@ class EventLoopTestsMixin:
57 self.loop.run_until_complete(f_c)
58
59 # close connection
60- proto.transport.close()
61+ # transport may be None with TLS 1.3, because connection is
62+ # interrupted, server is unable to send session tickets, and
63+ # transport is closed.
64+ if proto.transport is not None:
65+ proto.transport.close()
66 server.close()
67
68 def test_legacy_create_server_ssl_match_failed(self):
69diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py
70index 1acc12ec2d..a2e1d32a62 100644
71--- a/Lib/test/test_ssl.py
72+++ b/Lib/test/test_ssl.py
73@@ -78,6 +78,7 @@ OP_NO_COMPRESSION = getattr(ssl, "OP_NO_COMPRESSION", 0)
74 OP_SINGLE_DH_USE = getattr(ssl, "OP_SINGLE_DH_USE", 0)
75 OP_SINGLE_ECDH_USE = getattr(ssl, "OP_SINGLE_ECDH_USE", 0)
76 OP_CIPHER_SERVER_PREFERENCE = getattr(ssl, "OP_CIPHER_SERVER_PREFERENCE", 0)
77+OP_ENABLE_MIDDLEBOX_COMPAT = getattr(ssl, "OP_ENABLE_MIDDLEBOX_COMPAT", 0)
78
79
80 def handle_error(prefix):
81@@ -155,8 +156,8 @@ class BasicSocketTests(unittest.TestCase):
82 ssl.OP_NO_TLSv1
83 ssl.OP_NO_TLSv1_3
84 if ssl.OPENSSL_VERSION_INFO >= (1, 0, 1):
85- ssl.OP_NO_TLSv1_1
86- ssl.OP_NO_TLSv1_2
87+ ssl.OP_NO_TLSv1_1
88+ ssl.OP_NO_TLSv1_2
89
90 def test_str_for_enums(self):
91 # Make sure that the PROTOCOL_* constants have enum-like string
92@@ -854,7 +855,8 @@ class ContextTests(unittest.TestCase):
93 default = (ssl.OP_ALL | ssl.OP_NO_SSLv2 | ssl.OP_NO_SSLv3)
94 # SSLContext also enables these by default
95 default |= (OP_NO_COMPRESSION | OP_CIPHER_SERVER_PREFERENCE |
96- OP_SINGLE_DH_USE | OP_SINGLE_ECDH_USE)
97+ OP_SINGLE_DH_USE | OP_SINGLE_ECDH_USE |
98+ OP_ENABLE_MIDDLEBOX_COMPAT)
99 self.assertEqual(default, ctx.options)
100 ctx.options |= ssl.OP_NO_TLSv1
101 self.assertEqual(default | ssl.OP_NO_TLSv1, ctx.options)
102@@ -1860,11 +1862,26 @@ else:
103 self.sock, server_side=True)
104 self.server.selected_npn_protocols.append(self.sslconn.selected_npn_protocol())
105 self.server.selected_alpn_protocols.append(self.sslconn.selected_alpn_protocol())
106- except (ssl.SSLError, ConnectionResetError) as e:
107+ except (ConnectionResetError, BrokenPipeError) as e:
108 # We treat ConnectionResetError as though it were an
109 # SSLError - OpenSSL on Ubuntu abruptly closes the
110 # connection when asked to use an unsupported protocol.
111 #
112+ # BrokenPipeError is raised in TLS 1.3 mode, when OpenSSL
113+ # tries to send session tickets after handshake.
114+ # https://github.com/openssl/openssl/issues/6342
115+ self.server.conn_errors.append(str(e))
116+ if self.server.chatty:
117+ handle_error(
118+ "\n server: bad connection attempt from " + repr(
119+ self.addr) + ":\n")
120+ self.running = False
121+ self.close()
122+ return False
123+ except (ssl.SSLError, OSError) as e:
124+ # OSError may occur with wrong protocols, e.g. both
125+ # sides use PROTOCOL_TLS_SERVER.
126+ #
127 # XXX Various errors can have happened here, for example
128 # a mismatching protocol version, an invalid certificate,
129 # or a low-level bug. This should be made more discriminating.
130@@ -2974,7 +2991,7 @@ else:
131 # Block on the accept and wait on the connection to close.
132 evt.set()
133 remote, peer = server.accept()
134- remote.recv(1)
135+ remote.send(remote.recv(4))
136
137 t = threading.Thread(target=serve)
138 t.start()
139@@ -2982,6 +2999,8 @@ else:
140 evt.wait()
141 client = context.wrap_socket(socket.socket())
142 client.connect((host, port))
143+ client.send(b'data')
144+ client.recv()
145 client_addr = client.getsockname()
146 client.close()
147 t.join()
148diff --git a/Misc/NEWS.d/next/Library/2018-08-14-08-57-01.bpo-32947.mqStVW.rst b/Misc/NEWS.d/next/Library/2018-08-14-08-57-01.bpo-32947.mqStVW.rst
149new file mode 100644
150index 0000000000..28de360c36
151--- /dev/null
152+++ b/Misc/NEWS.d/next/Library/2018-08-14-08-57-01.bpo-32947.mqStVW.rst
153@@ -0,0 +1,2 @@
154+Add OP_ENABLE_MIDDLEBOX_COMPAT and test workaround for TLSv1.3 for future
155+compatibility with OpenSSL 1.1.1.
156diff --git a/Modules/_ssl.c b/Modules/_ssl.c
157index c71d89607c..eb123a87ba 100644
158--- a/Modules/_ssl.c
159+++ b/Modules/_ssl.c
160@@ -4858,6 +4858,10 @@ PyInit__ssl(void)
161 PyModule_AddIntConstant(m, "OP_NO_COMPRESSION",
162 SSL_OP_NO_COMPRESSION);
163 #endif
164+#ifdef SSL_OP_ENABLE_MIDDLEBOX_COMPAT
165+ PyModule_AddIntConstant(m, "OP_ENABLE_MIDDLEBOX_COMPAT",
166+ SSL_OP_ENABLE_MIDDLEBOX_COMPAT);
167+#endif
168
169 #if HAVE_SNI
170 r = Py_True;
171--
1722.17.1
173
diff --git a/meta/recipes-devtools/python/python3/pass-missing-libraries-to-Extension-for-mul.patch b/meta/recipes-devtools/python/python3/0003-setup.py-pass-missing-libraries-to-Extension-for-mul.patch
index 5c3af6b626..b9d5bc9c51 100644
--- a/meta/recipes-devtools/python/python3/pass-missing-libraries-to-Extension-for-mul.patch
+++ b/meta/recipes-devtools/python/python3/0003-setup.py-pass-missing-libraries-to-Extension-for-mul.patch
@@ -1,7 +1,8 @@
1From a784b70d47ba2104afbcfd805e2a66cdc2109ec5 Mon Sep 17 00:00:00 2001 1From b881a79adcd4ae5ac8fe4f49d0fc77c47f777919 Mon Sep 17 00:00:00 2001
2From: Hongxu Jia <hongxu.jia@windriver.com> 2From: Hongxu Jia <hongxu.jia@windriver.com>
3Date: Fri, 4 Aug 2017 11:16:14 +0800 3Date: Fri, 4 Aug 2017 11:16:14 +0800
4Subject: [PATCH] setup.py: pass missing libraries to Extension for multiprocessing module 4Subject: [PATCH] setup.py: pass missing libraries to Extension for
5 multiprocessing module
5 6
6In the following commit: 7In the following commit:
7... 8...
@@ -53,10 +54,10 @@ Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
53 1 file changed, 5 insertions(+), 2 deletions(-) 54 1 file changed, 5 insertions(+), 2 deletions(-)
54 55
55diff --git a/setup.py b/setup.py 56diff --git a/setup.py b/setup.py
56index 4f0f522..d05707d 100644 57index b7a36a6..658ead3 100644
57--- a/setup.py 58--- a/setup.py
58+++ b/setup.py 59+++ b/setup.py
59@@ -1606,8 +1606,10 @@ class PyBuildExt(build_ext): 60@@ -1584,8 +1584,10 @@ class PyBuildExt(build_ext):
60 elif host_platform.startswith('netbsd'): 61 elif host_platform.startswith('netbsd'):
61 macros = dict() 62 macros = dict()
62 libraries = [] 63 libraries = []
@@ -69,14 +70,11 @@ index 4f0f522..d05707d 100644
69 macros = dict() 70 macros = dict()
70 libraries = ['rt'] 71 libraries = ['rt']
71 72
72@@ -1626,6 +1628,7 @@ class PyBuildExt(build_ext): 73@@ -1603,6 +1605,7 @@ class PyBuildExt(build_ext):
73 if sysconfig.get_config_var('WITH_THREAD'): 74
74 exts.append ( Extension('_multiprocessing', multiprocessing_srcs, 75 exts.append ( Extension('_multiprocessing', multiprocessing_srcs,
75 define_macros=list(macros.items()), 76 define_macros=list(macros.items()),
76+ libraries=libraries, 77+ libraries=libraries,
77 include_dirs=["Modules/_multiprocessing"])) 78 include_dirs=["Modules/_multiprocessing"]))
78 else: 79 # End multiprocessing
79 missing.append('_multiprocessing') 80
80--
812.7.4
82
diff --git a/meta/recipes-devtools/python/python3/0004-bpo-33570-TLS-1.3-ciphers-for-OpenSSL-1.1.1-GH-6976.patch b/meta/recipes-devtools/python/python3/0004-bpo-33570-TLS-1.3-ciphers-for-OpenSSL-1.1.1-GH-6976.patch
deleted file mode 100644
index b97d5501e1..0000000000
--- a/meta/recipes-devtools/python/python3/0004-bpo-33570-TLS-1.3-ciphers-for-OpenSSL-1.1.1-GH-6976.patch
+++ /dev/null
@@ -1,110 +0,0 @@
1From 0c9354362bfa5f90fbea8ff8237a1f1f5dba686f Mon Sep 17 00:00:00 2001
2From: Christian Heimes <christian@python.org>
3Date: Wed, 12 Sep 2018 15:20:31 +0800
4Subject: [PATCH] bpo-33570: TLS 1.3 ciphers for OpenSSL 1.1.1 (GH-6976)
5
6Change TLS 1.3 cipher suite settings for compatibility with OpenSSL
71.1.1-pre6 and newer. OpenSSL 1.1.1 will have TLS 1.3 cipers enabled by
8default.
9
10Also update multissltests and Travis config to test with latest OpenSSL.
11
12Signed-off-by: Christian Heimes <christian@python.org>
13(cherry picked from commit e8eb6cb7920ded66abc5d284319a8539bdc2bae3)
14
15Co-authored-by: Christian Heimes <christian@python.org
16
17Upstream-Status: Backport
18[https://github.com/python/cpython/commit/3e630c541b35c96bfe5619165255e559f577ee71]
19
20Tweaked patch to not take changes for multissltests and Travis config.
21
22Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
23---
24 Lib/test/test_ssl.py | 51 ++++++++++++++++++++++----------------------
25 1 file changed, 26 insertions(+), 25 deletions(-)
26
27diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py
28index a2e1d32a62..c484ead5ff 100644
29--- a/Lib/test/test_ssl.py
30+++ b/Lib/test/test_ssl.py
31@@ -3024,17 +3024,21 @@ else:
32 sock.do_handshake()
33 self.assertEqual(cm.exception.errno, errno.ENOTCONN)
34
35- def test_default_ciphers(self):
36- context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
37- try:
38- # Force a set of weak ciphers on our client context
39- context.set_ciphers("DES")
40- except ssl.SSLError:
41- self.skipTest("no DES cipher available")
42- with ThreadedEchoServer(CERTFILE,
43- ssl_version=ssl.PROTOCOL_SSLv23,
44- chatty=False) as server:
45- with context.wrap_socket(socket.socket()) as s:
46+ def test_no_shared_ciphers(self):
47+ server_context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
48+ server_context.load_cert_chain(SIGNED_CERTFILE)
49+ client_context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
50+ client_context.verify_mode = ssl.CERT_REQUIRED
51+ client_context.check_hostname = True
52+
53+ client_context.set_ciphers("AES128")
54+ server_context.set_ciphers("AES256")
55+ # OpenSSL enables all TLS 1.3 ciphers, enforce TLS 1.2 for test
56+ client_context.options |= ssl.OP_NO_TLSv1_3
57+ with ThreadedEchoServer(context=server_context) as server:
58+ with client_context.wrap_socket(
59+ socket.socket(),
60+ server_hostname="localhost") as s:
61 with self.assertRaises(OSError):
62 s.connect((HOST, server.port))
63 self.assertIn("no shared cipher", str(server.conn_errors[0]))
64@@ -3067,9 +3071,9 @@ else:
65 with context.wrap_socket(socket.socket()) as s:
66 s.connect((HOST, server.port))
67 self.assertIn(s.cipher()[0], [
68- 'TLS13-AES-256-GCM-SHA384',
69- 'TLS13-CHACHA20-POLY1305-SHA256',
70- 'TLS13-AES-128-GCM-SHA256',
71+ 'TLS_AES_256_GCM_SHA384',
72+ 'TLS_CHACHA20_POLY1305_SHA256',
73+ 'TLS_AES_128_GCM_SHA256',
74 ])
75
76 @unittest.skipUnless(ssl.HAS_ECDH, "test requires ECDH-enabled OpenSSL")
77@@ -3391,22 +3395,19 @@ else:
78 client_context = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
79 client_context.verify_mode = ssl.CERT_REQUIRED
80 client_context.load_verify_locations(SIGNING_CA)
81- if ssl.OPENSSL_VERSION_INFO >= (1, 0, 2):
82- client_context.set_ciphers("AES128:AES256")
83- server_context.set_ciphers("AES256")
84- alg1 = "AES256"
85- alg2 = "AES-256"
86- else:
87- client_context.set_ciphers("AES:3DES")
88- server_context.set_ciphers("3DES")
89- alg1 = "3DES"
90- alg2 = "DES-CBC3"
91+ client_context.set_ciphers("AES128:AES256")
92+ server_context.set_ciphers("AES256")
93+ expected_algs = [
94+ "AES256", "AES-256",
95+ # TLS 1.3 ciphers are always enabled
96+ "TLS_CHACHA20", "TLS_AES",
97+ ]
98
99 stats = server_params_test(client_context, server_context)
100 ciphers = stats['server_shared_ciphers'][0]
101 self.assertGreater(len(ciphers), 0)
102 for name, tls_version, bits in ciphers:
103- if not alg1 in name.split("-") and alg2 not in name:
104+ if not any (alg in name for alg in expected_algs):
105 self.fail(name)
106
107 def test_read_write_after_close_raises_valuerror(self):
108--
1092.17.1
110
diff --git a/meta/recipes-devtools/python/python3/0005-bpo-30714-ALPN-changes-for-OpenSSL-1.1.0f-2305.patch b/meta/recipes-devtools/python/python3/0005-bpo-30714-ALPN-changes-for-OpenSSL-1.1.0f-2305.patch
deleted file mode 100644
index d609847204..0000000000
--- a/meta/recipes-devtools/python/python3/0005-bpo-30714-ALPN-changes-for-OpenSSL-1.1.0f-2305.patch
+++ /dev/null
@@ -1,68 +0,0 @@
1From 7b40cb7293cb14e5c7c8ed123efaf9acb33edae2 Mon Sep 17 00:00:00 2001
2From: Christian Heimes <christian@python.org>
3Date: Tue, 15 Aug 2017 10:33:43 +0200
4Subject: [PATCH] bpo-30714: ALPN changes for OpenSSL 1.1.0f (#2305)
5
6OpenSSL 1.1.0 to 1.1.0e aborted the handshake when server and client
7could not agree on a protocol using ALPN. OpenSSL 1.1.0f changed that.
8The most recent version now behaves like OpenSSL 1.0.2 again. The ALPN
9callback can pretend to not been set.
10
11See https://github.com/openssl/openssl/pull/3158 for more details
12
13Signed-off-by: Christian Heimes <christian@python.org>
14
15Upstream-Status: Backport
16[https://github.com/python/cpython/commit/7b40cb7293cb14e5c7c8ed123efaf9acb33edae2]
17
18Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
19---
20 Doc/library/ssl.rst | 5 +++--
21 Lib/test/test_ssl.py | 5 +++--
22 .../next/Tests/2017-07-25-15-27-44.bpo-30715.Sp7bTF.rst | 2 ++
23 3 files changed, 8 insertions(+), 4 deletions(-)
24 create mode 100644 Misc/NEWS.d/next/Tests/2017-07-25-15-27-44.bpo-30715.Sp7bTF.rst
25
26diff --git a/Doc/library/ssl.rst b/Doc/library/ssl.rst
27index 729a239a1b..0a09e7e9d4 100644
28--- a/Doc/library/ssl.rst
29+++ b/Doc/library/ssl.rst
30@@ -1447,8 +1447,9 @@ to speed up repeated connections from the same clients.
31 This method will raise :exc:`NotImplementedError` if :data:`HAS_ALPN` is
32 False.
33
34- OpenSSL 1.1.0+ will abort the handshake and raise :exc:`SSLError` when
35- both sides support ALPN but cannot agree on a protocol.
36+ OpenSSL 1.1.0 to 1.1.0e will abort the handshake and raise :exc:`SSLError`
37+ when both sides support ALPN but cannot agree on a protocol. 1.1.0f+
38+ behaves like 1.0.2, :meth:`SSLSocket.selected_alpn_protocol` returns None.
39
40 .. versionadded:: 3.5
41
42diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py
43index d960d82065..104b7f377a 100644
44--- a/Lib/test/test_ssl.py
45+++ b/Lib/test/test_ssl.py
46@@ -3268,8 +3268,9 @@ if _have_threads:
47 except ssl.SSLError as e:
48 stats = e
49
50- if expected is None and IS_OPENSSL_1_1:
51- # OpenSSL 1.1.0 raises handshake error
52+ if (expected is None and IS_OPENSSL_1_1
53+ and ssl.OPENSSL_VERSION_INFO < (1, 1, 0, 6)):
54+ # OpenSSL 1.1.0 to 1.1.0e raises handshake error
55 self.assertIsInstance(stats, ssl.SSLError)
56 else:
57 msg = "failed trying %s (s) and %s (c).\n" \
58diff --git a/Misc/NEWS.d/next/Tests/2017-07-25-15-27-44.bpo-30715.Sp7bTF.rst b/Misc/NEWS.d/next/Tests/2017-07-25-15-27-44.bpo-30715.Sp7bTF.rst
59new file mode 100644
60index 0000000000..88394e585c
61--- /dev/null
62+++ b/Misc/NEWS.d/next/Tests/2017-07-25-15-27-44.bpo-30715.Sp7bTF.rst
63@@ -0,0 +1,2 @@
64+Address ALPN callback changes for OpenSSL 1.1.0f. The latest version behaves
65+like OpenSSL 1.0.2 and no longer aborts handshake.
66--
672.17.1
68
diff --git a/meta/recipes-devtools/python/python3/03-fix-tkinter-detection.patch b/meta/recipes-devtools/python/python3/03-fix-tkinter-detection.patch
deleted file mode 100644
index fddfd2b2f6..0000000000
--- a/meta/recipes-devtools/python/python3/03-fix-tkinter-detection.patch
+++ /dev/null
@@ -1,42 +0,0 @@
1Upstream-Status: Inappropriate [embedded specific]
2
3# We need to supply STAGING_INCDIR here, otherwise the Tk headers
4# will not be found.
5# Signed-Off: Michael 'Mickey' Lauer <mickey@vanille.de>
6
7Index: Python-3.3.0rc2/setup.py
8===================================================================
9--- Python-3.3.0rc2.orig/setup.py 2012-09-20 15:24:14.009124003 -0700
10+++ Python-3.3.0rc2/setup.py 2012-09-20 15:25:08.449124963 -0700
11@@ -1620,7 +1620,7 @@
12 dotversion = dotversion[:-1] + '.' + dotversion[-1]
13 tcl_include_sub = []
14 tk_include_sub = []
15- for dir in inc_dirs:
16+ for dir in [os.getenv("STAGING_INCDIR")]:
17 tcl_include_sub += [dir + os.sep + "tcl" + dotversion]
18 tk_include_sub += [dir + os.sep + "tk" + dotversion]
19 tk_include_sub += tcl_include_sub
20@@ -1639,22 +1639,6 @@
21 if dir not in include_dirs:
22 include_dirs.append(dir)
23
24- # Check for various platform-specific directories
25- if host_platform == 'sunos5':
26- include_dirs.append('/usr/openwin/include')
27- added_lib_dirs.append('/usr/openwin/lib')
28- elif os.path.exists('/usr/X11R6/include'):
29- include_dirs.append('/usr/X11R6/include')
30- added_lib_dirs.append('/usr/X11R6/lib64')
31- added_lib_dirs.append('/usr/X11R6/lib')
32- elif os.path.exists('/usr/X11R5/include'):
33- include_dirs.append('/usr/X11R5/include')
34- added_lib_dirs.append('/usr/X11R5/lib')
35- else:
36- # Assume default location for X11
37- include_dirs.append('/usr/X11/include')
38- added_lib_dirs.append('/usr/X11/lib')
39-
40 # If Cygwin, then verify that X is installed before proceeding
41 if host_platform == 'cygwin':
42 x11_inc = find_file('X11/Xlib.h', [], include_dirs)
diff --git a/meta/recipes-devtools/python/python3/030-fixup-include-dirs.patch b/meta/recipes-devtools/python/python3/030-fixup-include-dirs.patch
deleted file mode 100644
index 6beac7b805..0000000000
--- a/meta/recipes-devtools/python/python3/030-fixup-include-dirs.patch
+++ /dev/null
@@ -1,33 +0,0 @@
1Do not hardcode /usr into include paths when cross compiling
2
3-Khem
4
5Upstream-Status: Pending
6
7---
8 setup.py | 15 ++-------------
9 1 file changed, 2 insertions(+), 13 deletions(-)
10
11Index: Python-3.3.2/setup.py
12===================================================================
13--- Python-3.3.2.orig/setup.py
14+++ Python-3.3.2/setup.py
15@@ -444,7 +444,8 @@ class PyBuildExt(build_ext):
16 # only change this for cross builds for 3.3, issues on Mageia
17 if cross_compiling:
18 self.add_gcc_paths()
19- self.add_multiarch_paths()
20+ if not cross_compiling:
21+ self.add_multiarch_paths()
22
23 # Add paths specified in the environment variables LDFLAGS and
24 # CPPFLAGS for header and library files.
25@@ -480,7 +481,7 @@ class PyBuildExt(build_ext):
26 for directory in reversed(options.dirs):
27 add_dir_to_list(dir_list, directory)
28
29- if os.path.normpath(sys.base_prefix) != '/usr' \
30+ if not cross_compiling and os.path.normpath(sys.base_prefix) != '/usr' \
31 and not sysconfig.get_config_var('PYTHONFRAMEWORK'):
32 # OSX note: Don't add LIBDIR and INCLUDEDIR to building a framework
33 # (PYTHONFRAMEWORK is set) to avoid # linking problems when
diff --git a/meta/recipes-devtools/python/python3/080-distutils-dont_adjust_files.patch b/meta/recipes-devtools/python/python3/080-distutils-dont_adjust_files.patch
deleted file mode 100644
index b96419a638..0000000000
--- a/meta/recipes-devtools/python/python3/080-distutils-dont_adjust_files.patch
+++ /dev/null
@@ -1,92 +0,0 @@
1do not "adjust" python files before copying
2
3-Khem
4
5Upstream-Status: Inappropriate [Embedded-Specific]
6
7---
8 Lib/distutils/command/build_scripts.py | 43 +++------------------------------
9 1 file changed, 4 insertions(+), 39 deletions(-)
10
11--- a/Lib/distutils/command/build_scripts.py
12+++ b/Lib/distutils/command/build_scripts.py
13@@ -51,10 +51,7 @@ class build_scripts(Command):
14
15
16 def copy_scripts(self):
17- """Copy each script listed in 'self.scripts'; if it's marked as a
18- Python script in the Unix way (first line matches 'first_line_re',
19- ie. starts with "\#!" and contains "python"), then adjust the first
20- line to refer to the current Python interpreter as we copy.
21+ """Copy each script listed in 'self.scripts'
22 """
23 self.mkpath(self.build_dir)
24 outfiles = []
25@@ -78,64 +75,10 @@ class build_scripts(Command):
26 if not self.dry_run:
27 raise
28 f = None
29- else:
30- encoding, lines = tokenize.detect_encoding(f.readline)
31- f.seek(0)
32- first_line = f.readline()
33- if not first_line:
34- self.warn("%s is an empty file (skipping)" % script)
35- continue
36-
37- match = first_line_re.match(first_line)
38- if match:
39- adjust = True
40- post_interp = match.group(1) or b''
41-
42- if adjust:
43- log.info("copying and adjusting %s -> %s", script,
44- self.build_dir)
45- updated_files.append(outfile)
46- if not self.dry_run:
47- if not sysconfig.python_build:
48- executable = self.executable
49- else:
50- executable = os.path.join(
51- sysconfig.get_config_var("BINDIR"),
52- "python%s%s" % (sysconfig.get_config_var("VERSION"),
53- sysconfig.get_config_var("EXE")))
54- executable = os.fsencode(executable)
55- shebang = b"#!" + executable + post_interp + b"\n"
56- # Python parser starts to read a script using UTF-8 until
57- # it gets a #coding:xxx cookie. The shebang has to be the
58- # first line of a file, the #coding:xxx cookie cannot be
59- # written before. So the shebang has to be decodable from
60- # UTF-8.
61- try:
62- shebang.decode('utf-8')
63- except UnicodeDecodeError:
64- raise ValueError(
65- "The shebang ({!r}) is not decodable "
66- "from utf-8".format(shebang))
67- # If the script is encoded to a custom encoding (use a
68- # #coding:xxx cookie), the shebang has to be decodable from
69- # the script encoding too.
70- try:
71- shebang.decode(encoding)
72- except UnicodeDecodeError:
73- raise ValueError(
74- "The shebang ({!r}) is not decodable "
75- "from the script encoding ({})"
76- .format(shebang, encoding))
77- with open(outfile, "wb") as outf:
78- outf.write(shebang)
79- outf.writelines(f.readlines())
80- if f:
81- f.close()
82- else:
83- if f:
84+ if f:
85 f.close()
86- updated_files.append(outfile)
87- self.copy_file(script, outfile)
88+ updated_files.append(outfile)
89+ self.copy_file(script, outfile)
90
91 if os.name == 'posix':
92 for file in outfiles:
diff --git a/meta/recipes-devtools/python/python3/12-distutils-prefix-is-inside-staging-area.patch b/meta/recipes-devtools/python/python3/12-distutils-prefix-is-inside-staging-area.patch
index c53ec0cfc8..dcc0932c7f 100644
--- a/meta/recipes-devtools/python/python3/12-distutils-prefix-is-inside-staging-area.patch
+++ b/meta/recipes-devtools/python/python3/12-distutils-prefix-is-inside-staging-area.patch
@@ -1,7 +1,7 @@
1From 7630ab22578746d3d790d0598c0d279cf7afed97 Mon Sep 17 00:00:00 2001 1From 1397979ee445ff6826aa5469511e003539f77bb2 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 14 May 2013 15:00:26 -0700 3Date: Tue, 14 May 2013 15:00:26 -0700
4Subject: [PATCH 01/20] python3: Add target and native recipes 4Subject: [PATCH] python3: Add target and native recipes
5 5
6Upstream-Status: Inappropriate [embedded specific] 6Upstream-Status: Inappropriate [embedded specific]
7 7
@@ -18,7 +18,7 @@ Upstream-Status: Inappropriate [embedded specific]
18 1 file changed, 8 insertions(+), 2 deletions(-) 18 1 file changed, 8 insertions(+), 2 deletions(-)
19 19
20diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py 20diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py
21index 573724d..390c485 100644 21index 6b8c129..3ca7f79 100644
22--- a/Lib/distutils/sysconfig.py 22--- a/Lib/distutils/sysconfig.py
23+++ b/Lib/distutils/sysconfig.py 23+++ b/Lib/distutils/sysconfig.py
24@@ -84,7 +84,9 @@ def get_python_inc(plat_specific=0, prefix=None): 24@@ -84,7 +84,9 @@ def get_python_inc(plat_specific=0, prefix=None):
@@ -32,7 +32,7 @@ index 573724d..390c485 100644
32 prefix = plat_specific and BASE_EXEC_PREFIX or BASE_PREFIX 32 prefix = plat_specific and BASE_EXEC_PREFIX or BASE_PREFIX
33 if os.name == "posix": 33 if os.name == "posix":
34 if python_build: 34 if python_build:
35@@ -125,6 +127,10 @@ def get_python_lib(plat_specific=0, standard_lib=0, prefix=None): 35@@ -122,6 +124,10 @@ def get_python_lib(plat_specific=0, standard_lib=0, prefix=None):
36 If 'prefix' is supplied, use it instead of sys.base_prefix or 36 If 'prefix' is supplied, use it instead of sys.base_prefix or
37 sys.base_exec_prefix -- i.e., ignore 'plat_specific'. 37 sys.base_exec_prefix -- i.e., ignore 'plat_specific'.
38 """ 38 """
@@ -43,7 +43,7 @@ index 573724d..390c485 100644
43 if prefix is None: 43 if prefix is None:
44 if standard_lib: 44 if standard_lib:
45 prefix = plat_specific and BASE_EXEC_PREFIX or BASE_PREFIX 45 prefix = plat_specific and BASE_EXEC_PREFIX or BASE_PREFIX
46@@ -133,7 +139,7 @@ def get_python_lib(plat_specific=0, standard_lib=0, prefix=None): 46@@ -130,7 +136,7 @@ def get_python_lib(plat_specific=0, standard_lib=0, prefix=None):
47 47
48 if os.name == "posix": 48 if os.name == "posix":
49 libpython = os.path.join(prefix, 49 libpython = os.path.join(prefix,
@@ -52,6 +52,3 @@ index 573724d..390c485 100644
52 if standard_lib: 52 if standard_lib:
53 return libpython 53 return libpython
54 else: 54 else:
55--
562.8.0.rc3
57
diff --git a/meta/recipes-devtools/python/python3/130-readline-setup.patch b/meta/recipes-devtools/python/python3/130-readline-setup.patch
deleted file mode 100644
index cfa712678b..0000000000
--- a/meta/recipes-devtools/python/python3/130-readline-setup.patch
+++ /dev/null
@@ -1,55 +0,0 @@
1package python-readline
2
3-Khem
4
5Upstream-Status: Inappropriate [Embedded Specific]
6
7--- a/setup.py
8+++ b/setup.py
9@@ -666,45 +666,7 @@ class PyBuildExt(build_ext):
10 # readline
11 do_readline = self.compiler.find_library_file(lib_dirs, 'readline')
12 readline_termcap_library = ""
13- curses_library = ""
14- # Cannot use os.popen here in py3k.
15- tmpfile = os.path.join(self.build_temp, 'readline_termcap_lib')
16- if not os.path.exists(self.build_temp):
17- os.makedirs(self.build_temp)
18- # Determine if readline is already linked against curses or tinfo.
19- if do_readline:
20- if cross_compiling:
21- ret = os.system("%s -d %s | grep '(NEEDED)' > %s" \
22- % (sysconfig.get_config_var('READELF'),
23- do_readline, tmpfile))
24- elif find_executable('ldd'):
25- ret = os.system("ldd %s > %s" % (do_readline, tmpfile))
26- else:
27- ret = 256
28- if ret >> 8 == 0:
29- with open(tmpfile) as fp:
30- for ln in fp:
31- if 'curses' in ln:
32- readline_termcap_library = re.sub(
33- r'.*lib(n?cursesw?)\.so.*', r'\1', ln
34- ).rstrip()
35- break
36- # termcap interface split out from ncurses
37- if 'tinfo' in ln:
38- readline_termcap_library = 'tinfo'
39- break
40- if os.path.exists(tmpfile):
41- os.unlink(tmpfile)
42- # Issue 7384: If readline is already linked against curses,
43- # use the same library for the readline and curses modules.
44- if 'curses' in readline_termcap_library:
45- curses_library = readline_termcap_library
46- elif self.compiler.find_library_file(lib_dirs, 'ncursesw'):
47- curses_library = 'ncursesw'
48- elif self.compiler.find_library_file(lib_dirs, 'ncurses'):
49- curses_library = 'ncurses'
50- elif self.compiler.find_library_file(lib_dirs, 'curses'):
51- curses_library = 'curses'
52+ curses_library = "ncursesw"
53
54 if host_platform == 'darwin':
55 os_release = int(os.uname()[2].split('.')[0])
diff --git a/meta/recipes-devtools/python/python3/150-fix-setupterm.patch b/meta/recipes-devtools/python/python3/150-fix-setupterm.patch
deleted file mode 100644
index 78d7c78670..0000000000
--- a/meta/recipes-devtools/python/python3/150-fix-setupterm.patch
+++ /dev/null
@@ -1,17 +0,0 @@
1Fix warning with newer compiler
2
3-Khem
4
5Upstream-Status: Pending
6
7--- a/Modules/_cursesmodule.c
8+++ b/Modules/_cursesmodule.c
9@@ -116,7 +116,7 @@ char *PyCursesVersion = "2.2";
10 #defines many common symbols (such as "lines") which breaks the
11 curses module in other ways. So the code will just specify
12 explicit prototypes here. */
13-extern int setupterm(char *,int,int *);
14+//extern int setupterm(char *,int,int *);
15 #ifdef __sgi
16 #include <term.h>
17 #endif
diff --git a/meta/recipes-devtools/python/python3/Use-correct-CFLAGS-for-extensions-when-cross-compili.patch b/meta/recipes-devtools/python/python3/Use-correct-CFLAGS-for-extensions-when-cross-compili.patch
deleted file mode 100644
index ae74ef531d..0000000000
--- a/meta/recipes-devtools/python/python3/Use-correct-CFLAGS-for-extensions-when-cross-compili.patch
+++ /dev/null
@@ -1,56 +0,0 @@
1From 7fd121bb7d6c25c2e0a1c31cf76fb9bd4a9794de Mon Sep 17 00:00:00 2001
2From: Markus Lehtonen <markus.lehtonen@linux.intel.com>
3Date: Tue, 14 Aug 2018 14:11:35 +0800
4Subject: [PATCH 1/2] Use correct CFLAGS for extensions when cross-compiling
5
6Take PY_CFLAGS_NODIST into account, like in native build. This is needed
7in order to to profile-optimized build. Also, pass EXTRA_CFLAGS to
8profile-optimized build.
9
10Upstream-Status: Pending
11
12Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
13---
14 Makefile.pre.in | 4 ++--
15 setup.py | 3 ++-
16 2 files changed, 4 insertions(+), 3 deletions(-)
17
18diff --git a/Makefile.pre.in b/Makefile.pre.in
19index e2d5d3d..84bc3ff 100644
20--- a/Makefile.pre.in
21+++ b/Makefile.pre.in
22@@ -478,7 +478,7 @@ profile-opt:
23 $(MAKE) profile-removal
24
25 build_all_generate_profile:
26- $(MAKE) @DEF_MAKE_RULE@ CFLAGS_NODIST="$(CFLAGS) $(PGO_PROF_GEN_FLAG) @LTOFLAGS@" LDFLAGS="$(LDFLAGS) $(PGO_PROF_GEN_FLAG) @LTOFLAGS@" LIBS="$(LIBS)"
27+ $(MAKE) @DEF_MAKE_RULE@ CFLAGS_NODIST="$(CFLAGS) $(EXTRA_CFLAGS) $(PGO_PROF_GEN_FLAG) @LTOFLAGS@" LDFLAGS="$(LDFLAGS) $(PGO_PROF_GEN_FLAG) @LTOFLAGS@" LIBS="$(LIBS)"
28
29 run_profile_task:
30 : # FIXME: can't run for a cross build
31@@ -488,7 +488,7 @@ build_all_merge_profile:
32 $(LLVM_PROF_MERGER)
33
34 build_all_use_profile:
35- $(MAKE) @DEF_MAKE_RULE@ CFLAGS_NODIST="$(CFLAGS) $(PGO_PROF_USE_FLAG) @LTOFLAGS@" LDFLAGS="$(LDFLAGS) @LTOFLAGS@"
36+ $(MAKE) @DEF_MAKE_RULE@ CFLAGS_NODIST="$(CFLAGS) $(EXTRA_CFLAGS) $(PGO_PROF_USE_FLAG) @LTOFLAGS@" LDFLAGS="$(LDFLAGS) @LTOFLAGS@"
37
38 # Compile and run with gcov
39 .PHONY=coverage coverage-lcov coverage-report
40diff --git a/setup.py b/setup.py
41index add3346..65e83b1 100644
42--- a/setup.py
43+++ b/setup.py
44@@ -263,7 +263,8 @@ class PyBuildExt(build_ext):
45 # compilers
46 if compiler is not None:
47 if cross_compiling:
48- (ccshared,cflags) = (os.environ.get('CCSHARED') or '', os.environ.get('CFLAGS') or '')
49+ (ccshared,cflags) = (os.environ.get('CCSHARED') or '',
50+ (os.environ.get('CFLAGS') or '') + ' ' + sysconfig.get_config_var('PY_CFLAGS_NODIST'))
51 else:
52 (ccshared,cflags) = sysconfig.get_config_vars('CCSHARED','CFLAGS')
53 args['compiler_so'] = compiler + ' ' + ccshared + ' ' + cflags
54--
552.17.1
56
diff --git a/meta/recipes-devtools/python/python3/avoid-ncursesw-include-path.patch b/meta/recipes-devtools/python/python3/avoid-ncursesw-include-path.patch
deleted file mode 100644
index f29ae53371..0000000000
--- a/meta/recipes-devtools/python/python3/avoid-ncursesw-include-path.patch
+++ /dev/null
@@ -1,21 +0,0 @@
1Upstream-Status: Pending
2
3We should make sure that sysroot is used by gcc instead of assuming
4hardcoded locations for include paths
5
6
7Signed-off-by: Khem Raj <raj.khem@gmail.com>
8
9Index: Python-3.4.2/configure.ac
10===================================================================
11--- Python-3.4.2.orig/configure.ac
12+++ Python-3.4.2/configure.ac
13@@ -4434,7 +4434,7 @@ fi
14
15 # first curses header check
16 ac_save_cppflags="$CPPFLAGS"
17-CPPFLAGS="$CPPFLAGS -I/usr/include/ncursesw"
18+CPPFLAGS="$CPPFLAGS -I=/usr/include/ncursesw"
19
20 AC_CHECK_HEADERS(curses.h ncurses.h)
21
diff --git a/meta/recipes-devtools/python/python3/avoid_warning_about_tkinter.patch b/meta/recipes-devtools/python/python3/avoid_warning_about_tkinter.patch
index a3cc48c9a4..24e67b4ca1 100644
--- a/meta/recipes-devtools/python/python3/avoid_warning_about_tkinter.patch
+++ b/meta/recipes-devtools/python/python3/avoid_warning_about_tkinter.patch
@@ -1,17 +1,24 @@
1_tkinter module needs tk module along with tcl. tk is not yet integrated 1From fead48c8b501a8d7c3db21df2e599f90f38f11d3 Mon Sep 17 00:00:00 2001
2in yocto so we skip the check for this module. 2From: Andrei Gherzan <andrei@gherzan.ro>
3Avoid a warning by not adding this module to missing variable. 3Date: Mon, 28 Jan 2019 15:57:54 +0000
4Subject: [PATCH] _tkinter module needs tk module along with tcl. tk is not yet
5 integrated in yocto so we skip the check for this module. Avoid a warning by
6 not adding this module to missing variable.
4 7
5Upstream-Status: Inappropriate [distribution] 8Upstream-Status: Inappropriate [distribution]
6 9
7Also simply disable the tk module since its not in DEPENDS. 10Also simply disable the tk module since its not in DEPENDS.
8Signed-off-by: Andrei Gherzan <andrei@gherzan.ro> 11Signed-off-by: Andrei Gherzan <andrei@gherzan.ro>
9 12
10Index: Python-3.5.3/setup.py 13---
11=================================================================== 14 setup.py | 8 +++++---
12--- Python-3.5.3.orig/setup.py 15 1 file changed, 5 insertions(+), 3 deletions(-)
13+++ Python-3.5.3/setup.py 16
14@@ -1558,10 +1558,12 @@ class PyBuildExt(build_ext): 17diff --git a/setup.py b/setup.py
18index fbec00d..b7a36a6 100644
19--- a/setup.py
20+++ b/setup.py
21@@ -1623,10 +1623,12 @@ class PyBuildExt(build_ext):
15 self.extensions.extend(exts) 22 self.extensions.extend(exts)
16 23
17 # Call the method for detecting whether _tkinter can be compiled 24 # Call the method for detecting whether _tkinter can be compiled
@@ -25,5 +32,5 @@ Index: Python-3.5.3/setup.py
25+ #if '_tkinter' not in [e.name for e in self.extensions]: 32+ #if '_tkinter' not in [e.name for e in self.extensions]:
26+ # missing.append('_tkinter') 33+ # missing.append('_tkinter')
27 34
28 ## # Uncomment these lines if you want to play with xxmodule.c 35 # Build the _uuid module if possible
29 ## ext = Extension('xx', ['xxmodule.c']) 36 uuid_incs = find_file("uuid.h", inc_dirs, ["/usr/include/uuid"])
diff --git a/meta/recipes-devtools/python/python3/cgi_py.patch b/meta/recipes-devtools/python/python3/cgi_py.patch
index de504f9dcf..6c4ba54320 100644
--- a/meta/recipes-devtools/python/python3/cgi_py.patch
+++ b/meta/recipes-devtools/python/python3/cgi_py.patch
@@ -1,11 +1,20 @@
1Lib/cgi.py: Update the script as mentioned in the comment 1From 62336285cba38017b35cb761c03f0c7e80a671a3 Mon Sep 17 00:00:00 2001
2From: Mark Hatle <mark.hatle@windriver.com>
3Date: Wed, 21 Sep 2011 20:55:33 -0500
4Subject: [PATCH] Lib/cgi.py: Update the script as mentioned in the comment
2 5
3Upstream-Status: Inappropriate [distribution] 6Upstream-Status: Inappropriate [distribution]
4 7
5Signed-off-by: Mark Hatle <mark.hatle@windriver.com> 8Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
6 9
7--- Python-2.6.6/Lib/cgi.py.orig 2010-08-01 22:14:27.000000000 -0500 10---
8+++ Python-2.6.6/Lib/cgi.py 2011-09-21 15:28:40.478208631 -0500 11 Lib/cgi.py | 11 +----------
12 1 file changed, 1 insertion(+), 10 deletions(-)
13
14diff --git a/Lib/cgi.py b/Lib/cgi.py
15index 8cf6687..094c7b4 100755
16--- a/Lib/cgi.py
17+++ b/Lib/cgi.py
9@@ -1,13 +1,4 @@ 18@@ -1,13 +1,4 @@
10-#! /usr/local/bin/python 19-#! /usr/local/bin/python
11- 20-
diff --git a/meta/recipes-devtools/python/python3/check_build_completeness.py b/meta/recipes-devtools/python/python3/check_build_completeness.py
new file mode 100755
index 0000000000..a1eace3f57
--- /dev/null
+++ b/meta/recipes-devtools/python/python3/check_build_completeness.py
@@ -0,0 +1,17 @@
1#!/usr/bin/env python3
2import sys
3logfile = open(sys.argv[1]).read()
4
5necessary_bits = logfile.find("The necessary bits to build these optional modules were not found")
6to_find_bits = logfile.find("To find the necessary bits, look in setup.py in detect_modules() for the module's name.")
7if necessary_bits != -1:
8 print("%s" %(logfile[necessary_bits:to_find_bits]))
9
10failed_to_build = logfile.find("Failed to build these modules:")
11if failed_to_build != -1:
12 failed_to_build_end = logfile.find("\n\n", failed_to_build)
13 print("%s" %(logfile[failed_to_build:failed_to_build_end]))
14
15if necessary_bits != -1 or failed_to_build != -1:
16 sys.exit(1)
17
diff --git a/meta/recipes-devtools/python/python3/configure.ac-fix-LIBPL.patch b/meta/recipes-devtools/python/python3/configure.ac-fix-LIBPL.patch
deleted file mode 100644
index 97214f9aa4..0000000000
--- a/meta/recipes-devtools/python/python3/configure.ac-fix-LIBPL.patch
+++ /dev/null
@@ -1,30 +0,0 @@
1From 7c4f8d87473d6238c120ec6031b58f83a17a39a5 Mon Sep 17 00:00:00 2001
2From: Robert Yang <liezhi.yang@windriver.com>
3Date: Mon, 28 Dec 2015 22:52:06 -0800
4Subject: [PATCH] configure.ac: fix LIBPL
5
6Use LIBDIR rather than prefix/lib, so that it would work when lib64.
7
8Upstream-Status: Pending
9
10Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
11---
12 configure.ac | 2 +-
13 1 file changed, 1 insertion(+), 1 deletion(-)
14
15diff --git a/configure.ac b/configure.ac
16index 63aef8e..aefb27f 100644
17--- a/configure.ac
18+++ b/configure.ac
19@@ -4366,7 +4366,7 @@ AC_MSG_RESULT($LDVERSION)
20
21 dnl define LIBPL after ABIFLAGS and LDVERSION is defined.
22 AC_SUBST(PY_ENABLE_SHARED)
23-LIBPL='$(prefix)'"/lib/python${VERSION}/config-${LDVERSION}"
24+LIBPL='$(LIBDIR)'"/python${VERSION}/config-${LDVERSION}"
25 AC_SUBST(LIBPL)
26
27 # Check whether right shifting a negative integer extends the sign bit
28--
291.7.9.5
30
diff --git a/meta/recipes-devtools/python/python3/fix_for_using_different_libdir.patch b/meta/recipes-devtools/python/python3/fix_for_using_different_libdir.patch
deleted file mode 100644
index 0610565d3c..0000000000
--- a/meta/recipes-devtools/python/python3/fix_for_using_different_libdir.patch
+++ /dev/null
@@ -1,54 +0,0 @@
1Upstream-Status: Inappropriate [Embedded specific]
2
3This patch fixes issuing with different libdir like lib64.
4This patch makes the native python binary modules findable
5in the install process of the host python.
6
7Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com>
8Date: 2012/03/14
9
10Updated for python 2.7.3
11Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com>
12Date: 2012/05/01
13
14Index: Python-3.3.0rc2/Lib/sysconfig.py
15===================================================================
16--- Python-3.3.0rc2.orig/Lib/sysconfig.py 2012-09-20 22:50:11.000000000 -0700
17+++ Python-3.3.0rc2/Lib/sysconfig.py 2012-09-20 22:53:01.561123396 -0700
18@@ -21,9 +21,9 @@
19
20 _INSTALL_SCHEMES = {
21 'posix_prefix': {
22- 'stdlib': '{installed_base}/'+sys.lib+'/python{py_version_short}',
23+ 'stdlib': '{base}/'+sys.lib+'/python{py_version_short}',
24 'platstdlib': '{platbase}/'+sys.lib+'/python{py_version_short}',
25- 'purelib': '{base}/lib/python{py_version_short}/site-packages',
26+ 'purelib': '{base}/'+sys.lib+'/python{py_version_short}/site-packages',
27 'platlib': '{platbase}/'+sys.lib+'/python{py_version_short}/site-packages',
28 'include':
29 '{installed_base}/include/python{py_version_short}{abiflags}',
30@@ -83,7 +83,7 @@
31 'posix_user': {
32 'stdlib': '{userbase}/'+sys.lib+'/python{py_version_short}',
33 'platstdlib': '{userbase}/'+sys.lib+'/python{py_version_short}',
34- 'purelib': '{userbase}/lib/python{py_version_short}/site-packages',
35+ 'purelib': '{userbase}/'+sys.lib+'/python{py_version_short}/site-packages',
36 'platlib': '{userbase}/'+sys.lib+'/python{py_version_short}/site-packages',
37 'include': '{userbase}/include/python{py_version_short}',
38 'scripts': '{userbase}/bin',
39Index: Python-3.3.0rc2/Makefile.pre.in
40===================================================================
41--- Python-3.3.0rc2.orig/Makefile.pre.in 2012-09-20 22:50:11.000000000 -0700
42+++ Python-3.3.0rc2/Makefile.pre.in 2012-09-20 22:50:54.245123997 -0700
43@@ -1080,9 +1080,9 @@
44 $(INSTALL_DATA) $(srcdir)/Modules/xxmodule.c \
45 $(DESTDIR)$(LIBDEST)/distutils/tests ; \
46 fi
47- -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
48+ -PYTHONPATH=$(DESTDIR)$(LIBDEST):${CROSSPYTHONPATH} $(RUNSHARED) \
49 $(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/Grammar.txt
50- -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
51+ -PYTHONPATH=$(DESTDIR)$(LIBDEST):${CROSSPYTHONPATH} $(RUNSHARED) \
52 $(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/PatternGrammar.txt
53
54 # Create the PLATDIR source directory, if one wasn't distributed..
diff --git a/meta/recipes-devtools/python/python3/ftplib.patch b/meta/recipes-devtools/python/python3/ftplib.patch
deleted file mode 100644
index 49c5b2736b..0000000000
--- a/meta/recipes-devtools/python/python3/ftplib.patch
+++ /dev/null
@@ -1,60 +0,0 @@
1Upstream-Status: Backport
2Signed-off-by: Ross Burton <ross.burton@intel.com>
3
4From cabe916dc694997d4892b58986e73a713d5a2f8d Mon Sep 17 00:00:00 2001
5From: "Miss Islington (bot)"
6 <31488909+miss-islington@users.noreply.github.com>
7Date: Thu, 16 Aug 2018 15:38:03 -0400
8Subject: [PATCH] [3.6] bpo-34391: Fix ftplib test for TLS 1.3 (GH-8787)
9 (#8790)
10
11Read from data socket to avoid "[SSL] shutdown while in init" exception
12during shutdown of the dummy server.
13
14Signed-off-by: Christian Heimes <christian@python.org>
15
16
17<!-- issue-number: [bpo-34391](https://www.bugs.python.org/issue34391) -->
18https://bugs.python.org/issue34391
19<!-- /issue-number -->
20(cherry picked from commit 1590c393360df059160145e7475754427bfc6680)
21
22
23Co-authored-by: Christian Heimes <christian@python.org>
24---
25 Lib/test/test_ftplib.py | 5 +++++
26 Misc/NEWS.d/next/Tests/2018-08-16-18-48-47.bpo-34391.ouNfxC.rst | 1 +
27 2 files changed, 6 insertions(+)
28 create mode 100644 Misc/NEWS.d/next/Tests/2018-08-16-18-48-47.bpo-34391.ouNfxC.rst
29
30diff --git a/Lib/test/test_ftplib.py b/Lib/test/test_ftplib.py
31index 44dd73aeca..4ff2f71afb 100644
32--- a/Lib/test/test_ftplib.py
33+++ b/Lib/test/test_ftplib.py
34@@ -876,18 +876,23 @@ class TestTLS_FTPClass(TestCase):
35 # clear text
36 with self.client.transfercmd('list') as sock:
37 self.assertNotIsInstance(sock, ssl.SSLSocket)
38+ self.assertEqual(sock.recv(1024), LIST_DATA.encode('ascii'))
39 self.assertEqual(self.client.voidresp(), "226 transfer complete")
40
41 # secured, after PROT P
42 self.client.prot_p()
43 with self.client.transfercmd('list') as sock:
44 self.assertIsInstance(sock, ssl.SSLSocket)
45+ # consume from SSL socket to finalize handshake and avoid
46+ # "SSLError [SSL] shutdown while in init"
47+ self.assertEqual(sock.recv(1024), LIST_DATA.encode('ascii'))
48 self.assertEqual(self.client.voidresp(), "226 transfer complete")
49
50 # PROT C is issued, the connection must be in cleartext again
51 self.client.prot_c()
52 with self.client.transfercmd('list') as sock:
53 self.assertNotIsInstance(sock, ssl.SSLSocket)
54+ self.assertEqual(sock.recv(1024), LIST_DATA.encode('ascii'))
55 self.assertEqual(self.client.voidresp(), "226 transfer complete")
56
57 def test_login(self):
58--
592.11.0
60
diff --git a/meta/recipes-devtools/python/python3/host_include_contamination.patch b/meta/recipes-devtools/python/python3/host_include_contamination.patch
deleted file mode 100644
index ef2054d9a9..0000000000
--- a/meta/recipes-devtools/python/python3/host_include_contamination.patch
+++ /dev/null
@@ -1,28 +0,0 @@
1when building python for qemux86-64 on ubuntu 11.10/64bit
2it gropes into host includes and then mixes them with cross
3includes and as a result some modules fail to compile and link
4one of the modules is python-elementtree which is then not
5found during image creation
6
7Proble is that setup.py tries to add native includes that newer
8ubuntu has introduced for multiarch support. But that should
9only happen for native builds and not cross building python
10so we add a check here.
11
12Signed-off-by: Khem Raj <raj.khem@gmail.com>
13Upstream-Status: Pending
14
15Index: Python-3.3.0rc2/setup.py
16===================================================================
17--- Python-3.3.0rc2.orig/setup.py 2012-09-20 21:54:50.000000000 -0700
18+++ Python-3.3.0rc2/setup.py 2012-09-20 21:57:35.029123858 -0700
19@@ -402,6 +402,9 @@
20
21 if not find_executable('dpkg-architecture'):
22 return
23+ if cross_compiling:
24+ return
25+
26 opt = ''
27 if cross_compiling:
28 opt = '-t' + sysconfig.get_config_var('HOST_GNU_TYPE')
diff --git a/meta/recipes-devtools/python/python3/python-3.3-multilib.patch b/meta/recipes-devtools/python/python3/python-3.3-multilib.patch
deleted file mode 100644
index cc35dc1617..0000000000
--- a/meta/recipes-devtools/python/python3/python-3.3-multilib.patch
+++ /dev/null
@@ -1,363 +0,0 @@
1From 51fe6f22d0ba113674fb358bd11d75fe659bd26e Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 14 May 2013 15:00:26 -0700
4Subject: [PATCH 01/13] get the sys.lib from python itself and do not use
5 hardcoded value of 'lib'
6
702/2015 Rebased for 3.4.2
8
9Upstream-Status: Pending
10Signed-off-by: Khem Raj <raj.khem@gmail.com>
11Signed-off-by: Alejandro Hernandez <alejandro.hernandez@linux.intel.com>
12
13---
14 Include/pythonrun.h | 3 +++
15 Lib/distutils/command/install.py | 4 +++-
16 Lib/pydoc.py | 2 +-
17 Lib/site.py | 4 ++--
18 Lib/sysconfig.py | 18 +++++++++---------
19 Lib/trace.py | 4 ++--
20 Makefile.pre.in | 7 +++++--
21 Modules/getpath.c | 10 +++++++++-
22 Python/getplatform.c | 20 ++++++++++++++++++++
23 Python/sysmodule.c | 4 ++++
24 configure.ac | 35 +++++++++++++++++++++++++++++++++++
25 setup.py | 9 ++++-----
26 12 files changed, 97 insertions(+), 23 deletions(-)
27
28Index: Python-3.5.4/Include/pythonrun.h
29===================================================================
30--- Python-3.5.4.orig/Include/pythonrun.h
31+++ Python-3.5.4/Include/pythonrun.h
32@@ -23,6 +23,9 @@ typedef struct {
33 } PyCompilerFlags;
34 #endif
35
36+PyAPI_FUNC(const char *) Py_GetArch(void);
37+PyAPI_FUNC(const char *) Py_GetLib(void);
38+
39 #ifndef Py_LIMITED_API
40 PyAPI_FUNC(int) PyRun_SimpleStringFlags(const char *, PyCompilerFlags *);
41 PyAPI_FUNC(int) PyRun_AnyFileFlags(FILE *, const char *, PyCompilerFlags *);
42Index: Python-3.5.4/Lib/distutils/command/install.py
43===================================================================
44--- Python-3.5.4.orig/Lib/distutils/command/install.py
45+++ Python-3.5.4/Lib/distutils/command/install.py
46@@ -19,6 +19,8 @@ from site import USER_BASE
47 from site import USER_SITE
48 HAS_USER_SITE = True
49
50+libname = sys.lib
51+
52 WINDOWS_SCHEME = {
53 'purelib': '$base/Lib/site-packages',
54 'platlib': '$base/Lib/site-packages',
55@@ -29,8 +31,8 @@ WINDOWS_SCHEME = {
56
57 INSTALL_SCHEMES = {
58 'unix_prefix': {
59- 'purelib': '$base/lib/python$py_version_short/site-packages',
60- 'platlib': '$platbase/lib/python$py_version_short/site-packages',
61+ 'purelib': '$platbase/'+libname+'/python$py_version_short/site-packages',
62+ 'platlib': '$platbase/'+libname+'/python$py_version_short/site-packages',
63 'headers': '$base/include/python$py_version_short$abiflags/$dist_name',
64 'scripts': '$base/bin',
65 'data' : '$base',
66Index: Python-3.5.4/Lib/pydoc.py
67===================================================================
68--- Python-3.5.4.orig/Lib/pydoc.py
69+++ Python-3.5.4/Lib/pydoc.py
70@@ -389,7 +389,7 @@ class Doc:
71 docmodule = docclass = docroutine = docother = docproperty = docdata = fail
72
73 def getdocloc(self, object,
74- basedir=os.path.join(sys.base_exec_prefix, "lib",
75+ basedir=os.path.join(sys.base_exec_prefix, sys.lib,
76 "python%d.%d" % sys.version_info[:2])):
77 """Return the location of module docs or None"""
78
79Index: Python-3.5.4/Lib/site.py
80===================================================================
81--- Python-3.5.4.orig/Lib/site.py
82+++ Python-3.5.4/Lib/site.py
83@@ -303,12 +303,12 @@ def getsitepackages(prefixes=None):
84 seen.add(prefix)
85
86 if os.sep == '/':
87- sitepackages.append(os.path.join(prefix, "lib",
88+ sitepackages.append(os.path.join(prefix, sys.lib,
89 "python" + sys.version[:3],
90 "site-packages"))
91 else:
92 sitepackages.append(prefix)
93- sitepackages.append(os.path.join(prefix, "lib", "site-packages"))
94+ sitepackages.append(os.path.join(prefix, sys.lib, "site-packages"))
95 if sys.platform == "darwin":
96 # for framework builds *only* we add the standard Apple
97 # locations.
98Index: Python-3.5.4/Lib/sysconfig.py
99===================================================================
100--- Python-3.5.4.orig/Lib/sysconfig.py
101+++ Python-3.5.4/Lib/sysconfig.py
102@@ -20,10 +20,10 @@ __all__ = [
103
104 _INSTALL_SCHEMES = {
105 'posix_prefix': {
106- 'stdlib': '{installed_base}/lib/python{py_version_short}',
107- 'platstdlib': '{platbase}/lib/python{py_version_short}',
108- 'purelib': '{base}/lib/python{py_version_short}/site-packages',
109- 'platlib': '{platbase}/lib/python{py_version_short}/site-packages',
110+ 'stdlib': '{installed_base}/'+sys.lib+'/python{py_version_short}',
111+ 'platstdlib': '{platbase}/'+sys.lib+'/python{py_version_short}',
112+ 'purelib': '{platbase}/'+sys.lib+'/python{py_version_short}/site-packages',
113+ 'platlib': '{platbase}/'+sys.lib+'/python{py_version_short}/site-packages',
114 'include':
115 '{installed_base}/include/python{py_version_short}{abiflags}',
116 'platinclude':
117@@ -32,10 +32,10 @@ _INSTALL_SCHEMES = {
118 'data': '{base}',
119 },
120 'posix_home': {
121- 'stdlib': '{installed_base}/lib/python',
122- 'platstdlib': '{base}/lib/python',
123- 'purelib': '{base}/lib/python',
124- 'platlib': '{base}/lib/python',
125+ 'stdlib': '{installed_base}/'+sys.lib+'/python',
126+ 'platstdlib': '{base}/'+sys.lib+'/python',
127+ 'purelib': '{base}/'+sys.lib+'/python',
128+ 'platlib': '{base}/'+sys.lib+'/python',
129 'include': '{installed_base}/include/python',
130 'platinclude': '{installed_base}/include/python',
131 'scripts': '{base}/bin',
132@@ -61,10 +61,10 @@ _INSTALL_SCHEMES = {
133 'data': '{userbase}',
134 },
135 'posix_user': {
136- 'stdlib': '{userbase}/lib/python{py_version_short}',
137- 'platstdlib': '{userbase}/lib/python{py_version_short}',
138- 'purelib': '{userbase}/lib/python{py_version_short}/site-packages',
139- 'platlib': '{userbase}/lib/python{py_version_short}/site-packages',
140+ 'stdlib': '{userbase}/'+sys.lib+'/python{py_version_short}',
141+ 'platstdlib': '{userbase}/'+sys.lib+'/python{py_version_short}',
142+ 'purelib': '{userbase}/'+sys.lib+'/python{py_version_short}/site-packages',
143+ 'platlib': '{userbase}/'+sys.lib+'/python{py_version_short}/site-packages',
144 'include': '{userbase}/include/python{py_version_short}',
145 'scripts': '{userbase}/bin',
146 'data': '{userbase}',
147Index: Python-3.5.4/Lib/trace.py
148===================================================================
149--- Python-3.5.4.orig/Lib/trace.py
150+++ Python-3.5.4/Lib/trace.py
151@@ -749,10 +749,10 @@ def main(argv=None):
152 # should I also call expanduser? (after all, could use $HOME)
153
154 s = s.replace("$prefix",
155- os.path.join(sys.base_prefix, "lib",
156+ os.path.join(sys.base_prefix, sys.lib,
157 "python" + sys.version[:3]))
158 s = s.replace("$exec_prefix",
159- os.path.join(sys.base_exec_prefix, "lib",
160+ os.path.join(sys.base_exec_prefix, sys.lib,
161 "python" + sys.version[:3]))
162 s = os.path.normpath(s)
163 ignore_dirs.append(s)
164Index: Python-3.5.4/Makefile.pre.in
165===================================================================
166--- Python-3.5.4.orig/Makefile.pre.in
167+++ Python-3.5.4/Makefile.pre.in
168@@ -109,6 +109,8 @@ CFLAGS_ALIASING=@CFLAGS_ALIASING@
169
170 # Machine-dependent subdirectories
171 MACHDEP= @MACHDEP@
172+LIB= @LIB@
173+ARCH= @ARCH@
174
175 # Multiarch directory (may be empty)
176 MULTIARCH= @MULTIARCH@
177@@ -128,7 +130,7 @@ LIBDIR= @libdir@
178 MANDIR= @mandir@
179 INCLUDEDIR= @includedir@
180 CONFINCLUDEDIR= $(exec_prefix)/include
181-SCRIPTDIR= $(prefix)/lib
182+SCRIPTDIR= @libdir@
183 ABIFLAGS= @ABIFLAGS@
184
185 # Detailed destination directories
186@@ -731,6 +733,7 @@ Modules/getpath.o: $(srcdir)/Modules/get
187 -DEXEC_PREFIX='"$(exec_prefix)"' \
188 -DVERSION='"$(VERSION)"' \
189 -DVPATH='"$(VPATH)"' \
190+ -DARCH='"$(ARCH)"' -DLIB='"$(LIB)"' \
191 -o $@ $(srcdir)/Modules/getpath.c
192
193 Programs/python.o: $(srcdir)/Programs/python.c
194@@ -813,7 +816,7 @@ regen-opcode:
195 Python/compile.o Python/symtable.o Python/ast.o: $(srcdir)/Include/graminit.h $(srcdir)/Include/Python-ast.h
196
197 Python/getplatform.o: $(srcdir)/Python/getplatform.c
198- $(CC) -c $(PY_CORE_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
199+ $(CC) -c $(PY_CORE_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -DARCH='"$(ARCH)"' -DLIB='"$(LIB)"' -o $@ $(srcdir)/Python/getplatform.c
200
201 Python/importdl.o: $(srcdir)/Python/importdl.c
202 $(CC) -c $(PY_CORE_CFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c
203Index: Python-3.5.4/Modules/getpath.c
204===================================================================
205--- Python-3.5.4.orig/Modules/getpath.c
206+++ Python-3.5.4/Modules/getpath.c
207@@ -105,6 +105,13 @@
208 #error "PREFIX, EXEC_PREFIX, VERSION, and VPATH must be constant defined"
209 #endif
210
211+#define LIB_PYTHON LIB "/python" VERSION
212+
213+#ifndef PYTHONPATH
214+#define PYTHONPATH PREFIX "/" LIB_PYTHON ":" \
215+ EXEC_PREFIX "/" LIB_PYTHON "/lib-dynload"
216+#endif
217+
218 #ifndef LANDMARK
219 #define LANDMARK L"os.py"
220 #endif
221@@ -113,6 +120,7 @@ static wchar_t prefix[MAXPATHLEN+1];
222 static wchar_t exec_prefix[MAXPATHLEN+1];
223 static wchar_t progpath[MAXPATHLEN+1];
224 static wchar_t *module_search_path = NULL;
225+static wchar_t *lib_python = L"" LIB_PYTHON;
226
227 /* Get file status. Encode the path to the locale encoding. */
228
229@@ -494,7 +502,7 @@ calculate_path(void)
230 _pythonpath = Py_DecodeLocale(PYTHONPATH, NULL);
231 _prefix = Py_DecodeLocale(PREFIX, NULL);
232 _exec_prefix = Py_DecodeLocale(EXEC_PREFIX, NULL);
233- lib_python = Py_DecodeLocale("lib/python" VERSION, NULL);
234+ lib_python = Py_DecodeLocale(LIB_PYTHON, NULL);
235
236 if (!_pythonpath || !_prefix || !_exec_prefix || !lib_python) {
237 Py_FatalError(
238Index: Python-3.5.4/Python/getplatform.c
239===================================================================
240--- Python-3.5.4.orig/Python/getplatform.c
241+++ Python-3.5.4/Python/getplatform.c
242@@ -10,3 +10,23 @@ Py_GetPlatform(void)
243 {
244 return PLATFORM;
245 }
246+
247+#ifndef ARCH
248+#define ARCH "unknown"
249+#endif
250+
251+const char *
252+Py_GetArch(void)
253+{
254+ return ARCH;
255+}
256+
257+#ifndef LIB
258+#define LIB "lib"
259+#endif
260+
261+const char *
262+Py_GetLib(void)
263+{
264+ return LIB;
265+}
266Index: Python-3.5.4/Python/sysmodule.c
267===================================================================
268--- Python-3.5.4.orig/Python/sysmodule.c
269+++ Python-3.5.4/Python/sysmodule.c
270@@ -1827,6 +1827,10 @@ _PySys_Init(void)
271 PyUnicode_FromString(Py_GetCopyright()));
272 SET_SYS_FROM_STRING("platform",
273 PyUnicode_FromString(Py_GetPlatform()));
274+ SET_SYS_FROM_STRING("arch",
275+ PyUnicode_FromString(Py_GetArch()));
276+ SET_SYS_FROM_STRING("lib",
277+ PyUnicode_FromString(Py_GetLib()));
278 SET_SYS_FROM_STRING("executable",
279 PyUnicode_FromWideChar(
280 Py_GetProgramFullPath(), -1));
281Index: Python-3.5.4/configure.ac
282===================================================================
283--- Python-3.5.4.orig/configure.ac
284+++ Python-3.5.4/configure.ac
285@@ -885,6 +885,41 @@ PLATDIR=plat-$MACHDEP
286 AC_SUBST(PLATDIR)
287 AC_SUBST(PLATFORM_TRIPLET)
288
289+AC_SUBST(ARCH)
290+AC_MSG_CHECKING(ARCH)
291+ARCH=`uname -m`
292+case $ARCH in
293+i?86) ARCH=i386;;
294+esac
295+AC_MSG_RESULT($ARCH)
296+
297+AC_SUBST(LIB)
298+AC_MSG_CHECKING(LIB)
299+case $ac_sys_system in
300+Linux*)
301+ # Test if the compiler is 64bit
302+ echo 'int i;' > conftest.$ac_ext
303+ python_cv_cc_64bit_output=no
304+ if AC_TRY_EVAL(ac_compile); then
305+ case `/usr/bin/file conftest.$ac_objext` in
306+ *"ELF 64"*)
307+ python_cv_cc_64bit_output=yes
308+ ;;
309+ esac
310+ fi
311+ rm -rf conftest*
312+ ;;
313+esac
314+
315+case $ARCH:$python_cv_cc_64bit_output in
316+ppc64:yes | powerpc64:yes | s390x:yes | sparc64:yes | x86_64:yes)
317+ LIB="lib64"
318+ ;;
319+*:*)
320+ LIB="lib"
321+ ;;
322+esac
323+AC_MSG_RESULT($LIB)
324
325 AC_MSG_CHECKING([for -Wl,--no-as-needed])
326 save_LDFLAGS="$LDFLAGS"
327Index: Python-3.5.4/setup.py
328===================================================================
329--- Python-3.5.4.orig/setup.py
330+++ Python-3.5.4/setup.py
331@@ -494,7 +494,7 @@ class PyBuildExt(build_ext):
332 # directories (i.e. '.' and 'Include') must be first. See issue
333 # 10520.
334 if not cross_compiling:
335- add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
336+ add_dir_to_list(self.compiler.library_dirs, os.path.join('/usr/local', sys.lib))
337 add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
338 # only change this for cross builds for 3.3, issues on Mageia
339 if cross_compiling:
340@@ -552,8 +552,7 @@ class PyBuildExt(build_ext):
341 # be assumed that no additional -I,-L directives are needed.
342 if not cross_compiling:
343 lib_dirs = self.compiler.library_dirs + [
344- '/lib64', '/usr/lib64',
345- '/lib', '/usr/lib',
346+ '/' + sys.lib, '/usr/' + sys.lib,
347 ]
348 inc_dirs = self.compiler.include_dirs + ['/usr/include']
349 else:
350@@ -745,11 +744,11 @@ class PyBuildExt(build_ext):
351 elif curses_library:
352 readline_libs.append(curses_library)
353 elif self.compiler.find_library_file(lib_dirs +
354- ['/usr/lib/termcap'],
355+ ['/usr/'+sys.lib+'/termcap'],
356 'termcap'):
357 readline_libs.append('termcap')
358 exts.append( Extension('readline', ['readline.c'],
359- library_dirs=['/usr/lib/termcap'],
360+ library_dirs=['/usr/'+sys.lib+'/termcap'],
361 extra_link_args=readline_extra_link_args,
362 libraries=readline_libs) )
363 else:
diff --git a/meta/recipes-devtools/python/python3/python3-manifest.json b/meta/recipes-devtools/python/python3/python3-manifest.json
index 3641d5bd7b..24f9805fbd 100644
--- a/meta/recipes-devtools/python/python3/python3-manifest.json
+++ b/meta/recipes-devtools/python/python3/python3-manifest.json
@@ -109,7 +109,7 @@
109 "core" 109 "core"
110 ], 110 ],
111 "files": [ 111 "files": [
112 "${bindir}/2to3-*", 112 "${bindir}/2to3*",
113 "${libdir}/python${PYTHON_MAJMIN}/lib2to3" 113 "${libdir}/python${PYTHON_MAJMIN}/lib2to3"
114 ], 114 ],
115 "cached": [] 115 "cached": []
@@ -117,24 +117,18 @@
117 "asyncio": { 117 "asyncio": {
118 "summary": "Python Asynchronous I/", 118 "summary": "Python Asynchronous I/",
119 "rdepends": [ 119 "rdepends": [
120 "compression",
121 "core", 120 "core",
122 "crypt",
123 "io", 121 "io",
124 "logging", 122 "logging",
125 "math",
126 "multiprocessing",
127 "netclient", 123 "netclient",
128 "pickle", 124 "numbers",
129 "shell", 125 "stringold"
130 "stringold",
131 "threading",
132 "unixadmin"
133 ], 126 ],
134 "files": [ 127 "files": [
135 "${libdir}/python${PYTHON_MAJMIN}/asyncio", 128 "${libdir}/python${PYTHON_MAJMIN}/asyncio",
136 "${libdir}/python${PYTHON_MAJMIN}/concurrent", 129 "${libdir}/python${PYTHON_MAJMIN}/concurrent",
137 "${libdir}/python${PYTHON_MAJMIN}/concurrent/futures" 130 "${libdir}/python${PYTHON_MAJMIN}/concurrent/futures",
131 "${libdir}/python${PYTHON_MAJMIN}/lib-dynload/_asyncio.*.so"
138 ], 132 ],
139 "cached": [] 133 "cached": []
140 }, 134 },
@@ -174,19 +168,7 @@
174 "compile": { 168 "compile": {
175 "summary": "Python bytecode compilation support", 169 "summary": "Python bytecode compilation support",
176 "rdepends": [ 170 "rdepends": [
177 "asyncio", 171 "core"
178 "compression",
179 "core",
180 "crypt",
181 "io",
182 "logging",
183 "math",
184 "multiprocessing",
185 "pickle",
186 "shell",
187 "stringold",
188 "threading",
189 "unixadmin"
190 ], 172 ],
191 "files": [ 173 "files": [
192 "${libdir}/python${PYTHON_MAJMIN}/compileall.py", 174 "${libdir}/python${PYTHON_MAJMIN}/compileall.py",
@@ -239,7 +221,7 @@
239 "${libdir}/python${PYTHON_MAJMIN}/_collections_abc.py", 221 "${libdir}/python${PYTHON_MAJMIN}/_collections_abc.py",
240 "${libdir}/python${PYTHON_MAJMIN}/_markupbase.py", 222 "${libdir}/python${PYTHON_MAJMIN}/_markupbase.py",
241 "${libdir}/python${PYTHON_MAJMIN}/_sitebuiltins.py", 223 "${libdir}/python${PYTHON_MAJMIN}/_sitebuiltins.py",
242 "${libdir}/python${PYTHON_MAJMIN}/_sysconfigdata.py", 224 "${libdir}/python${PYTHON_MAJMIN}/_sysconfigdata*.py",
243 "${libdir}/python${PYTHON_MAJMIN}/_weakrefset.py", 225 "${libdir}/python${PYTHON_MAJMIN}/_weakrefset.py",
244 "${libdir}/python${PYTHON_MAJMIN}/abc.py", 226 "${libdir}/python${PYTHON_MAJMIN}/abc.py",
245 "${libdir}/python${PYTHON_MAJMIN}/argparse.py", 227 "${libdir}/python${PYTHON_MAJMIN}/argparse.py",
@@ -413,9 +395,13 @@
413 "files": [ 395 "files": [
414 "${libdir}/python${PYTHON_MAJMIN}/crypt.py", 396 "${libdir}/python${PYTHON_MAJMIN}/crypt.py",
415 "${libdir}/python${PYTHON_MAJMIN}/hashlib.py", 397 "${libdir}/python${PYTHON_MAJMIN}/hashlib.py",
398 "${libdir}/python${PYTHON_MAJMIN}/lib-dynload/_blake2.*.so",
416 "${libdir}/python${PYTHON_MAJMIN}/lib-dynload/_crypt.*.so", 399 "${libdir}/python${PYTHON_MAJMIN}/lib-dynload/_crypt.*.so",
417 "${libdir}/python${PYTHON_MAJMIN}/lib-dynload/_hashlib.*.so", 400 "${libdir}/python${PYTHON_MAJMIN}/lib-dynload/_hashlib.*.so",
418 "${libdir}/python${PYTHON_MAJMIN}/lib-dynload/_sha256.*.so", 401 "${libdir}/python${PYTHON_MAJMIN}/lib-dynload/_sha256.*.so",
402 "${libdir}/python${PYTHON_MAJMIN}/lib-dynload/_sha3.*.so",
403 "${libdir}/python${PYTHON_MAJMIN}/lib-dynload/_sha1.*.so",
404 "${libdir}/python${PYTHON_MAJMIN}/lib-dynload/_md5.*.so",
419 "${libdir}/python${PYTHON_MAJMIN}/lib-dynload/_sha512.*.so" 405 "${libdir}/python${PYTHON_MAJMIN}/lib-dynload/_sha512.*.so"
420 ], 406 ],
421 "cached": [ 407 "cached": [
@@ -506,8 +492,7 @@
506 "${libdir}/*.o", 492 "${libdir}/*.o",
507 "${libdir}/lib*${SOLIBSDEV}", 493 "${libdir}/lib*${SOLIBSDEV}",
508 "${libdir}/pkgconfig", 494 "${libdir}/pkgconfig",
509 "${libdir}/python${PYTHON_MAJMIN}/config*/Makefile", 495 "${prefix}/lib/python${PYTHON_MAJMIN}/config*/"
510 "${libdir}/python${PYTHON_MAJMIN}/config*/Makefile/__pycache__"
511 ], 496 ],
512 "rdepends": [ 497 "rdepends": [
513 "core" 498 "core"
@@ -820,7 +805,9 @@
820 "multiprocessing": { 805 "multiprocessing": {
821 "summary": "Python multiprocessing support", 806 "summary": "Python multiprocessing support",
822 "rdepends": [ 807 "rdepends": [
823 "core" 808 "core",
809 "io",
810 "pickle"
824 ], 811 ],
825 "files": [ 812 "files": [
826 "${libdir}/python${PYTHON_MAJMIN}/lib-dynload/_multiprocessing.*.so", 813 "${libdir}/python${PYTHON_MAJMIN}/lib-dynload/_multiprocessing.*.so",
@@ -831,18 +818,14 @@
831 "netclient": { 818 "netclient": {
832 "summary": "Python Internet Protocol clients", 819 "summary": "Python Internet Protocol clients",
833 "rdepends": [ 820 "rdepends": [
834 "compression",
835 "core", 821 "core",
836 "crypt", 822 "crypt",
837 "ctypes",
838 "datetime", 823 "datetime",
839 "email", 824 "email",
840 "io", 825 "io",
841 "math", 826 "math",
842 "mime", 827 "mime",
843 "shell", 828 "stringold"
844 "stringold",
845 "unixadmin"
846 ], 829 ],
847 "files": [ 830 "files": [
848 "${libdir}/python${PYTHON_MAJMIN}/base64.py", 831 "${libdir}/python${PYTHON_MAJMIN}/base64.py",
@@ -850,6 +833,7 @@
850 "${libdir}/python${PYTHON_MAJMIN}/hmac.py", 833 "${libdir}/python${PYTHON_MAJMIN}/hmac.py",
851 "${libdir}/python${PYTHON_MAJMIN}/http", 834 "${libdir}/python${PYTHON_MAJMIN}/http",
852 "${libdir}/python${PYTHON_MAJMIN}/http/__pycache__", 835 "${libdir}/python${PYTHON_MAJMIN}/http/__pycache__",
836 "${libdir}/python${PYTHON_MAJMIN}/lib-dynload/_uuid.*.so",
853 "${libdir}/python${PYTHON_MAJMIN}/mimetypes.py", 837 "${libdir}/python${PYTHON_MAJMIN}/mimetypes.py",
854 "${libdir}/python${PYTHON_MAJMIN}/nntplib.py", 838 "${libdir}/python${PYTHON_MAJMIN}/nntplib.py",
855 "${libdir}/python${PYTHON_MAJMIN}/poplib.py", 839 "${libdir}/python${PYTHON_MAJMIN}/poplib.py",
@@ -904,13 +888,16 @@
904 ], 888 ],
905 "files": [ 889 "files": [
906 "${libdir}/python${PYTHON_MAJMIN}/_pydecimal.py", 890 "${libdir}/python${PYTHON_MAJMIN}/_pydecimal.py",
891 "${libdir}/python${PYTHON_MAJMIN}/contextvars.py",
907 "${libdir}/python${PYTHON_MAJMIN}/decimal.py", 892 "${libdir}/python${PYTHON_MAJMIN}/decimal.py",
908 "${libdir}/python${PYTHON_MAJMIN}/fractions.py", 893 "${libdir}/python${PYTHON_MAJMIN}/fractions.py",
894 "${libdir}/python${PYTHON_MAJMIN}/lib-dynload/_contextvars.*.so",
909 "${libdir}/python${PYTHON_MAJMIN}/lib-dynload/_decimal.*.so", 895 "${libdir}/python${PYTHON_MAJMIN}/lib-dynload/_decimal.*.so",
910 "${libdir}/python${PYTHON_MAJMIN}/numbers.py" 896 "${libdir}/python${PYTHON_MAJMIN}/numbers.py"
911 ], 897 ],
912 "cached": [ 898 "cached": [
913 "${libdir}/python${PYTHON_MAJMIN}/__pycache__/_pydecimal.*.pyc", 899 "${libdir}/python${PYTHON_MAJMIN}/__pycache__/_pydecimal.*.pyc",
900 "${libdir}/python${PYTHON_MAJMIN}/__pycache__/contextvars.*.pyc",
914 "${libdir}/python${PYTHON_MAJMIN}/__pycache__/decimal.*.pyc", 901 "${libdir}/python${PYTHON_MAJMIN}/__pycache__/decimal.*.pyc",
915 "${libdir}/python${PYTHON_MAJMIN}/__pycache__/fractions.*.pyc", 902 "${libdir}/python${PYTHON_MAJMIN}/__pycache__/fractions.*.pyc",
916 "${libdir}/python${PYTHON_MAJMIN}/__pycache__/numbers.*.pyc" 903 "${libdir}/python${PYTHON_MAJMIN}/__pycache__/numbers.*.pyc"
@@ -1134,13 +1121,12 @@
1134 "files": [ 1121 "files": [
1135 "${libdir}/python${PYTHON_MAJMIN}/_dummy_thread.py", 1122 "${libdir}/python${PYTHON_MAJMIN}/_dummy_thread.py",
1136 "${libdir}/python${PYTHON_MAJMIN}/_threading_local.py", 1123 "${libdir}/python${PYTHON_MAJMIN}/_threading_local.py",
1137 "${libdir}/python${PYTHON_MAJMIN}/dummy_threading.py", 1124 "${libdir}/python${PYTHON_MAJMIN}/lib-dynload/_queue.*.so",
1138 "${libdir}/python${PYTHON_MAJMIN}/queue.py" 1125 "${libdir}/python${PYTHON_MAJMIN}/queue.py"
1139 ], 1126 ],
1140 "cached": [ 1127 "cached": [
1141 "${libdir}/python${PYTHON_MAJMIN}/__pycache__/_dummy_thread.*.pyc", 1128 "${libdir}/python${PYTHON_MAJMIN}/__pycache__/_dummy_thread.*.pyc",
1142 "${libdir}/python${PYTHON_MAJMIN}/__pycache__/_threading_local.*.pyc", 1129 "${libdir}/python${PYTHON_MAJMIN}/__pycache__/_threading_local.*.pyc",
1143 "${libdir}/python${PYTHON_MAJMIN}/__pycache__/dummy_threading.*.pyc",
1144 "${libdir}/python${PYTHON_MAJMIN}/__pycache__/queue.*.pyc" 1130 "${libdir}/python${PYTHON_MAJMIN}/__pycache__/queue.*.pyc"
1145 ] 1131 ]
1146 }, 1132 },
diff --git a/meta/recipes-devtools/python/python3/python3-use-CROSSPYTHONPATH-for-PYTHON_FOR_BUILD.patch b/meta/recipes-devtools/python/python3/python3-use-CROSSPYTHONPATH-for-PYTHON_FOR_BUILD.patch
deleted file mode 100644
index a4f8bd4710..0000000000
--- a/meta/recipes-devtools/python/python3/python3-use-CROSSPYTHONPATH-for-PYTHON_FOR_BUILD.patch
+++ /dev/null
@@ -1,25 +0,0 @@
1From 53ed216d7bf70dd2a925432b6805a701e5fc3e0e Mon Sep 17 00:00:00 2001
2From: Jackie Huang <jackie.huang@windriver.com>
3Date: Mon, 17 Nov 2014 06:44:47 +0000
4Subject: [PATCH] python3 use CROSSPYTHONPATH for PYTHON_FOR_BUILD
5
6Upstream-Status: Inappropriate [Cross compile specific]
7
8Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
9---
10 configure.ac | 2 +-
11 1 file changed, 1 insertion(+), 1 deletion(-)
12
13Index: Python-3.5.4/configure.ac
14===================================================================
15--- Python-3.5.4.orig/configure.ac
16+++ Python-3.5.4/configure.ac
17@@ -73,7 +73,7 @@ if test "$cross_compiling" = yes; then
18 AC_MSG_ERROR([python$PACKAGE_VERSION interpreter not found])
19 fi
20 AC_MSG_RESULT($interp)
21- PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(shell test -f pybuilddir.txt && echo $(abs_builddir)/`cat pybuilddir.txt`:)$(srcdir)/Lib:$(srcdir)/Lib/$(PLATDIR) '$interp
22+ PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(CROSSPYTHONPATH) '$interp
23 fi
24 elif test "$cross_compiling" = maybe; then
25 AC_MSG_ERROR([Cross compiling required --host=HOST-TUPLE and --build=ARCH])
diff --git a/meta/recipes-devtools/python/python3/regen-all.patch b/meta/recipes-devtools/python/python3/regen-all.patch
deleted file mode 100644
index 36b9d9d919..0000000000
--- a/meta/recipes-devtools/python/python3/regen-all.patch
+++ /dev/null
@@ -1,25 +0,0 @@
1python3-native: run regen-importlib target correctly
2
3regen-importlib depends on other regen- targets, so we must be sure to
4run it after (most of) the others. In reality, we do not need to run it
5at all since "make" will invoke it, if necessary. We do not want to
6rely on that, though.
7
8Upstream-Status: Pending
9
10Signed-off-by: Joe Slater <joe.slater@windriver.com>
11
12
13
14--- a/Makefile.pre.in
15+++ b/Makefile.pre.in
16@@ -709,7 +709,8 @@ regen-importlib: Programs/_freeze_import
17 ############################################################################
18 # Regenerate all generated files
19
20-regen-all: regen-opcode regen-opcode-targets regen-typeslots regen-grammar regen-ast regen-importlib
21+regen-all: regen-opcode regen-opcode-targets regen-typeslots regen-grammar regen-ast
22+ $(MAKE) regen-importlib
23
24 ############################################################################
25 # Special rules for object files
diff --git a/meta/recipes-devtools/python/python3/setup.py-check-cross_compiling-when-get-FLAGS.patch b/meta/recipes-devtools/python/python3/setup.py-check-cross_compiling-when-get-FLAGS.patch
deleted file mode 100644
index fc2e12dfe5..0000000000
--- a/meta/recipes-devtools/python/python3/setup.py-check-cross_compiling-when-get-FLAGS.patch
+++ /dev/null
@@ -1,50 +0,0 @@
1From 8dad810f3a3d073f09ad72e1a3ee0a895eab2ca1 Mon Sep 17 00:00:00 2001
2From: Robert Yang <liezhi.yang@windriver.com>
3Date: Sun, 18 Jan 2015 19:05:36 -0800
4Subject: [PATCH] setup.py:check cross_compiling when get FLAGS
5
6Fixed when compile target pythnon3:
7gcc -isystem/path/to/sysroots/x86_64-linux/usr/include \
8 -L=/path/to/sysroots/x86_64-linux/usr/lib
9
10This is incorrect, the native sysroot should not be used by target
11python3.
12
13Upstream-Status: Pending
14
15Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
16---
17 setup.py | 10 ++++++++--
18 1 file changed, 8 insertions(+), 2 deletions(-)
19
20diff --git a/setup.py b/setup.py
21index e8339cd..83fd31f 100644
22--- a/setup.py
23+++ b/setup.py
24@@ -238,7 +238,10 @@ class PyBuildExt(build_ext):
25 # unfortunately, distutils doesn't let us provide separate C and C++
26 # compilers
27 if compiler is not None:
28- (ccshared,cflags) = sysconfig.get_config_vars('CCSHARED','CFLAGS')
29+ if cross_compiling:
30+ (ccshared,cflags) = (os.environ.get('CCSHARED') or '', os.environ.get('CFLAGS') or '')
31+ else:
32+ (ccshared,cflags) = sysconfig.get_config_vars('CCSHARED','CFLAGS')
33 args['compiler_so'] = compiler + ' ' + ccshared + ' ' + cflags
34 self.compiler.set_executables(**args)
35
36@@ -457,7 +460,10 @@ class PyBuildExt(build_ext):
37 ('LDFLAGS', '-R', self.compiler.runtime_library_dirs),
38 ('LDFLAGS', '-L', self.compiler.library_dirs),
39 ('CPPFLAGS', '-I', self.compiler.include_dirs)):
40- env_val = sysconfig.get_config_var(env_var)
41+ if cross_compiling:
42+ env_val = os.environ.get(env_var)
43+ else:
44+ env_val = sysconfig.get_config_var(env_var)
45 if env_val:
46 # To prevent optparse from raising an exception about any
47 # options in env_val that it doesn't know about we strip out
48--
491.7.9.5
50
diff --git a/meta/recipes-devtools/python/python3/setuptweaks.patch b/meta/recipes-devtools/python/python3/setuptweaks.patch
deleted file mode 100644
index 3a91b1916c..0000000000
--- a/meta/recipes-devtools/python/python3/setuptweaks.patch
+++ /dev/null
@@ -1,57 +0,0 @@
1This patch removes various ways native system options can pass into the python
2compilation and somehow break C modules.
3
4Upstream-Status: Inappropriate [OE Specific]
5
6RP 2012/04/23
7
8Index: Python-2.7.2/setup.py
9===================================================================
10--- Python-2.7.2.orig/setup.py 2012-04-23 20:03:47.295582553 +0000
11+++ Python-2.7.2/setup.py 2012-04-23 20:03:15.000000000 +0000
12@@ -231,7 +231,13 @@
13 # compilers
14 if compiler is not None:
15 (ccshared,cflags) = sysconfig.get_config_vars('CCSHARED','CFLAGS')
16- args['compiler_so'] = compiler + ' ' + ccshared + ' ' + cflags
17+ # Need to filter out -isysroot from the flags. Ideally should
18+ # figure out target flags here.
19+ flags = []
20+ for f in cflags.split():
21+ if not f.startswith("-isystem"):
22+ flags.append(f)
23+ args['compiler_so'] = compiler + ' ' + ccshared + ' ' + ' '.join(flags)
24 self.compiler.set_executables(**args)
25
26 build_ext.build_extensions(self)
27@@ -393,7 +399,6 @@
28 # into configure and stored in the Makefile (issue found on OS X 10.3).
29 for env_var, arg_name, dir_list in (
30 ('LDFLAGS', '-R', self.compiler.runtime_library_dirs),
31- ('LDFLAGS', '-L', self.compiler.library_dirs),
32 ('CPPFLAGS', '-I', self.compiler.include_dirs)):
33 env_val = sysconfig.get_config_var(env_var)
34 if env_val:
35@@ -419,16 +424,16 @@
36 for directory in reversed(options.dirs):
37 add_dir_to_list(dir_list, directory)
38
39- if os.path.normpath(sys.prefix) != '/usr' \
40- and not sysconfig.get_config_var('PYTHONFRAMEWORK'):
41+# if os.path.normpath(sys.prefix) != '/usr' \
42+# and not sysconfig.get_config_var('PYTHONFRAMEWORK'):
43 # OSX note: Don't add LIBDIR and INCLUDEDIR to building a framework
44 # (PYTHONFRAMEWORK is set) to avoid # linking problems when
45 # building a framework with different architectures than
46 # the one that is currently installed (issue #7473)
47- add_dir_to_list(self.compiler.library_dirs,
48- sysconfig.get_config_var("LIBDIR"))
49- add_dir_to_list(self.compiler.include_dirs,
50- sysconfig.get_config_var("INCLUDEDIR"))
51+# add_dir_to_list(self.compiler.library_dirs,
52+# sysconfig.get_config_var("LIBDIR"))
53+# add_dir_to_list(self.compiler.include_dirs,
54+# sysconfig.get_config_var("INCLUDEDIR"))
55
56 try:
57 have_unicode = unicode
diff --git a/meta/recipes-devtools/python/python3/signal.patch b/meta/recipes-devtools/python/python3/signal.patch
deleted file mode 100644
index 534a097771..0000000000
--- a/meta/recipes-devtools/python/python3/signal.patch
+++ /dev/null
@@ -1,56 +0,0 @@
1Upstream-Status: Backport
2Signed-off-by: Ross Burton <ross.burton@intel.com>
3
4From 4315389df3c4e8c1f94a18ab11a4b234762132b1 Mon Sep 17 00:00:00 2001
5From: Antoine Pitrou <pitrou@free.fr>
6Date: Mon, 23 Apr 2018 22:22:49 +0200
7Subject: [PATCH] [3.6] bpo-33329: Fix multiprocessing regression on newer
8 glibcs (GH-6575) (GH-6582)
9
10Starting with glibc 2.27.9000-xxx, sigaddset() can return EINVAL for some
11reserved signal numbers between 1 and NSIG. The `range(1, NSIG)` idiom
12is commonly used to select all signals for blocking with `pthread_sigmask`.
13So we ignore the sigaddset() return value until we expose sigfillset()
14to provide a better idiom.
15(cherry picked from commit 25038ecfb665bef641abf8cb61afff7505b0e008)
16---
17 .../next/Library/2018-04-23-13-21-39.bpo-33329.lQ-Eod.rst | 1 +
18 Modules/signalmodule.c | 14 ++++++++------
19 2 files changed, 9 insertions(+), 6 deletions(-)
20 create mode 100644 Misc/NEWS.d/next/Library/2018-04-23-13-21-39.bpo-33329.lQ-Eod.rst
21
22diff --git a/Modules/signalmodule.c b/Modules/signalmodule.c
23index e0d06b434d..138e74e8a9 100644
24--- a/Modules/signalmodule.c
25+++ b/Modules/signalmodule.c
26@@ -744,7 +744,6 @@ iterable_to_sigset(PyObject *iterable, sigset_t *mask)
27 int result = -1;
28 PyObject *iterator, *item;
29 long signum;
30- int err;
31
32 sigemptyset(mask);
33
34@@ -766,11 +765,14 @@ iterable_to_sigset(PyObject *iterable, sigset_t *mask)
35 Py_DECREF(item);
36 if (signum == -1 && PyErr_Occurred())
37 goto error;
38- if (0 < signum && signum < NSIG)
39- err = sigaddset(mask, (int)signum);
40- else
41- err = 1;
42- if (err) {
43+ if (0 < signum && signum < NSIG) {
44+ /* bpo-33329: ignore sigaddset() return value as it can fail
45+ * for some reserved signals, but we want the `range(1, NSIG)`
46+ * idiom to allow selecting all valid signals.
47+ */
48+ (void) sigaddset(mask, (int)signum);
49+ }
50+ else {
51 PyErr_Format(PyExc_ValueError,
52 "signal number %ld out of range", signum);
53 goto error;
54--
552.11.0
56
diff --git a/meta/recipes-devtools/python/python3/sitecustomize.py b/meta/recipes-devtools/python/python3/sitecustomize.py
deleted file mode 100644
index 4c8b5e2ba3..0000000000
--- a/meta/recipes-devtools/python/python3/sitecustomize.py
+++ /dev/null
@@ -1,37 +0,0 @@
1# OpenEmbedded sitecustomize.py (C) 2002-2008 Michael 'Mickey' Lauer <mlauer@vanille-media.de>
2# GPLv2 or later
3# Version: 20081123
4# Features:
5# * set proper default encoding
6# * enable readline completion in the interactive interpreter
7# * load command line history on startup
8# * save command line history on exit
9
10import os
11
12def __exithandler():
13 try:
14 readline.write_history_file( "%s/.python-history" % os.getenv( "HOME", "/tmp" ) )
15 except IOError:
16 pass
17
18def __registerExitHandler():
19 import atexit
20 atexit.register( __exithandler )
21
22def __enableReadlineSupport():
23 readline.set_history_length( 1000 )
24 readline.parse_and_bind( "tab: complete" )
25 try:
26 readline.read_history_file( "%s/.python-history" % os.getenv( "HOME", "/tmp" ) )
27 except IOError:
28 pass
29
30import sys
31try:
32 import rlcompleter, readline
33except ImportError:
34 pass
35else:
36 __registerExitHandler()
37 __enableReadlineSupport()
diff --git a/meta/recipes-devtools/python/python3/support_SOURCE_DATE_EPOCH_in_py_compile.patch b/meta/recipes-devtools/python/python3/support_SOURCE_DATE_EPOCH_in_py_compile.patch
deleted file mode 100644
index 32ecab9fec..0000000000
--- a/meta/recipes-devtools/python/python3/support_SOURCE_DATE_EPOCH_in_py_compile.patch
+++ /dev/null
@@ -1,97 +0,0 @@
1The compiled .pyc files contain time stamp corresponding to the compile time.
2This prevents binary reproducibility. This patch allows to achieve binary
3reproducibility by overriding the build time stamp by the value
4exported via SOURCE_DATE_EPOCH.
5
6Upstream-Status: Backport
7
8Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
9
10
11From aeab488630fdb1b56a8d0b0c13fa88706b2afe9b Mon Sep 17 00:00:00 2001
12From: "Bernhard M. Wiedemann" <bwiedemann@suse.de>
13Date: Sat, 25 Feb 2017 06:42:28 +0100
14Subject: [PATCH] bpo-29708: support SOURCE_DATE_EPOCH env var in py_compile
15
16to allow for reproducible builds of python packages
17
18See https://reproducible-builds.org/ for why this is good
19and https://reproducible-builds.org/specs/source-date-epoch/
20for the definition of this variable.
21
22Background:
23In some distributions like openSUSE, binary rpms contain precompiled .pyc files.
24
25And packages like amqp or twisted dynamically generate .py files at build time
26so those have the current time and that timestamp gets embedded
27into the .pyc file header.
28When we then adapt file timestamps in rpms to be constant,
29the timestamp in the .pyc header will no more match
30the .py timestamp in the filesystem.
31The software will still work, but it will not use the .pyc file as it should.
32---
33 Doc/library/py_compile.rst | 4 ++++
34 Lib/py_compile.py | 4 ++++
35 Lib/test/test_py_compile.py | 19 +++++++++++++++++++
36 3 files changed, 27 insertions(+)
37
38diff --git a/Doc/library/py_compile.rst b/Doc/library/py_compile.rst
39index 0af8fb1..841f3e8 100644
40--- a/Doc/library/py_compile.rst
41+++ b/Doc/library/py_compile.rst
42@@ -53,6 +53,10 @@ byte-code cache files in the directory containing the source code.
43 :func:`compile` function. The default of ``-1`` selects the optimization
44 level of the current interpreter.
45
46+ If the SOURCE_DATE_EPOCH environment variable is set, the .py file mtime
47+ and timestamp entry in .pyc file header, will be limited to this value.
48+ See https://reproducible-builds.org/specs/source-date-epoch/ for more info.
49+
50 .. versionchanged:: 3.2
51 Changed default value of *cfile* to be :PEP:`3147`-compliant. Previous
52 default was *file* + ``'c'`` (``'o'`` if optimization was enabled).
53diff --git a/Lib/py_compile.py b/Lib/py_compile.py
54index 11c5b50..62dcdc7 100644
55--- a/Lib/py_compile.py
56+++ b/Lib/py_compile.py
57@@ -137,6 +137,10 @@ def compile(file, cfile=None, dfile=None, doraise=False, optimize=-1):
58 except FileExistsError:
59 pass
60 source_stats = loader.path_stats(file)
61+ sde = os.environ.get('SOURCE_DATE_EPOCH')
62+ if sde and source_stats['mtime'] > int(sde):
63+ source_stats['mtime'] = int(sde)
64+ os.utime(file, (source_stats['mtime'], source_stats['mtime']))
65 bytecode = importlib._bootstrap_external._code_to_bytecode(
66 code, source_stats['mtime'], source_stats['size'])
67 mode = importlib._bootstrap_external._calc_mode(file)
68diff --git a/Lib/test/test_py_compile.py b/Lib/test/test_py_compile.py
69index 4a6caa5..3d09963 100644
70--- a/Lib/test/test_py_compile.py
71+++ b/Lib/test/test_py_compile.py
72@@ -98,6 +98,25 @@ def test_bad_coding(self):
73 self.assertFalse(os.path.exists(
74 importlib.util.cache_from_source(bad_coding)))
75
76+ def test_source_date_epoch(self):
77+ testtime = 123456789
78+ orig_sde = os.getenv("SOURCE_DATE_EPOCH")
79+ os.environ["SOURCE_DATE_EPOCH"] = str(testtime)
80+ py_compile.compile(self.source_path, self.pyc_path)
81+ if orig_sde:
82+ os.environ["SOURCE_DATE_EPOCH"] = orig_sde
83+ else:
84+ del os.environ["SOURCE_DATE_EPOCH"]
85+ self.assertTrue(os.path.exists(self.pyc_path))
86+ self.assertFalse(os.path.exists(self.cache_path))
87+ statinfo = os.stat(self.source_path)
88+ self.assertEqual(statinfo.st_mtime, testtime)
89+ f = open(self.pyc_path, "rb")
90+ f.read(4)
91+ timebytes = f.read(4) # read timestamp from pyc header
92+ f.close()
93+ self.assertEqual(timebytes, (testtime).to_bytes(4, 'little'))
94+
95 @unittest.skipIf(sys.flags.optimize > 0, 'test does not work with -O')
96 def test_double_dot_no_clobber(self):
97 # http://bugs.python.org/issue22966
diff --git a/meta/recipes-devtools/python/python3/sysconfig.py-add-_PYTHON_PROJECT_SRC.patch b/meta/recipes-devtools/python/python3/sysconfig.py-add-_PYTHON_PROJECT_SRC.patch
deleted file mode 100644
index c89d9a3d83..0000000000
--- a/meta/recipes-devtools/python/python3/sysconfig.py-add-_PYTHON_PROJECT_SRC.patch
+++ /dev/null
@@ -1,51 +0,0 @@
1From fc93b3cc23b4f9698ae92a42986dbb02b6f19588 Mon Sep 17 00:00:00 2001
2From: Robert Yang <liezhi.yang@windriver.com>
3Date: Sun, 18 Jan 2015 06:29:50 -0800
4Subject: [PATCH] sysconfig.py: add _PYTHON_PROJECT_SRC
5
6python3 has introduced _PYTHON_PROJECT_BASE which is used for separate B
7and S, but it doesn't work when compile Modules, the target python3 runs
8python3-native's sysconfig to get srcdir which is the native's, there
9would be errors when native's srcdir has been removed, add
10_PYTHON_PROJECT_SRC to fix the problem.
11
12Upstream-Status: Pending
13
14Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
15---
16 Lib/distutils/sysconfig.py | 5 ++++-
17 Lib/sysconfig.py | 5 ++++-
18 2 files changed, 8 insertions(+), 2 deletions(-)
19
20Index: Python-3.5.3/Lib/distutils/sysconfig.py
21===================================================================
22--- Python-3.5.3.orig/Lib/distutils/sysconfig.py
23+++ Python-3.5.3/Lib/distutils/sysconfig.py
24@@ -498,7 +498,10 @@ def get_config_vars(*args):
25 _config_vars['SO'] = SO
26
27 # Always convert srcdir to an absolute path
28- srcdir = _config_vars.get('srcdir', project_base)
29+ if "_PYTHON_PROJECT_SRC" in os.environ:
30+ srcdir = os.path.abspath(os.environ["_PYTHON_PROJECT_SRC"])
31+ else:
32+ srcdir = _config_vars.get('srcdir', project_base)
33 if os.name == 'posix':
34 if python_build:
35 # If srcdir is a relative path (typically '.' or '..')
36Index: Python-3.5.3/Lib/sysconfig.py
37===================================================================
38--- Python-3.5.3.orig/Lib/sysconfig.py
39+++ Python-3.5.3/Lib/sysconfig.py
40@@ -544,7 +544,10 @@ def get_config_vars(*args):
41 _CONFIG_VARS['userbase'] = _getuserbase()
42
43 # Always convert srcdir to an absolute path
44- srcdir = _CONFIG_VARS.get('srcdir', _PROJECT_BASE)
45+ if "_PYTHON_PROJECT_SRC" in os.environ:
46+ srcdir = os.path.abspath(os.environ["_PYTHON_PROJECT_SRC"])
47+ else:
48+ srcdir = _CONFIG_VARS.get('srcdir', _PROJECT_BASE)
49 if os.name == 'posix':
50 if _PYTHON_BUILD:
51 # If srcdir is a relative path (typically '.' or '..')
diff --git a/meta/recipes-devtools/python/python3/sysroot-include-headers.patch b/meta/recipes-devtools/python/python3/sysroot-include-headers.patch
deleted file mode 100644
index 785b5567f2..0000000000
--- a/meta/recipes-devtools/python/python3/sysroot-include-headers.patch
+++ /dev/null
@@ -1,35 +0,0 @@
1Dont search hardcoded paths, we might be doing a cross-build
2Use '=' in-front to let compiler append sysroot, if it can
3
4Should fix things like
5
6configure:6972: arm-angstrom-linux-gnueabi-gcc -march=armv7-a -mthumb-interwork -mfloat-abi=hard -mfpu=neon -mtune=cortex-a8 -DNDEBUG -fno-inline -D__SOFTFP__ --sysroot=/build/v2013.06/build/tmp-angstrom_v2013_06-eglibc/sysroots/beaglebone -c -O2 -pipe -g -feliminate-unused-debug-types -I/usr/include/ncursesw conftest.c >&5
7cc1: warning: include location "/usr/include/ncursesw" is unsafe for cross-compilation [-Wpoison-system-directories]
8
9
10Signed-off-by: Khem Raj
11Upstream-Status: Pending
12
13
14Index: Python-3.3.2/setup.py
15===================================================================
16--- Python-3.3.2.orig/setup.py 2013-07-30 01:30:48.000000000 -0700
17+++ Python-3.3.2/setup.py 2013-07-30 01:41:11.697862723 -0700
18@@ -1210,7 +1210,7 @@
19 panel_library = 'panel'
20 if curses_library == 'ncursesw':
21 curses_defines.append(('HAVE_NCURSESW', '1'))
22- curses_includes.append('/usr/include/ncursesw')
23+ curses_includes.append('=/usr/include/ncursesw')
24 # Bug 1464056: If _curses.so links with ncursesw,
25 # _curses_panel.so must link with panelw.
26 panel_library = 'panelw'
27@@ -1819,7 +1819,7 @@
28 if host_platform == 'darwin':
29 # OS X 10.5 comes with libffi.dylib; the include files are
30 # in /usr/include/ffi
31- inc_dirs.append('/usr/include/ffi')
32+ inc_dirs.append('=/usr/include/ffi')
33
34 ffi_inc = [sysconfig.get_config_var("LIBFFI_INCLUDEDIR")]
35 if not ffi_inc or ffi_inc[0] == '':
diff --git a/meta/recipes-devtools/python/python3/tweak-MULTIARCH-for-powerpc-linux-gnuspe.patch b/meta/recipes-devtools/python/python3/tweak-MULTIARCH-for-powerpc-linux-gnuspe.patch
deleted file mode 100644
index 8d037278bd..0000000000
--- a/meta/recipes-devtools/python/python3/tweak-MULTIARCH-for-powerpc-linux-gnuspe.patch
+++ /dev/null
@@ -1,52 +0,0 @@
1From 5d6509313198ec9b686cad50b002212e4344004b Mon Sep 17 00:00:00 2001
2From: Hongxu Jia <hongxu.jia@windriver.com>
3Date: Fri, 11 Mar 2016 01:15:45 -0500
4Subject: [PATCH] configure.ac: tweak MULTIARCH for powerpc-linux-gnuspe
5
6For p1022ds bsp, the MULTIARCH is powerpc-linux-gnuspev1 and
7python3 did not recognize the extra 'v1' which caused python3
8configure error for the platform triplet.
9
10Q:Why Python3 check platform triplet?
11
12A:Under Linux, GNU/KFreeBSD and the Hurd, C extensions now include
13the architecture triplet in the extension name, to make it easy to
14test builds for different ABIs in the same working tree.
15
16Here is the generated C extensions which take platform triplet into account.
17...
18|image/usr/lib/python3.5/lib-dynload/_datetime.cpython-35m-powerpc-linux-gnuspe.so
19...
20
21https://bugs.python.org/issue22980
22https://www.python.org/dev/peps/pep-3149/
23https://bugs.python.org/review/22980/patch/14593/54808
24
25Upstream-Status: Pending
26
27Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
28---
29 configure.ac | 7 +++++++
30 1 file changed, 7 insertions(+)
31
32diff --git a/configure.ac b/configure.ac
33index 9eb3d22..c34a9a0 100644
34--- a/configure.ac
35+++ b/configure.ac
36@@ -724,6 +724,13 @@ fi
37
38
39 MULTIARCH=$($CC --print-multiarch 2>/dev/null)
40+
41+# Tweak MULTIARCH
42+if test x$MULTIARCH = xpowerpc-linux-gnuspev1
43+then
44+ MULTIARCH="powerpc-linux-gnuspe"
45+fi
46+
47 AC_SUBST(MULTIARCH)
48
49 AC_MSG_CHECKING([for the platform triplet based on compiler characteristics])
50--
511.9.1
52
diff --git a/meta/recipes-devtools/python/python3/tweak-MULTIARCH-for-powerpc-linux-musl.patch b/meta/recipes-devtools/python/python3/tweak-MULTIARCH-for-powerpc-linux-musl.patch
deleted file mode 100644
index 34c91755ff..0000000000
--- a/meta/recipes-devtools/python/python3/tweak-MULTIARCH-for-powerpc-linux-musl.patch
+++ /dev/null
@@ -1,40 +0,0 @@
1From 7362464383bbd54f8e6be4389f2c74c0717bc6e1 Mon Sep 17 00:00:00 2001
2From: Serhey Popovych <serhe.popovych@gmail.com>
3Date: Sat, 8 Dec 2018 11:24:06 -0500
4Subject: [PATCH] configure.ac: tweak MULTIARCH for powerpc-linux-musl
5
6For musl builds, the MULTIARCH is powerpc-linux-musl and configure.ac
7does not have lines to recognize it causing configure error for the
8platform triplet when building for powerpc 32bit.
9
10This is feature described in PEP-3149 and to prevent possible runtime
11compatibility issues we map powerpc-linux-musl to powerpc-linux-gnu.
12
13Look at similar change by Hongxu Jia <hongxu.jia@> presended in
14tweak-MULTIARCH-for-powerpc-linux-gnuspe.patch to handle p1022ds BSP
15builds.
16
17Upstream-Status: Pending
18Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
19---
20 configure.ac | 4 ++++
21 1 file changed, 4 insertions(+)
22
23diff --git a/configure.ac b/configure.ac
24index 95c98d1..1a4d8aa 100644
25--- a/configure.ac
26+++ b/configure.ac
27@@ -752,6 +752,10 @@ if test x$MULTIARCH = xpowerpc-linux-gnuspev1
28 then
29 MULTIARCH="powerpc-linux-gnuspe"
30 fi
31+if test x$MULTIARCH = xpowerpc-linux-musl
32+then
33+ MULTIARCH="powerpc-linux-gnu"
34+fi
35
36 AC_SUBST(MULTIARCH)
37
38--
392.7.4
40
diff --git a/meta/recipes-devtools/python/python3/unixccompiler.patch b/meta/recipes-devtools/python/python3/unixccompiler.patch
deleted file mode 100644
index 3e2b1d1c2e..0000000000
--- a/meta/recipes-devtools/python/python3/unixccompiler.patch
+++ /dev/null
@@ -1,35 +0,0 @@
1Upstream-Status: Pending
2
3The CC variable,sometimes like:"x86_64-poky-linux-gcc -m64 --sysroot=/${TMPDIR}/sysroots/qemux86-64", contains option information.
4This will lead to wrong compiler name "qemux86-64" rather than "x86_64-poky-linux-gcc" when python finding the compiler name.
5
6Secondly add -L=<path> this way linker will be able to resolve /usr/lib w.r.t sysroot and not
7use hardcoded /usr/lib to look for libs which is wrong in cross compile environment and this will work
8ok on native systems too since sysroot for native compilers is /
9
10Signed-off-by: Mei Lei <lei.mei@intel.com>
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12Index: Python-3.3.2/Lib/distutils/unixccompiler.py
13===================================================================
14--- Python-3.3.2.orig/Lib/distutils/unixccompiler.py 2013-05-15 09:32:54.000000000 -0700
15+++ Python-3.3.2/Lib/distutils/unixccompiler.py 2013-08-01 00:58:18.629056286 -0700
16@@ -202,7 +202,9 @@
17 # ccompiler.py.
18
19 def library_dir_option(self, dir):
20- return "-L" + dir
21+ if dir.startswith("/"):
22+ return "-L=" + dir
23+ return "-L" + dir
24
25 def _is_gcc(self, compiler_name):
26 return "gcc" in compiler_name or "g++" in compiler_name
27@@ -221,7 +221,7 @@
28 # this time, there's no way to determine this information from
29 # the configuration data stored in the Python installation, so
30 # we use this hack.
31- compiler = os.path.basename(sysconfig.get_config_var("CC"))
32+ compiler = sysconfig.get_config_var("CC")
33 if sys.platform[:6] == "darwin":
34 # MacOSX's linker doesn't understand the -R flag at all
35 return "-L" + dir
diff --git a/meta/recipes-devtools/python/python3_3.5.6.bb b/meta/recipes-devtools/python/python3_3.5.6.bb
deleted file mode 100644
index d64cb18c38..0000000000
--- a/meta/recipes-devtools/python/python3_3.5.6.bb
+++ /dev/null
@@ -1,334 +0,0 @@
1require recipes-devtools/python/python3.inc
2
3DEPENDS = "python3-native libffi bzip2 gdbm openssl \
4 sqlite3 zlib virtual/libintl xz qemu-native \
5 qemu-helper-native virtual/crypt"
6
7DISTRO_SRC_URI ?= "file://sitecustomize.py"
8DISTRO_SRC_URI_linuxstdbase = ""
9SRC_URI = "http://www.python.org/ftp/python/${PV}/Python-${PV}.tar.xz \
10file://python-config.patch \
11file://030-fixup-include-dirs.patch \
12file://130-readline-setup.patch \
13file://150-fix-setupterm.patch \
14file://0001-h2py-Fix-issue-13032-where-it-fails-with-UnicodeDeco.patch \
15file://tweak-MULTIARCH-for-powerpc-linux-gnuspe.patch \
16file://tweak-MULTIARCH-for-powerpc-linux-musl.patch \
17file://support_SOURCE_DATE_EPOCH_in_py_compile.patch \
18${DISTRO_SRC_URI} \
19"
20
21SRC_URI += "\
22 file://03-fix-tkinter-detection.patch \
23 ${@bb.utils.contains('PACKAGECONFIG', 'tk', '', 'file://avoid_warning_about_tkinter.patch', d)} \
24 file://cgi_py.patch \
25 file://host_include_contamination.patch \
26 file://python-3.3-multilib.patch \
27 file://sysroot-include-headers.patch \
28 file://unixccompiler.patch \
29 file://avoid-ncursesw-include-path.patch \
30 file://python3-use-CROSSPYTHONPATH-for-PYTHON_FOR_BUILD.patch \
31 file://sysconfig.py-add-_PYTHON_PROJECT_SRC.patch \
32 file://setup.py-check-cross_compiling-when-get-FLAGS.patch \
33 file://configure.ac-fix-LIBPL.patch \
34 file://0001-Issue-21272-Use-_sysconfigdata.py-to-initialize-dist.patch \
35 file://pass-missing-libraries-to-Extension-for-mul.patch \
36 file://Use-correct-CFLAGS-for-extensions-when-cross-compili.patch \
37 file://0002-Makefile-add-target-to-split-profile-generation.patch \
38 file://float-endian.patch \
39 file://ftplib.patch \
40 file://signal.patch \
41 file://0001-Issue-28043-SSLContext-has-improved-default-settings.patch \
42 file://0002-bpo-29136-Add-TLS-1.3-cipher-suites-and-OP_NO_TLSv1_.patch \
43 file://0003-bpo-32947-Fixes-for-TLS-1.3-and-OpenSSL-1.1.1-GH-876.patch \
44 file://0004-bpo-33570-TLS-1.3-ciphers-for-OpenSSL-1.1.1-GH-6976.patch \
45 file://0005-bpo-30714-ALPN-changes-for-OpenSSL-1.1.0f-2305.patch \
46 file://run-ptest \
47 file://0001-python3-use-cc_basename-to-replace-CC-for-checking-c.patch \
48 "
49
50inherit multilib_header python3native update-alternatives qemu ptest
51
52MULTILIB_SUFFIX = "${@d.getVar('base_libdir',1).split('/')[-1]}"
53
54ALTERNATIVE_${PN}-dev = "python-config"
55ALTERNATIVE_LINK_NAME[python-config] = "${bindir}/python${PYTHON_BINABI}-config"
56ALTERNATIVE_TARGET[python-config] = "${bindir}/python${PYTHON_BINABI}-config-${MULTILIB_SUFFIX}"
57
58CONFIGUREOPTS += " --with-system-ffi "
59
60CACHED_CONFIGUREVARS = "ac_cv_have_chflags=no \
61 ac_cv_have_lchflags=no \
62 ac_cv_have_long_long_format=yes \
63 ac_cv_buggy_getaddrinfo=no \
64 ac_cv_file__dev_ptmx=yes \
65 ac_cv_file__dev_ptc=no \
66"
67
68TARGET_CC_ARCH += "-DNDEBUG -fno-inline"
69SDK_CC_ARCH += "-DNDEBUG -fno-inline"
70EXTRA_OEMAKE += "CROSS_COMPILE=yes"
71EXTRA_OECONF += "CROSSPYTHONPATH=${STAGING_LIBDIR_NATIVE}/python${PYTHON_MAJMIN}/lib-dynload/ --without-ensurepip"
72
73PYTHON3_PROFILE_TASK ?= "./python -m test.regrtest --pgo test_grammar test_opcodes test_dict test_builtin test_exceptions test_types test_support || true"
74
75export CROSS_COMPILE = "${TARGET_PREFIX}"
76export CCSHARED = "-fPIC"
77
78# Fix cross compilation of different modules
79export CROSSPYTHONPATH = "${STAGING_LIBDIR_NATIVE}/python${PYTHON_MAJMIN}/lib-dynload/:${B}/build/lib.linux-${TARGET_ARCH}-${PYTHON_MAJMIN}:${S}/Lib:${S}/Lib/plat-linux"
80
81PACKAGECONFIG ??= "readline ${@bb.utils.contains('MACHINE_FEATURES', 'qemu-usermode', 'pgo', '', d)}"
82PACKAGECONFIG[readline] = ",,readline"
83# Use profile guided optimisation by running PyBench inside qemu-user
84PACKAGECONFIG[pgo] = "--enable-optimizations"
85PACKAGECONFIG[tk] = ",,tk"
86
87do_configure_append() {
88 rm -f ${S}/Makefile.orig
89}
90
91run_make() {
92 oe_runmake PGEN=${STAGING_BINDIR_NATIVE}/python3-native/pgen \
93 HOSTPYTHON=${STAGING_BINDIR_NATIVE}/python3-native/python3 \
94 STAGING_LIBDIR=${STAGING_LIBDIR} \
95 STAGING_INCDIR=${STAGING_INCDIR} \
96 STAGING_BASELIBDIR=${STAGING_BASELIBDIR} \
97 LIB=${baselib} \
98 ARCH=${TARGET_ARCH} \
99 OPT="${CFLAGS}" \
100 "$@"
101}
102
103do_compile() {
104 # regenerate platform specific files, because they depend on system headers
105 cd ${S}/Lib/plat-linux*
106 include=${STAGING_INCDIR} ${STAGING_BINDIR_NATIVE}/python3-native/python3 \
107 ${S}/Tools/scripts/h2py.py -i '(u_long)' \
108 ${STAGING_INCDIR}/dlfcn.h \
109 ${STAGING_INCDIR}/linux/cdrom.h \
110 ${STAGING_INCDIR}/netinet/in.h \
111 ${STAGING_INCDIR}/sys/types.h
112 sed -e 's,${STAGING_DIR_HOST},,g' -i *.py
113 cd -
114
115 # remove any bogus LD_LIBRARY_PATH
116 sed -i -e s,RUNSHARED=.*,RUNSHARED=, Makefile
117
118 if [ ! -f Makefile.orig ]; then
119 install -m 0644 Makefile Makefile.orig
120 fi
121 sed -i -e 's,^CONFIGURE_LDFLAGS=.*,CONFIGURE_LDFLAGS=-L. -L${STAGING_LIBDIR},g' \
122 -e 's,libdir=${libdir},libdir=${STAGING_LIBDIR},g' \
123 -e 's,libexecdir=${libexecdir},libexecdir=${STAGING_DIR_HOST}${libexecdir},g' \
124 -e 's,^LIBDIR=.*,LIBDIR=${STAGING_LIBDIR},g' \
125 -e 's,includedir=${includedir},includedir=${STAGING_INCDIR},g' \
126 -e 's,^INCLUDEDIR=.*,INCLUDE=${STAGING_INCDIR},g' \
127 -e 's,^CONFINCLUDEDIR=.*,CONFINCLUDE=${STAGING_INCDIR},g' \
128 Makefile
129 # save copy of it now, because if we do it in do_install and
130 # then call do_install twice we get Makefile.orig == Makefile.sysroot
131 install -m 0644 Makefile Makefile.sysroot
132
133 if ${@bb.utils.contains('PACKAGECONFIG', 'pgo', 'true', 'false', d)}; then
134 run_make profile-opt
135 qemu_binary="${@qemu_wrapper_cmdline(d, '${STAGING_DIR_TARGET}', ['${B}', '${STAGING_DIR_TARGET}/${base_libdir}'])}"
136 cat >pgo-wrapper <<EOF
137#!/bin/sh
138cd ${B}
139$qemu_binary "\$@"
140EOF
141 chmod +x pgo-wrapper
142 bbnote Gathering profiling data
143 ./pgo-wrapper ${PYTHON3_PROFILE_TASK}
144 bbnote Profiling data gathered, rebuilding
145 run_make clean_and_use_profile
146 else
147 run_make libpython3.so
148 run_make
149 fi
150}
151
152do_install() {
153 # make install needs the original Makefile, or otherwise the inclues would
154 # go to ${D}${STAGING...}/...
155 install -m 0644 Makefile.orig Makefile
156
157 install -d ${D}${libdir}/pkgconfig
158 install -d ${D}${libdir}/python${PYTHON_MAJMIN}/config
159
160 # rerun the build once again with original makefile this time
161 # run install in a separate step to avoid compile/install race
162 if ${@bb.utils.contains('PACKAGECONFIG', 'pgo', 'true', 'false', d)}; then
163 run_make DESTDIR=${D} LIBDIR=${libdir} build_all_use_profile
164 else
165 run_make DESTDIR=${D} LIBDIR=${libdir}
166 fi
167
168 run_make DESTDIR=${D} LIBDIR=${libdir} install
169
170 # avoid conflict with 2to3 from Python 2
171 rm -f ${D}/${bindir}/2to3
172
173 install -m 0644 Makefile.sysroot ${D}/${libdir}/python${PYTHON_MAJMIN}/config/Makefile
174 install -m 0644 Makefile.sysroot ${D}/${libdir}/python${PYTHON_MAJMIN}/config-${PYTHON_MAJMIN}${PYTHON_ABI}/Makefile
175
176 if [ -e ${WORKDIR}/sitecustomize.py ]; then
177 install -m 0644 ${WORKDIR}/sitecustomize.py ${D}/${libdir}/python${PYTHON_MAJMIN}
178 fi
179
180 oe_multilib_header python${PYTHON_BINABI}/pyconfig.h
181}
182
183do_install_append_class-nativesdk () {
184 create_wrapper ${D}${bindir}/python${PYTHON_MAJMIN} PYTHONHOME='${prefix}' TERMINFO_DIRS='${sysconfdir}/terminfo:/etc/terminfo:/usr/share/terminfo:/usr/share/misc/terminfo:/lib/terminfo' PYTHONNOUSERSITE='1'
185}
186
187SSTATE_SCAN_FILES += "Makefile"
188PACKAGE_PREPROCESS_FUNCS += "py_package_preprocess"
189
190py_package_preprocess () {
191 # copy back the old Makefile to fix target package
192 install -m 0644 ${B}/Makefile.orig ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/config/Makefile
193 install -m 0644 ${B}/Makefile.orig ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/config-${PYTHON_MAJMIN}${PYTHON_ABI}/Makefile
194 # Remove references to buildmachine paths in target Makefile and _sysconfigdata
195 sed -i -e 's:--sysroot=${STAGING_DIR_TARGET}::g' -e s:'--with-libtool-sysroot=${STAGING_DIR_TARGET}'::g \
196 -e 's|${DEBUG_PREFIX_MAP}||g' \
197 -e 's:${HOSTTOOLS_DIR}/::g' \
198 -e 's:${RECIPE_SYSROOT_NATIVE}::g' \
199 -e 's:${RECIPE_SYSROOT}::g' \
200 -e 's:${BASE_WORKDIR}/${MULTIMACH_TARGET_SYS}::g' \
201 ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/config/Makefile \
202 ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/config-${PYTHON_MAJMIN}${PYTHON_ABI}/Makefile \
203 ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/_sysconfigdata.py \
204 ${PKGD}/${bindir}/python${PYTHON_BINABI}-config
205
206 # Recompile _sysconfigdata after modifying it
207 cd ${PKGD}
208 ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} \
209 -c "from py_compile import compile; compile('./${libdir}/python${PYTHON_MAJMIN}/_sysconfigdata.py')"
210 ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} \
211 -c "from py_compile import compile; compile('./${libdir}/python${PYTHON_MAJMIN}/_sysconfigdata.py', optimize=1)"
212 ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} \
213 -c "from py_compile import compile; compile('./${libdir}/python${PYTHON_MAJMIN}/_sysconfigdata.py', optimize=2)"
214 cd -
215
216 mv ${PKGD}/${bindir}/python${PYTHON_BINABI}-config ${PKGD}/${bindir}/python${PYTHON_BINABI}-config-${MULTILIB_SUFFIX}
217}
218
219PACKAGES_remove = "${PN}"
220
221# manual dependency additions
222RPROVIDES_${PN}-modules = "${PN}"
223RRECOMMENDS_${PN}-core_append_class-nativesdk = " nativesdk-python3-modules"
224RRECOMMENDS_${PN}-crypt = "openssl ca-certificates"
225
226FILES_${PN}-2to3 += "${bindir}/2to3-${PYTHON_MAJMIN}"
227FILES_${PN}-pydoc += "${bindir}/pydoc${PYTHON_MAJMIN} ${bindir}/pydoc3"
228FILES_${PN}-idle += "${bindir}/idle3 ${bindir}/idle${PYTHON_MAJMIN}"
229
230# provide python-pyvenv from python3-venv
231RPROVIDES_${PN}-venv += "${PN}-pyvenv"
232
233# package libpython3
234PACKAGES =+ "libpython3 libpython3-staticdev"
235FILES_libpython3 = "${libdir}/libpython*.so.*"
236FILES_libpython3-staticdev += "${libdir}/python${PYTHON_MAJMIN}/config-${PYTHON_BINABI}/libpython${PYTHON_BINABI}.a"
237INSANE_SKIP_${PN}-dev += "dev-elf"
238
239# catch all the rest (unsorted)
240PACKAGES += "${PN}-misc"
241RDEPENDS_${PN}-misc += "${PN}-core ${PN}-email ${PN}-codecs"
242RDEPENDS_${PN}-modules += "${PN}-misc"
243FILES_${PN}-misc = "${libdir}/python${PYTHON_MAJMIN}"
244
245# catch manpage
246PACKAGES += "${PN}-man"
247FILES_${PN}-man = "${datadir}/man"
248
249RDEPENDS_${PN}-ptest = "${PN}-modules ${PN}-tests unzip bzip2"
250RDEPENDS_${PN}-tkinter += "${@bb.utils.contains('PACKAGECONFIG', 'tk', 'tk', '', d)}"
251RDEPENDS_${PN}-dev = ""
252
253BBCLASSEXTEND = "nativesdk"
254
255# We want bytecode precompiled .py files (.pyc's) by default
256# but the user may set it on their own conf
257INCLUDE_PYCS ?= "1"
258
259python(){
260 import collections, json
261
262 filename = os.path.join(d.getVar('THISDIR'), 'python3', 'python3-manifest.json')
263 # This python changes the datastore based on the contents of a file, so mark
264 # that dependency.
265 bb.parse.mark_dependency(d, filename)
266
267 with open(filename) as manifest_file:
268 manifest_str = manifest_file.read()
269 json_start = manifest_str.find('# EOC') + 6
270 manifest_file.seek(json_start)
271 manifest_str = manifest_file.read()
272 python_manifest = json.loads(manifest_str, object_pairs_hook=collections.OrderedDict)
273
274 include_pycs = d.getVar('INCLUDE_PYCS')
275
276 packages = d.getVar('PACKAGES').split()
277 pn = d.getVar('PN')
278
279 newpackages=[]
280 for key in python_manifest:
281 pypackage= pn + '-' + key
282
283 if pypackage not in packages:
284 # We need to prepend, otherwise python-misc gets everything
285 # so we use a new variable
286 newpackages.append(pypackage)
287
288 # "Build" python's manifest FILES, RDEPENDS and SUMMARY
289 d.setVar('FILES_' + pypackage, '')
290 for value in python_manifest[key]['files']:
291 d.appendVar('FILES_' + pypackage, ' ' + value)
292
293 # Add cached files
294 if include_pycs == '1':
295 for value in python_manifest[key]['cached']:
296 d.appendVar('FILES_' + pypackage, ' ' + value)
297
298 for value in python_manifest[key]['rdepends']:
299 # Make it work with or without $PN
300 if '${PN}' in value:
301 value=value.split('-')[1]
302 d.appendVar('RDEPENDS_' + pypackage, ' ' + pn + '-' + value)
303 d.setVar('SUMMARY_' + pypackage, python_manifest[key]['summary'])
304
305 # Prepending so to avoid python-misc getting everything
306 packages = newpackages + packages
307 d.setVar('PACKAGES', ' '.join(packages))
308 d.setVar('ALLOW_EMPTY_${PN}-modules', '1')
309}
310
311# Files needed to create a new manifest
312SRC_URI += "file://create_manifest3.py file://get_module_deps3.py file://python3-manifest.json"
313
314do_create_manifest() {
315 # This task should be run with every new release of Python.
316 # We must ensure that PACKAGECONFIG enables everything when creating
317 # a new manifest, this is to base our new manifest on a complete
318 # native python build, containing all dependencies, otherwise the task
319 # wont be able to find the required files.
320 # e.g. BerkeleyDB is an optional build dependency so it may or may not
321 # be present, we must ensure it is.
322
323 cd ${WORKDIR}
324 # This needs to be executed by python-native and NOT by HOST's python
325 nativepython3 create_manifest3.py ${PYTHON_MAJMIN}
326 cp python3-manifest.json.new ${THISDIR}/python3/python3-manifest.json
327}
328
329# bitbake python -c create_manifest
330addtask do_create_manifest
331
332# Make sure we have native python ready when we create a new manifest
333do_create_manifest[depends] += "python3:do_prepare_recipe_sysroot"
334do_create_manifest[depends] += "python3:do_patch"
diff --git a/meta/recipes-devtools/python/python3_3.7.2.bb b/meta/recipes-devtools/python/python3_3.7.2.bb
new file mode 100644
index 0000000000..e05ab42b0c
--- /dev/null
+++ b/meta/recipes-devtools/python/python3_3.7.2.bb
@@ -0,0 +1,287 @@
1SUMMARY = "The Python Programming Language"
2HOMEPAGE = "http://www.python.org"
3LICENSE = "PSFv2"
4SECTION = "devel/python"
5
6LIC_FILES_CHKSUM = "file://LICENSE;md5=f257cc14f81685691652a3d3e1b5d754"
7
8SRC_URI = "http://www.python.org/ftp/python/${PV}/Python-${PV}.tar.xz \
9 file://run-ptest \
10 file://create_manifest3.py \
11 file://get_module_deps3.py \
12 file://python3-manifest.json \
13 file://check_build_completeness.py \
14 file://cgi_py.patch \
15 file://0001-Do-not-add-usr-lib-termcap-to-linker-flags-to-avoid-.patch \
16 ${@bb.utils.contains('PACKAGECONFIG', 'tk', '', 'file://avoid_warning_about_tkinter.patch', d)} \
17 file://0001-Do-not-use-the-shell-version-of-python-config-that-w.patch \
18 file://python-config.patch \
19 file://0001-Makefile.pre-use-qemu-wrapper-when-gathering-profile.patch \
20 file://0001-Do-not-hardcode-lib-as-location-for-site-packages-an.patch \
21 file://0001-python3-use-cc_basename-to-replace-CC-for-checking-c.patch \
22 file://0002-Don-t-do-runtime-test-to-get-float-byte-order.patch \
23 file://0003-setup.py-pass-missing-libraries-to-Extension-for-mul.patch \
24 "
25
26SRC_URI_append_class-native = " \
27 file://0001-distutils-sysconfig-append-STAGING_LIBDIR-python-sys.patch \
28 file://12-distutils-prefix-is-inside-staging-area.patch \
29 "
30
31SRC_URI[md5sum] = "df6ec36011808205beda239c72f947cb"
32SRC_URI[sha256sum] = "d83fe8ce51b1bb48bbcf0550fd265b9a75cdfdfa93f916f9e700aef8444bf1bb"
33
34# exclude pre-releases for both python 2.x and 3.x
35UPSTREAM_CHECK_REGEX = "[Pp]ython-(?P<pver>\d+(\.\d+)+).tar"
36
37CVE_PRODUCT = "python"
38
39PYTHON_MAJMIN = "3.7"
40PYTHON_BINABI = "${PYTHON_MAJMIN}m"
41
42S = "${WORKDIR}/Python-${PV}"
43
44BBCLASSEXTEND = "native nativesdk"
45
46inherit autotools pkgconfig qemu ptest multilib_header update-alternatives
47
48MULTILIB_SUFFIX = "${@d.getVar('base_libdir',1).split('/')[-1]}"
49
50ALTERNATIVE_${PN}-dev = "python-config"
51ALTERNATIVE_LINK_NAME[python-config] = "${bindir}/python${PYTHON_BINABI}-config"
52ALTERNATIVE_TARGET[python-config] = "${bindir}/python${PYTHON_BINABI}-config-${MULTILIB_SUFFIX}"
53
54
55DEPENDS = "bzip2-replacement-native libffi bzip2 gdbm openssl sqlite3 zlib virtual/libintl xz virtual/crypt util-linux libtirpc libnsl2"
56DEPENDS_append_class-target = " python3-native"
57DEPENDS_append_class-nativesdk = " python3-native"
58
59EXTRA_OECONF = " --without-ensurepip --enable-shared"
60EXTRA_OECONF_append_class-native = " --bindir=${bindir}/${PN}"
61
62
63EXTRANATIVEPATH += "python3-native"
64
65CACHED_CONFIGUREVARS = " \
66 ac_cv_file__dev_ptmx=yes \
67 ac_cv_file__dev_ptc=no \
68"
69
70PACKAGECONFIG_class-target ??= "readline ${@bb.utils.contains('MACHINE_FEATURES', 'qemu-usermode', 'pgo', '', d)}"
71PACKAGECONFIG_class-native ??= "readline"
72PACKAGECONFIG_class-nativesdk ??= "readline"
73PACKAGECONFIG[readline] = ",,readline"
74# Use profile guided optimisation by running PyBench inside qemu-user
75PACKAGECONFIG[pgo] = "--enable-optimizations,,qemu-helper-native"
76PACKAGECONFIG[tk] = ",,tk"
77
78CPPFLAGS_append = " -I${STAGING_INCDIR}/ncursesw -I${STAGING_INCDIR}/uuid"
79
80EXTRA_OEMAKE = '\
81 STAGING_LIBDIR=${STAGING_LIBDIR} \
82 STAGING_INCDIR=${STAGING_INCDIR} \
83 LIB=${baselib} \
84'
85
86do_compile_prepend_class-target() {
87 if ${@bb.utils.contains('PACKAGECONFIG', 'pgo', 'true', 'false', d)}; then
88 qemu_binary="${@qemu_wrapper_cmdline(d, '${STAGING_DIR_TARGET}', ['${B}', '${STAGING_DIR_TARGET}/${base_libdir}'])}"
89 cat >pgo-wrapper <<EOF
90#!/bin/sh
91cd ${B}
92$qemu_binary "\$@"
93EOF
94 chmod +x pgo-wrapper
95 fi
96}
97
98do_install_prepend() {
99 ${WORKDIR}/check_build_completeness.py ${T}/log.do_compile
100}
101
102do_install_append_class-target() {
103 oe_multilib_header python${PYTHON_BINABI}/pyconfig.h
104}
105
106do_install_append_class-native() {
107 # Make sure we use /usr/bin/env python
108 for PYTHSCRIPT in `grep -rIl ${bindir}/${PN}/python ${D}${bindir}/${PN}`; do
109 sed -i -e '1s|^#!.*|#!/usr/bin/env python3|' $PYTHSCRIPT
110 done
111 # Add a symlink to the native Python so that scripts can just invoke
112 # "nativepython" and get the right one without needing absolute paths
113 # (these often end up too long for the #! parser in the kernel as the
114 # buffer is 128 bytes long).
115 ln -s python3-native/python3 ${D}${bindir}/nativepython3
116}
117
118do_install_append() {
119 mkdir -p ${D}${libdir}/python-sysconfigdata
120 sysconfigfile=`find ${D} -name _sysconfig*.py`
121 cp $sysconfigfile ${D}${libdir}/python-sysconfigdata/_sysconfigdata.py
122
123 sed -i \
124 -e "s,^ 'LIBDIR'.*, 'LIBDIR': '${STAGING_LIBDIR}'\,,g" \
125 -e "s,^ 'INCLUDEDIR'.*, 'INCLUDEDIR': '${STAGING_INCDIR}'\,,g" \
126 -e "s,^ 'CONFINCLUDEDIR'.*, 'CONFINCLUDEDIR': '${STAGING_INCDIR}'\,,g" \
127 ${D}${libdir}/python-sysconfigdata/_sysconfigdata.py
128}
129
130SSTATE_SCAN_FILES += "Makefile _sysconfigdata.py"
131PACKAGE_PREPROCESS_FUNCS += "py_package_preprocess"
132
133py_package_preprocess () {
134 # Remove references to buildmachine paths in target Makefile and _sysconfigdata
135 sed -i -e 's:--sysroot=${STAGING_DIR_TARGET}::g' -e s:'--with-libtool-sysroot=${STAGING_DIR_TARGET}'::g \
136 -e 's|${DEBUG_PREFIX_MAP}||g' \
137 -e 's:${HOSTTOOLS_DIR}/::g' \
138 -e 's:${RECIPE_SYSROOT_NATIVE}::g' \
139 -e 's:${RECIPE_SYSROOT}::g' \
140 -e 's:${BASE_WORKDIR}/${MULTIMACH_TARGET_SYS}::g' \
141 ${PKGD}/${prefix}/lib/python${PYTHON_MAJMIN}/config-${PYTHON_MAJMIN}${PYTHON_ABI}*/Makefile \
142 ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/_sysconfigdata*.py \
143 ${PKGD}/${bindir}/python${PYTHON_BINABI}-config
144
145 # Recompile _sysconfigdata after modifying it
146 cd ${PKGD}
147 sysconfigfile=`find . -name _sysconfigdata_*.py`
148 ${STAGING_BINDIR_NATIVE}/python3-native/python3 \
149 -c "from py_compile import compile; compile('$sysconfigfile')"
150 ${STAGING_BINDIR_NATIVE}/python3-native/python3 \
151 -c "from py_compile import compile; compile('$sysconfigfile', optimize=1)"
152 ${STAGING_BINDIR_NATIVE}/python3-native/python3 \
153 -c "from py_compile import compile; compile('$sysconfigfile', optimize=2)"
154 cd -
155
156 mv ${PKGD}/${bindir}/python${PYTHON_BINABI}-config ${PKGD}/${bindir}/python${PYTHON_BINABI}-config-${MULTILIB_SUFFIX}
157
158 #Remove the unneeded copy of target sysconfig data
159 rm -rf ${PKGD}/${libdir}/python-sysconfigdata
160}
161
162# We want bytecode precompiled .py files (.pyc's) by default
163# but the user may set it on their own conf
164INCLUDE_PYCS ?= "1"
165
166python(){
167 import collections, json
168
169 filename = os.path.join(d.getVar('THISDIR'), 'python3', 'python3-manifest.json')
170 # This python changes the datastore based on the contents of a file, so mark
171 # that dependency.
172 bb.parse.mark_dependency(d, filename)
173
174 with open(filename) as manifest_file:
175 manifest_str = manifest_file.read()
176 json_start = manifest_str.find('# EOC') + 6
177 manifest_file.seek(json_start)
178 manifest_str = manifest_file.read()
179 python_manifest = json.loads(manifest_str, object_pairs_hook=collections.OrderedDict)
180
181 # First set RPROVIDES for -native case
182 # Hardcoded since it cant be python3-native-foo, should be python3-foo-native
183 pn = 'python3'
184 rprovides = d.getVar('RPROVIDES').split()
185
186 for key in python_manifest:
187 pypackage = pn + '-' + key + '-native'
188 if pypackage not in rprovides:
189 rprovides.append(pypackage)
190
191 d.setVar('RPROVIDES_class-native', ' '.join(rprovides))
192
193 # Then work on the target
194 include_pycs = d.getVar('INCLUDE_PYCS')
195
196 packages = d.getVar('PACKAGES').split()
197 pn = d.getVar('PN')
198
199 newpackages=[]
200 for key in python_manifest:
201 pypackage= pn + '-' + key
202
203 if pypackage not in packages:
204 # We need to prepend, otherwise python-misc gets everything
205 # so we use a new variable
206 newpackages.append(pypackage)
207
208 # "Build" python's manifest FILES, RDEPENDS and SUMMARY
209 d.setVar('FILES_' + pypackage, '')
210 for value in python_manifest[key]['files']:
211 d.appendVar('FILES_' + pypackage, ' ' + value)
212
213 # Add cached files
214 if include_pycs == '1':
215 for value in python_manifest[key]['cached']:
216 d.appendVar('FILES_' + pypackage, ' ' + value)
217
218 for value in python_manifest[key]['rdepends']:
219 # Make it work with or without $PN
220 if '${PN}' in value:
221 value=value.split('-')[1]
222 d.appendVar('RDEPENDS_' + pypackage, ' ' + pn + '-' + value)
223 d.setVar('SUMMARY_' + pypackage, python_manifest[key]['summary'])
224
225 # Prepending so to avoid python-misc getting everything
226 packages = newpackages + packages
227 d.setVar('PACKAGES', ' '.join(packages))
228 d.setVar('ALLOW_EMPTY_${PN}-modules', '1')
229}
230
231# Files needed to create a new manifest
232
233do_create_manifest() {
234 # This task should be run with every new release of Python.
235 # We must ensure that PACKAGECONFIG enables everything when creating
236 # a new manifest, this is to base our new manifest on a complete
237 # native python build, containing all dependencies, otherwise the task
238 # wont be able to find the required files.
239 # e.g. BerkeleyDB is an optional build dependency so it may or may not
240 # be present, we must ensure it is.
241
242 cd ${WORKDIR}
243 # This needs to be executed by python-native and NOT by HOST's python
244 nativepython3 create_manifest3.py ${PYTHON_MAJMIN}
245 cp python3-manifest.json.new ${THISDIR}/python3/python3-manifest.json
246}
247
248# bitbake python -c create_manifest
249addtask do_create_manifest
250
251# Make sure we have native python ready when we create a new manifest
252do_create_manifest[depends] += "${PN}:do_prepare_recipe_sysroot"
253do_create_manifest[depends] += "${PN}:do_patch"
254
255# manual dependency additions
256RPROVIDES_${PN}-modules = "${PN}"
257RRECOMMENDS_${PN}-core_append_class-nativesdk = " nativesdk-python3-modules"
258RRECOMMENDS_${PN}-crypt_append_class-target = " openssl ca-certificates"
259RRECOMMENDS_${PN}-crypt_append_class-nativesdk = " openssl ca-certificates"
260
261FILES_${PN}-pydoc += "${bindir}/pydoc${PYTHON_MAJMIN} ${bindir}/pydoc3"
262FILES_${PN}-idle += "${bindir}/idle3 ${bindir}/idle${PYTHON_MAJMIN}"
263
264# provide python-pyvenv from python3-venv
265RPROVIDES_${PN}-venv += "python3-pyvenv"
266
267# package libpython3
268PACKAGES =+ "libpython3 libpython3-staticdev"
269FILES_libpython3 = "${libdir}/libpython*.so.*"
270FILES_libpython3-staticdev += "${prefix}/lib/python${PYTHON_MAJMIN}/config-${PYTHON_BINABI}-*/libpython${PYTHON_BINABI}.a"
271INSANE_SKIP_${PN}-dev += "dev-elf"
272
273# catch all the rest (unsorted)
274PACKAGES += "${PN}-misc"
275RDEPENDS_${PN}-misc += "python3-core python3-email python3-codecs"
276RDEPENDS_${PN}-modules_append_class-target = " python3-misc"
277RDEPENDS_${PN}-modules_append_class-nativesdk = " python3-misc"
278FILES_${PN}-misc = "${libdir}/python${PYTHON_MAJMIN} ${libdir}/python${PYTHON_MAJMIN}/lib-dynload"
279
280# catch manpage
281PACKAGES += "${PN}-man"
282FILES_${PN}-man = "${datadir}/man"
283
284RDEPENDS_${PN}-ptest = "${PN}-modules ${PN}-tests unzip bzip2"
285RDEPENDS_${PN}-tkinter += "${@bb.utils.contains('PACKAGECONFIG', 'tk', 'tk', '', d)}"
286RDEPENDS_${PN}-dev = ""
287