summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/python/python3_3.7.4.bb
diff options
context:
space:
mode:
authorAdrian Bunk <bunk@stusta.de>2019-11-05 23:38:13 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-11-18 14:42:13 +0000
commitd865ce715400479129047d4426f9d78fb8873280 (patch)
tree27924e4f9eddcb9e07adbf5cc6137807a6239122 /meta/recipes-devtools/python/python3_3.7.4.bb
parent66f4295cbfe506e873e79d48aeb1d7bf6a78c4d1 (diff)
downloadpoky-d865ce715400479129047d4426f9d78fb8873280.tar.gz
python3: Upgrade 3.7.4 -> 3.7.5
Backported patch removed. 3.7.5 also includes the fix for CVE-2019-16935. (From OE-Core rev: deabbb60b98418bd4fcf97adc3293b65d3ff306e) Signed-off-by: Adrian Bunk <bunk@stusta.de> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Anuj Mittal <anuj.mittal@intel.com> Signed-off-by: Armin Kuster <akuster808@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/python/python3_3.7.4.bb')
-rw-r--r--meta/recipes-devtools/python/python3_3.7.4.bb313
1 files changed, 0 insertions, 313 deletions
diff --git a/meta/recipes-devtools/python/python3_3.7.4.bb b/meta/recipes-devtools/python/python3_3.7.4.bb
deleted file mode 100644
index ce1a462791..0000000000
--- a/meta/recipes-devtools/python/python3_3.7.4.bb
+++ /dev/null
@@ -1,313 +0,0 @@
1SUMMARY = "The Python Programming Language"
2HOMEPAGE = "http://www.python.org"
3LICENSE = "PSFv2"
4SECTION = "devel/python"
5
6LIC_FILES_CHKSUM = "file://LICENSE;md5=e466242989bd33c1bd2b6a526a742498"
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 file://0001-Lib-sysconfig.py-fix-another-place-where-lib-is-hard.patch \
25 file://0001-Makefile-fix-Issue36464-parallel-build-race-problem.patch \
26 file://0001-bpo-36852-proper-detection-of-mips-architecture-for-.patch \
27 file://crosspythonpath.patch \
28 file://reformat_sysconfig.py \
29 file://0001-Use-FLAG_REF-always-for-interned-strings.patch \
30 file://0001-test_locale.py-correct-the-test-output-format.patch \
31 file://0001-bpo-34155-Dont-parse-domains-containing-GH-13079.patch \
32 "
33
34SRC_URI_append_class-native = " \
35 file://0001-distutils-sysconfig-append-STAGING_LIBDIR-python-sys.patch \
36 file://12-distutils-prefix-is-inside-staging-area.patch \
37 "
38SRC_URI_append_class-nativesdk = " \
39 file://0001-main.c-if-OEPYTHON3HOME-is-set-use-instead-of-PYTHON.patch \
40 "
41
42SRC_URI[md5sum] = "d33e4aae66097051c2eca45ee3604803"
43SRC_URI[sha256sum] = "fb799134b868199930b75f26678f18932214042639cd52b16da7fd134cd9b13f"
44
45# exclude pre-releases for both python 2.x and 3.x
46UPSTREAM_CHECK_REGEX = "[Pp]ython-(?P<pver>\d+(\.\d+)+).tar"
47
48CVE_PRODUCT = "python"
49
50PYTHON_MAJMIN = "3.7"
51PYTHON_BINABI = "${PYTHON_MAJMIN}m"
52
53S = "${WORKDIR}/Python-${PV}"
54
55BBCLASSEXTEND = "native nativesdk"
56
57inherit autotools pkgconfig qemu ptest multilib_header update-alternatives
58
59MULTILIB_SUFFIX = "${@d.getVar('base_libdir',1).split('/')[-1]}"
60
61ALTERNATIVE_${PN}-dev = "python-config"
62ALTERNATIVE_LINK_NAME[python-config] = "${bindir}/python${PYTHON_BINABI}-config"
63ALTERNATIVE_TARGET[python-config] = "${bindir}/python${PYTHON_BINABI}-config-${MULTILIB_SUFFIX}"
64
65
66DEPENDS = "bzip2-replacement-native libffi bzip2 gdbm openssl sqlite3 zlib virtual/libintl xz virtual/crypt util-linux libtirpc libnsl2"
67DEPENDS_append_class-target = " python3-native"
68DEPENDS_append_class-nativesdk = " python3-native"
69
70EXTRA_OECONF = " --without-ensurepip --enable-shared"
71EXTRA_OECONF_append_class-native = " --bindir=${bindir}/${PN}"
72
73export CROSSPYTHONPATH="${STAGING_LIBDIR_NATIVE}/python${PYTHON_MAJMIN}/lib-dynload/"
74
75EXTRANATIVEPATH += "python3-native"
76
77CACHED_CONFIGUREVARS = " \
78 ac_cv_file__dev_ptmx=yes \
79 ac_cv_file__dev_ptc=no \
80 ac_cv_working_tzset=yes \
81"
82
83PACKAGECONFIG_class-target ??= "readline ${@bb.utils.contains('MACHINE_FEATURES', 'qemu-usermode', 'pgo', '', d)}"
84PACKAGECONFIG_class-native ??= "readline"
85PACKAGECONFIG_class-nativesdk ??= "readline"
86PACKAGECONFIG[readline] = ",,readline"
87# Use profile guided optimisation by running PyBench inside qemu-user
88PACKAGECONFIG[pgo] = "--enable-optimizations,,qemu-native"
89PACKAGECONFIG[tk] = ",,tk"
90
91CPPFLAGS_append = " -I${STAGING_INCDIR}/ncursesw -I${STAGING_INCDIR}/uuid"
92
93EXTRA_OEMAKE = '\
94 STAGING_LIBDIR=${STAGING_LIBDIR} \
95 STAGING_INCDIR=${STAGING_INCDIR} \
96 LIB=${baselib} \
97'
98
99do_compile_prepend_class-target() {
100 if ${@bb.utils.contains('PACKAGECONFIG', 'pgo', 'true', 'false', d)}; then
101 qemu_binary="${@qemu_wrapper_cmdline(d, '${STAGING_DIR_TARGET}', ['${B}', '${STAGING_DIR_TARGET}/${base_libdir}'])}"
102 cat >pgo-wrapper <<EOF
103#!/bin/sh
104cd ${B}
105$qemu_binary "\$@"
106EOF
107 chmod +x pgo-wrapper
108 fi
109}
110
111do_install_prepend() {
112 ${WORKDIR}/check_build_completeness.py ${T}/log.do_compile
113}
114
115do_install_append_class-target() {
116 oe_multilib_header python${PYTHON_BINABI}/pyconfig.h
117}
118
119do_install_append_class-native() {
120 # Make sure we use /usr/bin/env python
121 for PYTHSCRIPT in `grep -rIl ${bindir}/${PN}/python ${D}${bindir}/${PN}`; do
122 sed -i -e '1s|^#!.*|#!/usr/bin/env python3|' $PYTHSCRIPT
123 done
124 # Add a symlink to the native Python so that scripts can just invoke
125 # "nativepython" and get the right one without needing absolute paths
126 # (these often end up too long for the #! parser in the kernel as the
127 # buffer is 128 bytes long).
128 ln -s python3-native/python3 ${D}${bindir}/nativepython3
129}
130
131do_install_append() {
132 mkdir -p ${D}${libdir}/python-sysconfigdata
133 sysconfigfile=`find ${D} -name _sysconfig*.py`
134 cp $sysconfigfile ${D}${libdir}/python-sysconfigdata/_sysconfigdata.py
135
136 sed -i \
137 -e "s,^ 'LIBDIR'.*, 'LIBDIR': '${STAGING_LIBDIR}'\,,g" \
138 -e "s,^ 'INCLUDEDIR'.*, 'INCLUDEDIR': '${STAGING_INCDIR}'\,,g" \
139 -e "s,^ 'CONFINCLUDEDIR'.*, 'CONFINCLUDEDIR': '${STAGING_INCDIR}'\,,g" \
140 -e "/^ 'INCLDIRSTOMAKE'/{N; s,/usr/include,${STAGING_INCDIR},g}" \
141 -e "/^ 'INCLUDEPY'/s,/usr/include,${STAGING_INCDIR},g" \
142 ${D}${libdir}/python-sysconfigdata/_sysconfigdata.py
143}
144
145do_install_append_class-nativesdk () {
146 create_wrapper ${D}${bindir}/python${PYTHON_MAJMIN} OEPYTHON3HOME='${prefix}' TERMINFO_DIRS='${sysconfdir}/terminfo:/etc/terminfo:/usr/share/terminfo:/usr/share/misc/terminfo:/lib/terminfo' PYTHONNOUSERSITE='1'
147}
148
149SSTATE_SCAN_FILES += "Makefile _sysconfigdata.py"
150PACKAGE_PREPROCESS_FUNCS += "py_package_preprocess"
151
152py_package_preprocess () {
153 # Remove references to buildmachine paths in target Makefile and _sysconfigdata
154 sed -i -e 's:--sysroot=${STAGING_DIR_TARGET}::g' -e s:'--with-libtool-sysroot=${STAGING_DIR_TARGET}'::g \
155 -e 's|${DEBUG_PREFIX_MAP}||g' \
156 -e 's:${HOSTTOOLS_DIR}/::g' \
157 -e 's:${RECIPE_SYSROOT_NATIVE}::g' \
158 -e 's:${RECIPE_SYSROOT}::g' \
159 -e 's:${BASE_WORKDIR}/${MULTIMACH_TARGET_SYS}::g' \
160 ${PKGD}/${prefix}/lib/python${PYTHON_MAJMIN}/config-${PYTHON_MAJMIN}${PYTHON_ABI}*/Makefile \
161 ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/_sysconfigdata*.py \
162 ${PKGD}/${bindir}/python${PYTHON_BINABI}-config
163
164 # Reformat _sysconfigdata after modifying it so that it remains
165 # reproducible
166 for c in ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/_sysconfigdata*.py; do
167 python3 ${WORKDIR}/reformat_sysconfig.py $c
168 done
169
170 # Recompile _sysconfigdata after modifying it
171 cd ${PKGD}
172 sysconfigfile=`find . -name _sysconfigdata_*.py`
173 ${STAGING_BINDIR_NATIVE}/python3-native/python3 \
174 -c "from py_compile import compile; compile('$sysconfigfile')"
175 ${STAGING_BINDIR_NATIVE}/python3-native/python3 \
176 -c "from py_compile import compile; compile('$sysconfigfile', optimize=1)"
177 ${STAGING_BINDIR_NATIVE}/python3-native/python3 \
178 -c "from py_compile import compile; compile('$sysconfigfile', optimize=2)"
179 cd -
180
181 mv ${PKGD}/${bindir}/python${PYTHON_BINABI}-config ${PKGD}/${bindir}/python${PYTHON_BINABI}-config-${MULTILIB_SUFFIX}
182
183 #Remove the unneeded copy of target sysconfig data
184 rm -rf ${PKGD}/${libdir}/python-sysconfigdata
185}
186
187# We want bytecode precompiled .py files (.pyc's) by default
188# but the user may set it on their own conf
189INCLUDE_PYCS ?= "1"
190
191python(){
192 import collections, json
193
194 filename = os.path.join(d.getVar('THISDIR'), 'python3', 'python3-manifest.json')
195 # This python changes the datastore based on the contents of a file, so mark
196 # that dependency.
197 bb.parse.mark_dependency(d, filename)
198
199 with open(filename) as manifest_file:
200 manifest_str = manifest_file.read()
201 json_start = manifest_str.find('# EOC') + 6
202 manifest_file.seek(json_start)
203 manifest_str = manifest_file.read()
204 python_manifest = json.loads(manifest_str, object_pairs_hook=collections.OrderedDict)
205
206 # First set RPROVIDES for -native case
207 # Hardcoded since it cant be python3-native-foo, should be python3-foo-native
208 pn = 'python3'
209 rprovides = d.getVar('RPROVIDES').split()
210
211 for key in python_manifest:
212 pypackage = pn + '-' + key + '-native'
213 if pypackage not in rprovides:
214 rprovides.append(pypackage)
215
216 d.setVar('RPROVIDES_class-native', ' '.join(rprovides))
217
218 # Then work on the target
219 include_pycs = d.getVar('INCLUDE_PYCS')
220
221 packages = d.getVar('PACKAGES').split()
222 pn = d.getVar('PN')
223
224 newpackages=[]
225 for key in python_manifest:
226 pypackage= pn + '-' + key
227
228 if pypackage not in packages:
229 # We need to prepend, otherwise python-misc gets everything
230 # so we use a new variable
231 newpackages.append(pypackage)
232
233 # "Build" python's manifest FILES, RDEPENDS and SUMMARY
234 d.setVar('FILES_' + pypackage, '')
235 for value in python_manifest[key]['files']:
236 d.appendVar('FILES_' + pypackage, ' ' + value)
237
238 # Add cached files
239 if include_pycs == '1':
240 for value in python_manifest[key]['cached']:
241 d.appendVar('FILES_' + pypackage, ' ' + value)
242
243 for value in python_manifest[key]['rdepends']:
244 # Make it work with or without $PN
245 if '${PN}' in value:
246 value=value.split('-')[1]
247 d.appendVar('RDEPENDS_' + pypackage, ' ' + pn + '-' + value)
248 d.setVar('SUMMARY_' + pypackage, python_manifest[key]['summary'])
249
250 # Prepending so to avoid python-misc getting everything
251 packages = newpackages + packages
252 d.setVar('PACKAGES', ' '.join(packages))
253 d.setVar('ALLOW_EMPTY_${PN}-modules', '1')
254}
255
256# Files needed to create a new manifest
257
258do_create_manifest() {
259 # This task should be run with every new release of Python.
260 # We must ensure that PACKAGECONFIG enables everything when creating
261 # a new manifest, this is to base our new manifest on a complete
262 # native python build, containing all dependencies, otherwise the task
263 # wont be able to find the required files.
264 # e.g. BerkeleyDB is an optional build dependency so it may or may not
265 # be present, we must ensure it is.
266
267 cd ${WORKDIR}
268 # This needs to be executed by python-native and NOT by HOST's python
269 nativepython3 create_manifest3.py ${PYTHON_MAJMIN}
270 cp python3-manifest.json.new ${THISDIR}/python3/python3-manifest.json
271}
272
273# bitbake python -c create_manifest
274addtask do_create_manifest
275
276# Make sure we have native python ready when we create a new manifest
277do_create_manifest[depends] += "${PN}:do_prepare_recipe_sysroot"
278do_create_manifest[depends] += "${PN}:do_patch"
279
280# manual dependency additions
281RPROVIDES_${PN}-modules = "${PN}"
282RRECOMMENDS_${PN}-core_append_class-nativesdk = " nativesdk-python3-modules"
283RRECOMMENDS_${PN}-crypt_append_class-target = " openssl ca-certificates"
284RRECOMMENDS_${PN}-crypt_append_class-nativesdk = " openssl ca-certificates"
285
286FILES_${PN}-pydoc += "${bindir}/pydoc${PYTHON_MAJMIN} ${bindir}/pydoc3"
287FILES_${PN}-idle += "${bindir}/idle3 ${bindir}/idle${PYTHON_MAJMIN}"
288
289# provide python-pyvenv from python3-venv
290RPROVIDES_${PN}-venv += "python3-pyvenv"
291
292# package libpython3
293PACKAGES =+ "libpython3 libpython3-staticdev"
294FILES_libpython3 = "${libdir}/libpython*.so.*"
295FILES_libpython3-staticdev += "${prefix}/lib/python${PYTHON_MAJMIN}/config-${PYTHON_BINABI}-*/libpython${PYTHON_BINABI}.a"
296INSANE_SKIP_${PN}-dev += "dev-elf"
297
298# catch all the rest (unsorted)
299PACKAGES += "${PN}-misc"
300RDEPENDS_${PN}-misc += "python3-core python3-email python3-codecs"
301RDEPENDS_${PN}-modules_append_class-target = " python3-misc"
302RDEPENDS_${PN}-modules_append_class-nativesdk = " python3-misc"
303FILES_${PN}-misc = "${libdir}/python${PYTHON_MAJMIN} ${libdir}/python${PYTHON_MAJMIN}/lib-dynload"
304
305# catch manpage
306PACKAGES += "${PN}-man"
307FILES_${PN}-man = "${datadir}/man"
308
309RDEPENDS_${PN}-ptest = "${PN}-modules ${PN}-tests unzip bzip2 libgcc tzdata-europe coreutils sed"
310RDEPENDS_${PN}-ptest_append_libc-glibc = " locale-base-tr-tr.iso-8859-9"
311RDEPENDS_${PN}-tkinter += "${@bb.utils.contains('PACKAGECONFIG', 'tk', 'tk tk-lib', '', d)}"
312RDEPENDS_${PN}-dev = ""
313