summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/python/python3_3.13.1.bb
diff options
context:
space:
mode:
authorTrevor Gamblin <tgamblin@baylibre.com>2024-12-23 11:20:52 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2025-01-03 11:05:03 +0000
commitd832ee79631ac1502b107091cdcfd8f88237d533 (patch)
tree5dfb709b0338a7e58ba9dcdbcd7312b5bf1dc7e3 /meta/recipes-devtools/python/python3_3.13.1.bb
parent418235f06803c901184d5c4a3883c0dbecee1f06 (diff)
downloadpoky-d832ee79631ac1502b107091cdcfd8f88237d533.tar.gz
python3: upgrade 3.13.0 -> 3.13.1
Changelog: https://docs.python.org/3/whatsnew/changelog.html#python-3-13-1-final - Patch 'fix-armv5.patch' is in 3.13.1, so no longer needed: |tgamblin@megalith ~/workspace/git/pythonsrc/cpython ((HEAD detached from v3.13.1))$ git tag --contains 18b9079ddbc149d6b99c922630c246812e4d8ae7 |v3.13.1 - While patch 'crosspythonpath.patch' is listed as 'Inappropriate [OE-Core integration specific]' specific in the commit message, it is now breaking the build, while removing it allows python3 to build OK. It appears that there is a similar change in upstream 3.13.1: https://github.com/python/cpython/commit/909d5ac2959e - gcc-symlinks had to be added to ptest RDEPENDS so that 'gcc' could be found on the path for the test_ctypes.test_dlerror.TestNullDlsym.test_null_dlsym test. - Also reformat the DEPENDS and RDEPENDS lists to be alphabetical and one-per-line, since that's easier to read and modify. - buildall-qemu output: |BUILDALL-QEMU LOG FOR python3 |START TIME: 2024-12-18_20:38:01 |HOSTNAME: megalith |HOST OS: Debian GNU/Linux 12 (bookworm) |HOST KERNEL: 6.1.0-28-amd64 |=============== |BUILD RESULTS: |[glibc] |FAIL: qemuloongarch64 |PASS: qemuriscv32 |PASS: qemuarmv5 |PASS: qemuppc |PASS: qemumips64 |PASS: qemuriscv64 |PASS: qemuarm64 |PASS: qemuarm |PASS: qemux86-64 |PASS: qemuppc64 |PASS: qemux86 |PASS: qemumips |[musl] |FAIL: qemuloongarch64 |FAIL: qemuriscv32 |PASS: qemuarmv5 |PASS: qemuppc |PASS: qemumips64 |PASS: qemuriscv64 |PASS: qemuarm64 |PASS: qemuarm |PASS: qemux86-64 |PASS: qemuppc64 |PASS: qemux86 |PASS: qemumips |=============== |PASSED: 21 |FAILED: 3 (From OE-Core rev: 08c44d3b140b220ead6334db26097b28612d445a) Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/python/python3_3.13.1.bb')
-rw-r--r--meta/recipes-devtools/python/python3_3.13.1.bb516
1 files changed, 516 insertions, 0 deletions
diff --git a/meta/recipes-devtools/python/python3_3.13.1.bb b/meta/recipes-devtools/python/python3_3.13.1.bb
new file mode 100644
index 0000000000..b2eaf9f439
--- /dev/null
+++ b/meta/recipes-devtools/python/python3_3.13.1.bb
@@ -0,0 +1,516 @@
1SUMMARY = "The Python Programming Language"
2HOMEPAGE = "http://www.python.org"
3DESCRIPTION = "Python is a programming language that lets you work more quickly and integrate your systems more effectively."
4LICENSE = "PSF-2.0"
5SECTION = "devel/python"
6
7LIC_FILES_CHKSUM = "file://LICENSE;md5=3f64a4ff490f884d562feb77bf2435f1"
8
9SRC_URI = "http://www.python.org/ftp/python/${PV}/Python-${PV}.tar.xz \
10 file://run-ptest \
11 file://create_manifest3.py \
12 file://get_module_deps3.py \
13 file://python3-manifest.json \
14 file://check_build_completeness.py \
15 file://reformat_sysconfig.py \
16 file://0001-Makefile.pre-use-qemu-wrapper-when-gathering-profile.patch \
17 file://0001-test_locale.py-correct-the-test-output-format.patch \
18 file://0001-Skip-failing-tests-due-to-load-variability-on-YP-AB.patch \
19 file://0001-test_ctypes.test_find-skip-without-tools-sdk.patch \
20 file://makerace.patch \
21 file://0001-sysconfig.py-use-platlibdir-also-for-purelib.patch \
22 file://0001-Lib-pty.py-handle-stdin-I-O-errors-same-way-as-maste.patch \
23 file://deterministic_imports.patch \
24 file://0001-Avoid-shebang-overflow-on-python-config.py.patch \
25 file://0001-Update-test_sysconfig-for-posix_user-purelib.patch \
26 file://0001-skip-no_stdout_fileno-test-due-to-load-variability.patch \
27 file://0001-test_storlines-skip-due-to-load-variability.patch \
28 file://0001-test_shutdown-skip-problematic-test.patch \
29 file://0001-test_deadlock-skip-problematic-test.patch \
30 file://0001-test_active_children-skip-problematic-test.patch \
31 file://0001-test_readline-skip-limited-history-test.patch \
32 file://0001-Generate-data-for-OpenSSL-3.4-and-add-it-to-multissl.patch \
33 file://0001-ssl-Raise-OSError-for-ERR_LIB_SYS.patch \
34 "
35
36SRC_URI:append:class-native = " \
37 file://0001-Lib-sysconfig.py-use-prefix-value-from-build-configu.patch \
38 "
39
40SRC_URI[sha256sum] = "9cf9427bee9e2242e3877dd0f6b641c1853ca461f39d6503ce260a59c80bf0d9"
41
42# exclude pre-releases for both python 2.x and 3.x
43UPSTREAM_CHECK_REGEX = "[Pp]ython-(?P<pver>\d+(\.\d+)+).tar"
44
45CVE_PRODUCT = "python cpython"
46
47CVE_STATUS[CVE-2007-4559] = "disputed: Upstream consider this expected behaviour"
48CVE_STATUS[CVE-2019-18348] = "not-applicable-config: This is not exploitable when glibc has CVE-2016-10739 fixed"
49CVE_STATUS[CVE-2020-15523] = "not-applicable-platform: Issue only applies on Windows"
50CVE_STATUS[CVE-2022-26488] = "not-applicable-platform: Issue only applies on Windows"
51# The module will be removed in the future and flaws documented.
52CVE_STATUS[CVE-2015-20107] = "upstream-wontfix: The mailcap module is insecure by design, so this can't be fixed in a meaningful way"
53CVE_STATUS[CVE-2023-36632] = "disputed: Not an issue, in fact expected behaviour"
54
55PYTHON_MAJMIN = "3.13"
56
57S = "${WORKDIR}/Python-${PV}"
58
59BBCLASSEXTEND = "native nativesdk"
60
61inherit autotools pkgconfig qemu ptest multilib_header update-alternatives
62
63MULTILIB_SUFFIX = "${@d.getVar('base_libdir',1).split('/')[-1]}"
64
65ALTERNATIVE:${PN}-dev = "python3-config"
66ALTERNATIVE_LINK_NAME[python3-config] = "${bindir}/python${PYTHON_MAJMIN}-config"
67ALTERNATIVE_TARGET[python3-config] = "${bindir}/python${PYTHON_MAJMIN}-config-${MULTILIB_SUFFIX}"
68
69
70DEPENDS = "\
71 autoconf-archive-native \
72 bzip2 \
73 bzip2-replacement-native \
74 expat \
75 libffi \
76 libnsl2 \
77 libtirpc \
78 ncurses \
79 openssl \
80 sqlite3 \
81 util-linux-libuuid \
82 virtual/crypt \
83 virtual/libintl \
84 xz \
85 zlib \
86"
87
88DEPENDS:append:class-target = " python3-native"
89DEPENDS:append:class-nativesdk = " python3-native"
90
91EXTRA_OECONF = " --without-ensurepip --enable-shared --with-platlibdir=${baselib} --with-system-expat"
92EXTRA_OECONF:append:class-native = " --bindir=${bindir}/${PN}"
93EXTRA_OECONF:append:class-target = " --with-build-python=nativepython3"
94EXTRA_OECONF:append:class-nativesdk = " --with-build-python=nativepython3"
95
96export CROSSPYTHONPATH="${STAGING_LIBDIR_NATIVE}/python${PYTHON_MAJMIN}/lib-dynload/"
97
98EXTRANATIVEPATH += "python3-native"
99
100# LTO will be enabled via packageconfig depending upong distro features
101LTO:class-target = ""
102
103CACHED_CONFIGUREVARS = " \
104 ac_cv_file__dev_ptmx=yes \
105 ac_cv_file__dev_ptc=no \
106 ac_cv_working_tzset=yes \
107"
108CACHED_CONFIGUREVARS:append:class-target = " \
109 ac_cv_libatomic_needed=yes \
110"
111
112# set thread stack size to 2MB on musl for interpreter and stdlib C extensions
113# so it does not run into stack limits due to musl's small thread stack
114# This is only needed to build interpreter and not the subsequent modules
115# Thats why CFLAGS_NODIST is modified instead of CFLAGS
116CACHED_CONFIGUREVARS:append:libc-musl = "\
117 CFLAGS_NODIST='${CFLAGS} -DTHREAD_STACK_SIZE=0x200000' \
118"
119
120# PGO currently causes builds to not be reproducible so disable by default, see YOCTO #13407
121PACKAGECONFIG ??= "editline gdbm ${@bb.utils.filter('DISTRO_FEATURES', 'lto', d)}"
122PACKAGECONFIG[readline] = "--with-readline=readline,,readline,,,editline"
123PACKAGECONFIG[editline] = "--with-readline=editline,,libedit,,,readline"
124# Use profile guided optimisation by running PyBench inside qemu-user
125PACKAGECONFIG[pgo] = "--enable-optimizations,,qemu-native"
126PACKAGECONFIG[tk] = ",,tk"
127PACKAGECONFIG[tcl] = ",,tcl"
128PACKAGECONFIG[gdbm] = ",,gdbm"
129PACKAGECONFIG[lto] = "--with-lto,--without-lto"
130PACKAGECONFIG[staticlibpython] = "--with-static-libpython,--without-static-libpython"
131
132do_configure:prepend () {
133 mkdir -p ${B}/Modules
134 cat > ${B}/Modules/Setup.local << EOF
135*disabled*
136${@bb.utils.contains('PACKAGECONFIG', 'gdbm', '', '_gdbm _dbm', d)}
137${@bb.utils.contains_any('PACKAGECONFIG', 'readline editline', '', 'readline', d)}
138${@bb.utils.contains('PACKAGECONFIG', 'tk', '', '_tkinter', d)}
139EOF
140}
141
142CPPFLAGS += "-I${STAGING_INCDIR}/ncursesw -I${STAGING_INCDIR}/uuid"
143
144# COMPILEALL_OPTS= ensures that .pyc are not compiled in parallel
145# This was found to lock up builds, break reproducibility, and produce strange file ownership
146# races.
147#
148# The upstream commit introducing the change was:
149# https://github.com/python/cpython/commit/1a2dd82f56bd813aacc570e172cefe55a8a41504
150#
151# The build lock up issue is reported here:
152# https://bugs.python.org/issue45945
153#
154# The repro failures are documented here:
155# https://autobuilder.yocto.io/pub/repro-fail/oe-reproducible-20211130-yr_o1a8d/packages/diff-html/
156
157EXTRA_OEMAKE = '\
158 STAGING_LIBDIR=${STAGING_LIBDIR} \
159 STAGING_INCDIR=${STAGING_INCDIR} \
160 LIB=${baselib} \
161 COMPILEALL_OPTS= \
162'
163
164# Generate a Profile Guided Optimisation wrapper script that uses qemu-user for
165# all cross builds.
166write_pgo_wrapper:class-native = ":"
167write_pgo_wrapper() {
168 if ${@bb.utils.contains('PACKAGECONFIG', 'pgo', 'true', 'false', d)}; then
169 cat >pgo-wrapper <<EOF
170#!/bin/sh
171cd ${B}
172${@qemu_wrapper_cmdline(d, '${STAGING_DIR_TARGET}', ['${B}', '${STAGING_DIR_TARGET}/${base_libdir}'])} "\$@"
173EOF
174 chmod +x pgo-wrapper
175 fi
176}
177
178do_compile:prepend() {
179 write_pgo_wrapper
180}
181
182do_install:prepend() {
183 ${UNPACKDIR}/check_build_completeness.py ${T}/log.do_compile
184}
185
186do_install:append:class-target() {
187 oe_multilib_header python${PYTHON_MAJMIN}/pyconfig.h
188}
189
190do_install:append:class-native() {
191 # Make sure we use /usr/bin/env python
192 for PYTHSCRIPT in `grep -rIl ${bindir}/${PN}/python ${D}${bindir}/${PN}`; do
193 sed -i -e '1s|^#!.*|#!/usr/bin/env python3|' $PYTHSCRIPT
194 done
195 # Add a symlink to the native Python so that scripts can just invoke
196 # "nativepython" and get the right one without needing absolute paths
197 # (these often end up too long for the #! parser in the kernel as the
198 # buffer is 128 bytes long).
199 ln -s python3-native/python3 ${D}${bindir}/nativepython3
200
201 # Remove the opt-1.pyc and opt-2.pyc files. There are over 3,000 of them
202 # and the overhead in each recipe-sysroot-native isn't worth it, particularly
203 # when they're only used for python called with -O or -OO.
204 #find ${D} -name *opt-*.pyc -delete
205 # Remove all pyc files. There are a ton of them and it is probably faster to let
206 # python create the ones it wants at runtime rather than manage in the sstate
207 # tarballs and sysroot creation.
208 find ${D} -name *.pyc -delete
209
210 # Nothing should be looking into ${B} for python3-native
211 sed -i -e 's:${B}:/build/path/unavailable/:g' \
212 ${D}/${libdir}/python${PYTHON_MAJMIN}/config-${PYTHON_MAJMIN}${PYTHON_ABI}*/Makefile
213
214 # disable the lookup in user's site-packages globally
215 sed -i 's#ENABLE_USER_SITE = None#ENABLE_USER_SITE = False#' ${D}${libdir}/python${PYTHON_MAJMIN}/site.py
216
217 # python3-config needs to be in /usr/bin and not in a subdir of it to work properly
218 mv ${D}/${bindir}/${PN}/python*config ${D}/${bindir}/
219}
220
221do_install:append() {
222 for c in ${D}/${libdir}/python${PYTHON_MAJMIN}/_sysconfigdata*.py; do
223 python3 ${UNPACKDIR}/reformat_sysconfig.py $c
224 done
225 rm -f ${D}${libdir}/python${PYTHON_MAJMIN}/__pycache__/_sysconfigdata*.cpython*
226
227 mkdir -p ${D}${libdir}/python-sysconfigdata
228 sysconfigfile=`find ${D} -name _sysconfig*.py`
229 sed -i \
230 -e "s,^ 'LIBDIR'.*, 'LIBDIR': '${STAGING_LIBDIR}'\,,g" \
231 -e "s,^ 'INCLUDEDIR'.*, 'INCLUDEDIR': '${STAGING_INCDIR}'\,,g" \
232 -e "s,^ 'CONFINCLUDEDIR'.*, 'CONFINCLUDEDIR': '${STAGING_INCDIR}'\,,g" \
233 -e "s,^ 'INCLUDEPY'.*, 'INCLUDEPY': '${STAGING_INCDIR}/python${PYTHON_MAJMIN}'\,,g" \
234 -e "s,^ 'CONFINCLUDEPY'.*, 'CONFINCLUDEPY': '${STAGING_INCDIR}/python${PYTHON_MAJMIN}'\,,g" \
235 -e "s,${B},/build/path/unavailable/,g" \
236 $sysconfigfile
237 cp $sysconfigfile ${D}${libdir}/python-sysconfigdata/_sysconfigdata.py
238
239
240 # Unfortunately the following pyc files are non-deterministc due to 'frozenset'
241 # being written without strict ordering, even with PYTHONHASHSEED = 0
242 # Upstream is discussing ways to solve the issue properly, until then let's
243 # just not install the problematic files.
244 # More info: http://benno.id.au/blog/2013/01/15/python-determinism
245 rm -f ${D}${libdir}/python${PYTHON_MAJMIN}/test/__pycache__/test_range.cpython*
246 rm -f ${D}${libdir}/python${PYTHON_MAJMIN}/test/__pycache__/test_xml_etree.cpython*
247
248 # Similar to the above, we're getting reproducibility issues with
249 # /usr/lib/python3.10/__pycache__/traceback.cpython-310.pyc
250 # so remove it too
251 rm -f ${D}${libdir}/python${PYTHON_MAJMIN}/__pycache__/traceback.cpython*
252
253 # Remove the opt-1.pyc and opt-2.pyc files. They effectively waste space on embedded
254 # style targets as they're only used when python is called with the -O or -OO options
255 # which is rare.
256 find ${D} -name *opt-*.pyc -delete
257}
258
259do_install:append:class-nativesdk () {
260 # Make sure we use /usr/bin/env python
261 for PYTHSCRIPT in `grep -rIl ${bindir}/python ${D}${bindir}`; do
262 sed -i -e '1s|^#!.*|#!/usr/bin/env python3|' $PYTHSCRIPT
263 done
264 create_wrapper ${D}${bindir}/python${PYTHON_MAJMIN} TERMINFO_DIRS='${sysconfdir}/terminfo:/etc/terminfo:/usr/share/terminfo:/usr/share/misc/terminfo:/lib/terminfo' PYTHONNOUSERSITE='1'
265}
266
267do_install_ptest:append:class-target:libc-musl () {
268 sed -i -e 's|SKIPPED_TESTS=|SKIPPED_TESTS="-x test__locale -x test_c_locale_coercion -x test_locale -x test_os test_re -x test__xxsubinterpreters -x test_threading"|' ${D}${PTEST_PATH}/run-ptest
269}
270
271SYSROOT_PREPROCESS_FUNCS:append:class-target = " provide_target_config_script"
272SYSROOT_PREPROCESS_FUNCS:append:class-nativesdk = " provide_target_config_script"
273
274# This is installed into /usr/python-target-config/ and not /usr/bin
275# because adding target sysroot's /usr/bin/ to PATH has unwanted side effects
276# in components erroneously picking up other target executables from it
277provide_target_config_script() {
278 install -d ${SYSROOT_DESTDIR}${prefix}/python-target-config/
279 install ${D}/${bindir}/python3-config ${SYSROOT_DESTDIR}/${prefix}/python-target-config/
280 install ${D}/${bindir}/python${PYTHON_MAJMIN}-config ${SYSROOT_DESTDIR}/${prefix}/python-target-config/
281}
282SYSROOT_DIRS += "${prefix}/python-target-config/"
283
284SSTATE_SCAN_FILES += "Makefile _sysconfigdata.py"
285SSTATE_HASHEQUIV_FILEMAP = " \
286 populate_sysroot:*/lib*/python3*/_sysconfigdata*.py:${TMPDIR} \
287 populate_sysroot:*/lib*/python3*/_sysconfigdata*.py:${COREBASE} \
288 populate_sysroot:*/lib*/python3*/config-*/Makefile:${TMPDIR} \
289 populate_sysroot:*/lib*/python3*/config-*/Makefile:${COREBASE} \
290 populate_sysroot:*/lib*/python-sysconfigdata/_sysconfigdata.py:${TMPDIR} \
291 populate_sysroot:*/lib*/python-sysconfigdata/_sysconfigdata.py:${COREBASE} \
292 "
293PACKAGE_PREPROCESS_FUNCS += "py_package_preprocess"
294
295py_package_preprocess () {
296 # Remove references to buildmachine paths in target Makefile and _sysconfigdata
297 sed -i -e 's:--sysroot=${STAGING_DIR_TARGET}::g' -e s:'--with-libtool-sysroot=${STAGING_DIR_TARGET}'::g \
298 -e 's|${DEBUG_PREFIX_MAP}||g' \
299 -e 's:${HOSTTOOLS_DIR}/::g' \
300 -e 's:${RECIPE_SYSROOT_NATIVE}::g' \
301 -e 's:${RECIPE_SYSROOT}::g' \
302 -e 's:${BASE_WORKDIR}/${MULTIMACH_TARGET_SYS}::g' \
303 ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/config-${PYTHON_MAJMIN}${PYTHON_ABI}*/Makefile \
304 ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/_sysconfigdata*.py \
305 ${PKGD}/${bindir}/python${PYTHON_MAJMIN}-config
306
307 # Reformat _sysconfigdata after modifying it so that it remains
308 # reproducible
309 for c in ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/_sysconfigdata*.py; do
310 python3 ${UNPACKDIR}/reformat_sysconfig.py $c
311 done
312
313 # Recompile _sysconfigdata after modifying it
314 cd ${PKGD}
315 sysconfigfile=`find . -name _sysconfigdata_*.py`
316 ${STAGING_BINDIR_NATIVE}/python3-native/python3 \
317 -c "from py_compile import compile; compile('$sysconfigfile')"
318 ${STAGING_BINDIR_NATIVE}/python3-native/python3 \
319 -c "from py_compile import compile; compile('$sysconfigfile', optimize=1)"
320 ${STAGING_BINDIR_NATIVE}/python3-native/python3 \
321 -c "from py_compile import compile; compile('$sysconfigfile', optimize=2)"
322 cd -
323
324 mv ${PKGD}/${bindir}/python${PYTHON_MAJMIN}-config ${PKGD}/${bindir}/python${PYTHON_MAJMIN}-config-${MULTILIB_SUFFIX}
325
326 #Remove the unneeded copy of target sysconfig data
327 rm -rf ${PKGD}/${libdir}/python-sysconfigdata
328}
329
330# We want bytecode precompiled .py files (.pyc's) by default
331# but the user may set it on their own conf
332INCLUDE_PYCS ?= "1"
333
334python(){
335 import collections, json
336
337 filename = os.path.join(d.getVar('THISDIR'), 'python3', 'python3-manifest.json')
338 # This python changes the datastore based on the contents of a file, so mark
339 # that dependency.
340 bb.parse.mark_dependency(d, filename)
341
342 with open(filename) as manifest_file:
343 manifest_str = manifest_file.read()
344 json_start = manifest_str.find('# EOC') + 6
345 manifest_file.seek(json_start)
346 manifest_str = manifest_file.read()
347 python_manifest = json.loads(manifest_str, object_pairs_hook=collections.OrderedDict)
348
349 # First set RPROVIDES for -native case
350 # Hardcoded since it cant be python3-native-foo, should be python3-foo-native
351 pn = 'python3'
352 rprovides = (d.getVar('RPROVIDES') or "").split()
353
354 # ${PN}-misc-native is not in the manifest
355 rprovides.append(pn + '-misc-native')
356
357 for key in python_manifest:
358 pypackage = pn + '-' + key + '-native'
359 if pypackage not in rprovides:
360 rprovides.append(pypackage)
361
362 d.setVar('RPROVIDES:class-native', ' '.join(rprovides))
363
364 # Then work on the target
365 include_pycs = d.getVar('INCLUDE_PYCS')
366
367 packages = d.getVar('PACKAGES').split()
368 pn = d.getVar('PN')
369
370 newpackages=[]
371 for key in python_manifest:
372 pypackage = pn + '-' + key
373
374 if pypackage not in packages:
375 # We need to prepend, otherwise python-misc gets everything
376 # so we use a new variable
377 newpackages.append(pypackage)
378
379 # "Build" python's manifest FILES, RDEPENDS and SUMMARY
380 for value in python_manifest[key]['files']:
381 d.appendVar('FILES:' + pypackage, ' ' + value)
382
383 # Add cached files
384 if include_pycs == '1':
385 for value in python_manifest[key]['cached']:
386 d.appendVar('FILES:' + pypackage, ' ' + value)
387
388 for value in python_manifest[key]['rdepends']:
389 # Make it work with or without $PN
390 if '${PN}' in value:
391 value=value.split('-', 1)[1]
392 d.appendVar('RDEPENDS:' + pypackage, ' ' + pn + '-' + value)
393
394 for value in python_manifest[key].get('rrecommends', ()):
395 if '${PN}' in value:
396 value=value.split('-', 1)[1]
397 d.appendVar('RRECOMMENDS:' + pypackage, ' ' + pn + '-' + value)
398
399 d.setVar('SUMMARY:' + pypackage, python_manifest[key]['summary'])
400
401 # Prepending so to avoid python-misc getting everything
402 packages = newpackages + packages
403 d.setVar('PACKAGES', ' '.join(packages))
404 d.setVar('ALLOW_EMPTY:${PN}-fcntl', '1')
405 d.setVar('ALLOW_EMPTY:${PN}-modules', '1')
406 d.setVar('ALLOW_EMPTY:${PN}-pkgutil', '1')
407
408 if "pgo" in d.getVar("PACKAGECONFIG").split() and not bb.utils.contains('MACHINE_FEATURES', 'qemu-usermode', True, False, d):
409 bb.fatal("pgo cannot be enabled as there is no qemu-usermode support for this architecture/machine")
410}
411
412# Files needed to create a new manifest
413
414do_create_manifest() {
415 # This task should be run with every new release of Python.
416 # We must ensure that PACKAGECONFIG enables everything when creating
417 # a new manifest, this is to base our new manifest on a complete
418 # native python build, containing all dependencies, otherwise the task
419 # wont be able to find the required files.
420 # e.g. BerkeleyDB is an optional build dependency so it may or may not
421 # be present, we must ensure it is.
422
423 cp ${UNPACKDIR}/create_manifest3.py ${WORKDIR}
424 cp ${UNPACKDIR}/python3-manifest.json ${WORKDIR}
425 cp ${UNPACKDIR}/get_module_deps3.py ${WORKDIR}
426 cd ${WORKDIR}
427 # This needs to be executed by python-native and NOT by HOST's python
428 nativepython3 create_manifest3.py ${PYTHON_MAJMIN}
429 cp python3-manifest.json.new ${THISDIR}/python3/python3-manifest.json
430}
431
432# bitbake python -c create_manifest
433# Make sure we have native python ready when we create a new manifest
434addtask do_create_manifest after do_patch do_prepare_recipe_sysroot
435
436# manual dependency additions
437RRECOMMENDS:${PN}-core:append:class-nativesdk = " nativesdk-python3-modules"
438RRECOMMENDS:${PN}-crypt:append:class-target = " ${MLPREFIX}openssl ${MLPREFIX}ca-certificates"
439RRECOMMENDS:${PN}-crypt:append:class-nativesdk = " ${MLPREFIX}openssl ${MLPREFIX}ca-certificates"
440
441# For historical reasons PN is empty and provided by python3-modules
442FILES:${PN} = ""
443RPROVIDES:${PN}-modules = "${PN}"
444
445FILES:${PN}-pydoc += "${bindir}/pydoc${PYTHON_MAJMIN} ${bindir}/pydoc3"
446FILES:${PN}-idle += "${bindir}/idle3 ${bindir}/idle${PYTHON_MAJMIN}"
447FILES:${PN}-tkinter += "${libdir}/python${PYTHON_MAJMIN}/lib-dynload/_tkinter.*.so"
448
449# provide python-pyvenv from python3-venv
450RPROVIDES:${PN}-venv += "${MLPREFIX}python3-pyvenv"
451
452# package libpython3
453PACKAGES =+ "libpython3 libpython3-staticdev"
454FILES:libpython3 = "${libdir}/libpython*.so.*"
455FILES:libpython3-staticdev += "${libdir}/python${PYTHON_MAJMIN}/config-${PYTHON_MAJMIN}-*/libpython${PYTHON_MAJMIN}.a"
456INSANE_SKIP:${PN}-dev += "dev-elf"
457INSANE_SKIP:${PN}-ptest = "dev-deps"
458
459# catch all the rest (unsorted)
460PACKAGES += "${PN}-misc"
461RDEPENDS:${PN}-misc += "\
462 ${PN}-audio \
463 ${PN}-codecs \
464 ${PN}-core \
465 ${PN}-email \
466 ${PN}-numbers \
467 ${PN}-pickle \
468 ${PN}-pydoc \
469"
470RDEPENDS:${PN}-modules:append:class-target = " ${MLPREFIX}python3-misc"
471RDEPENDS:${PN}-modules:append:class-nativesdk = " ${MLPREFIX}python3-misc"
472RDEPENDS:${PN}-modules:append:class-target = " ${@bb.utils.contains('PACKAGECONFIG', 'gdbm', '${MLPREFIX}python3-gdbm', '', d)}"
473FILES:${PN}-misc = "${libdir}/python${PYTHON_MAJMIN} ${libdir}/python${PYTHON_MAJMIN}/lib-dynload"
474
475# catch manpage
476PACKAGES += "${PN}-man"
477FILES:${PN}-man = "${datadir}/man"
478
479# See https://bugs.python.org/issue18748 and https://bugs.python.org/issue37395
480RDEPENDS:libpython3:append:libc-glibc = " libgcc"
481RDEPENDS:${PN}-ctypes:append:libc-glibc = "\
482 ${@bb.utils.contains('DISTRO_FEATURES', 'ldconfig', '${MLPREFIX}ldconfig', '', d)} \
483"
484RDEPENDS:${PN}-ptest = "\
485 ${PN}-dev \
486 ${PN}-modules \
487 ${PN}-tests \
488 ${PN}-zipapp \
489 binutils \
490 bzip2 \
491 coreutils \
492 gcc \
493 gcc-symlinks \
494 g++ \
495 libgcc \
496 locale-base-fr-fr \
497 locale-base-en-us \
498 locale-base-de-de \
499 sed \
500 tzdata \
501 unzip \
502"
503RDEPENDS:${PN}-ptest:append:libc-glibc = " locale-base-tr-tr"
504RDEPENDS:${PN}-tkinter += "${@bb.utils.contains('PACKAGECONFIG', 'tk', '${MLPREFIX}tk ${MLPREFIX}tk-lib', '', d)}"
505RDEPENDS:${PN}-idle += "${@bb.utils.contains('PACKAGECONFIG', 'tk', '${PN}-tkinter ${MLPREFIX}tcl', '', d)}"
506DEV_PKG_DEPENDENCY = ""
507RDEPENDS:${PN}-pydoc += "${PN}-io"
508
509RDEPENDS:${PN}-tests:append:class-target = " ${MLPREFIX}bash"
510RDEPENDS:${PN}-tests:append:class-nativesdk = " ${MLPREFIX}bash"
511
512# Python's tests contain large numbers of files we don't need in the recipe sysroots
513SYSROOT_PREPROCESS_FUNCS += " py3_sysroot_cleanup"
514py3_sysroot_cleanup () {
515 rm -rf ${SYSROOT_DESTDIR}${libdir}/python${PYTHON_MAJMIN}/test
516}