summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/python/python3_3.12.11.bb
diff options
context:
space:
mode:
authorPeter Marko <peter.marko@siemens.com>2025-06-08 23:43:27 +0200
committerSteve Sakoman <steve@sakoman.com>2025-06-13 08:58:01 -0700
commitc4f82e3fd561ac83c8c836e43d701cff36ca2f42 (patch)
tree27711273b06a4a06364b1e56b0392f3df8a1856d /meta/recipes-devtools/python/python3_3.12.11.bb
parent82e8f8c2e08c48229154ce3fbc599e4112b72d58 (diff)
downloadpoky-c4f82e3fd561ac83c8c836e43d701cff36ca2f42.tar.gz
python3: upgrade 3.12.9 -> 3.12.11
Drop upstreamed patch and refresh remaining patches. * https://www.python.org/downloads/release/python-31210/ Python 3.12.10 is the latest maintenance release of Python 3.12, and the last full maintenance release. Subsequent releases of 3.12 will be security-fixes only. * https://www.python.org/downloads/release/python-31211/ Security content in this release * gh-135034: [CVE 2024-12718] [CVE 2025-4138] [CVE 2025-4330] [CVE 2025-4435] [CVE 2025-4517] Fixes multiple issues that allowed tarfile extraction filters (filter="data" and filter="tar") to be bypassed using crafted symlinks and hard links. * gh-133767: Fix use-after-free in the “unicode-escape” decoder with a non-“strict” error handler. * gh-128840: Short-circuit the processing of long IPv6 addresses early in ipaddress to prevent excessive memory consumption and a minor denial-of-service. gh-133767 got meawhile CVE-2025-4516 assigned. (From OE-Core rev: 6cca08b2857efd5481e837ecd6bb295cb8a99ee1) Signed-off-by: Peter Marko <peter.marko@siemens.com> Signed-off-by: Steve Sakoman <steve@sakoman.com>
Diffstat (limited to 'meta/recipes-devtools/python/python3_3.12.11.bb')
-rw-r--r--meta/recipes-devtools/python/python3_3.12.11.bb474
1 files changed, 474 insertions, 0 deletions
diff --git a/meta/recipes-devtools/python/python3_3.12.11.bb b/meta/recipes-devtools/python/python3_3.12.11.bb
new file mode 100644
index 0000000000..706dabb5cd
--- /dev/null
+++ b/meta/recipes-devtools/python/python3_3.12.11.bb
@@ -0,0 +1,474 @@
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=fcf6b249c2641540219a727f35d8d2c2"
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://cgi_py.patch \
17 file://0001-Makefile.pre-use-qemu-wrapper-when-gathering-profile.patch \
18 file://0001-python3-use-cc_basename-to-replace-CC-for-checking-c.patch \
19 file://crosspythonpath.patch \
20 file://0001-test_locale.py-correct-the-test-output-format.patch \
21 file://0020-configure.ac-setup.py-do-not-add-a-curses-include-pa.patch \
22 file://0001-Skip-failing-tests-due-to-load-variability-on-YP-AB.patch \
23 file://0001-test_ctypes.test_find-skip-without-tools-sdk.patch \
24 file://makerace.patch \
25 file://0001-sysconfig.py-use-platlibdir-also-for-purelib.patch \
26 file://0001-Lib-pty.py-handle-stdin-I-O-errors-same-way-as-maste.patch \
27 file://deterministic_imports.patch \
28 file://0001-Avoid-shebang-overflow-on-python-config.py.patch \
29 file://0001-Update-test_sysconfig-for-posix_user-purelib.patch \
30 file://0001-skip-no_stdout_fileno-test-due-to-load-variability.patch \
31 file://0001-test_storlines-skip-due-to-load-variability.patch \
32 file://0001-test_shutdown-skip-problematic-test.patch \
33 file://0001-gh-107811-tarfile-treat-overflow-in-UID-GID-as-failu.patch \
34 file://0001-test_deadlock-skip-problematic-test.patch \
35 file://0001-test_active_children-skip-problematic-test.patch \
36 file://0001-test_readline-skip-limited-history-test.patch \
37 "
38
39SRC_URI:append:class-native = " \
40 file://0001-Lib-sysconfig.py-use-prefix-value-from-build-configu.patch \
41 "
42
43SRC_URI[sha256sum] = "c30bb24b7f1e9a19b11b55a546434f74e739bb4c271a3e3a80ff4380d49f7adb"
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 cpython"
49
50CVE_STATUS[CVE-2007-4559] = "disputed: Upstream consider this expected behaviour"
51CVE_STATUS[CVE-2019-18348] = "not-applicable-config: This is not exploitable when glibc has CVE-2016-10739 fixed"
52CVE_STATUS[CVE-2020-15523] = "not-applicable-platform: Issue only applies on Windows"
53CVE_STATUS[CVE-2022-26488] = "not-applicable-platform: Issue only applies on Windows"
54# The module will be removed in the future and flaws documented.
55CVE_STATUS[CVE-2015-20107] = "upstream-wontfix: The mailcap module is insecure by design, so this can't be fixed in a meaningful way"
56CVE_STATUS[CVE-2023-36632] = "disputed: Not an issue, in fact expected behaviour"
57
58PYTHON_MAJMIN = "3.12"
59
60S = "${WORKDIR}/Python-${PV}"
61
62BBCLASSEXTEND = "native nativesdk"
63
64inherit autotools pkgconfig qemu ptest multilib_header update-alternatives
65
66MULTILIB_SUFFIX = "${@d.getVar('base_libdir',1).split('/')[-1]}"
67
68ALTERNATIVE:${PN}-dev = "python3-config"
69ALTERNATIVE_LINK_NAME[python3-config] = "${bindir}/python${PYTHON_MAJMIN}-config"
70ALTERNATIVE_TARGET[python3-config] = "${bindir}/python${PYTHON_MAJMIN}-config-${MULTILIB_SUFFIX}"
71
72
73DEPENDS = "bzip2-replacement-native expat libffi bzip2 openssl sqlite3 zlib virtual/libintl xz virtual/crypt util-linux-libuuid libtirpc libnsl2 autoconf-archive-native ncurses"
74DEPENDS:append:class-target = " python3-native"
75DEPENDS:append:class-nativesdk = " python3-native"
76
77EXTRA_OECONF = " --without-ensurepip --enable-shared --with-platlibdir=${baselib} --with-system-expat"
78EXTRA_OECONF:append:class-native = " --bindir=${bindir}/${PN}"
79EXTRA_OECONF:append:class-target = " --with-build-python=nativepython3"
80EXTRA_OECONF:append:class-nativesdk = " --with-build-python=nativepython3"
81
82export CROSSPYTHONPATH="${STAGING_LIBDIR_NATIVE}/python${PYTHON_MAJMIN}/lib-dynload/"
83
84EXTRANATIVEPATH += "python3-native"
85
86# LTO will be enabled via packageconfig depending upong distro features
87LTO:class-target = ""
88
89CACHED_CONFIGUREVARS = " \
90 ac_cv_file__dev_ptmx=yes \
91 ac_cv_file__dev_ptc=no \
92 ac_cv_working_tzset=yes \
93"
94# set thread stack size to 2MB on musl for interpreter and stdlib C extensions
95# so it does not run into stack limits due to musl's small thread stack
96# This is only needed to build interpreter and not the subsequent modules
97# Thats why CFLAGS_NODIST is modified instead of CFLAGS
98CACHED_CONFIGUREVARS:append:libc-musl = "\
99 CFLAGS_NODIST='${CFLAGS} -DTHREAD_STACK_SIZE=0x200000' \
100"
101
102# PGO currently causes builds to not be reproducible so disable by default, see YOCTO #13407
103PACKAGECONFIG ??= "editline gdbm ${@bb.utils.filter('DISTRO_FEATURES', 'lto', d)}"
104PACKAGECONFIG[readline] = "--with-readline=readline,,readline,,,editline"
105PACKAGECONFIG[editline] = "--with-readline=editline,,libedit,,,readline"
106# Use profile guided optimisation by running PyBench inside qemu-user
107PACKAGECONFIG[pgo] = "--enable-optimizations,,qemu-native"
108PACKAGECONFIG[tk] = ",,tk"
109PACKAGECONFIG[tcl] = ",,tcl"
110PACKAGECONFIG[gdbm] = ",,gdbm"
111PACKAGECONFIG[lto] = "--with-lto,--without-lto"
112
113do_configure:prepend () {
114 mkdir -p ${B}/Modules
115 cat > ${B}/Modules/Setup.local << EOF
116*disabled*
117${@bb.utils.contains('PACKAGECONFIG', 'gdbm', '', '_gdbm _dbm', d)}
118${@bb.utils.contains_any('PACKAGECONFIG', 'readline editline', '', 'readline', d)}
119${@bb.utils.contains('PACKAGECONFIG', 'tk', '', '_tkinter', d)}
120EOF
121}
122
123CPPFLAGS:append = " -I${STAGING_INCDIR}/ncursesw -I${STAGING_INCDIR}/uuid"
124
125# COMPILEALL_OPTS= ensures that .pyc are not compiled in parallel
126# This was found to lock up builds, break reproducibility, and produce strange file ownership
127# races.
128#
129# The upstream commit introducing the change was:
130# https://github.com/python/cpython/commit/1a2dd82f56bd813aacc570e172cefe55a8a41504
131#
132# The build lock up issue is reported here:
133# https://bugs.python.org/issue45945
134#
135# The repro failures are documented here:
136# https://autobuilder.yocto.io/pub/repro-fail/oe-reproducible-20211130-yr_o1a8d/packages/diff-html/
137
138EXTRA_OEMAKE = '\
139 STAGING_LIBDIR=${STAGING_LIBDIR} \
140 STAGING_INCDIR=${STAGING_INCDIR} \
141 LIB=${baselib} \
142 COMPILEALL_OPTS= \
143'
144
145# Generate a Profile Guided Optimisation wrapper script that uses qemu-user for
146# all cross builds.
147write_pgo_wrapper:class-native = ":"
148write_pgo_wrapper() {
149 if ${@bb.utils.contains('PACKAGECONFIG', 'pgo', 'true', 'false', d)}; then
150 cat >pgo-wrapper <<EOF
151#!/bin/sh
152cd ${B}
153${@qemu_wrapper_cmdline(d, '${STAGING_DIR_TARGET}', ['${B}', '${STAGING_DIR_TARGET}/${base_libdir}'])} "\$@"
154EOF
155 chmod +x pgo-wrapper
156 fi
157}
158
159do_compile:prepend() {
160 write_pgo_wrapper
161}
162
163do_install:prepend() {
164 ${WORKDIR}/check_build_completeness.py ${T}/log.do_compile
165}
166
167do_install:append:class-target() {
168 oe_multilib_header python${PYTHON_MAJMIN}/pyconfig.h
169}
170
171do_install:append:class-native() {
172 # Make sure we use /usr/bin/env python
173 for PYTHSCRIPT in `grep -rIl ${bindir}/${PN}/python ${D}${bindir}/${PN}`; do
174 sed -i -e '1s|^#!.*|#!/usr/bin/env python3|' $PYTHSCRIPT
175 done
176 # Add a symlink to the native Python so that scripts can just invoke
177 # "nativepython" and get the right one without needing absolute paths
178 # (these often end up too long for the #! parser in the kernel as the
179 # buffer is 128 bytes long).
180 ln -s python3-native/python3 ${D}${bindir}/nativepython3
181
182 # Remove the opt-1.pyc and opt-2.pyc files. There are over 3,000 of them
183 # and the overhead in each recipe-sysroot-native isn't worth it, particularly
184 # when they're only used for python called with -O or -OO.
185 #find ${D} -name *opt-*.pyc -delete
186 # Remove all pyc files. There are a ton of them and it is probably faster to let
187 # python create the ones it wants at runtime rather than manage in the sstate
188 # tarballs and sysroot creation.
189 find ${D} -name *.pyc -delete
190
191 # Nothing should be looking into ${B} for python3-native
192 sed -i -e 's:${B}:/build/path/unavailable/:g' \
193 ${D}/${libdir}/python${PYTHON_MAJMIN}/config-${PYTHON_MAJMIN}${PYTHON_ABI}*/Makefile
194
195 # disable the lookup in user's site-packages globally
196 sed -i 's#ENABLE_USER_SITE = None#ENABLE_USER_SITE = False#' ${D}${libdir}/python${PYTHON_MAJMIN}/site.py
197
198 # python3-config needs to be in /usr/bin and not in a subdir of it to work properly
199 mv ${D}/${bindir}/${PN}/python*config ${D}/${bindir}/
200}
201
202do_install:append() {
203 for c in ${D}/${libdir}/python${PYTHON_MAJMIN}/_sysconfigdata*.py; do
204 python3 ${WORKDIR}/reformat_sysconfig.py $c
205 done
206 rm -f ${D}${libdir}/python${PYTHON_MAJMIN}/__pycache__/_sysconfigdata*.cpython*
207
208 mkdir -p ${D}${libdir}/python-sysconfigdata
209 sysconfigfile=`find ${D} -name _sysconfig*.py`
210 sed -i \
211 -e "s,^ 'LIBDIR'.*, 'LIBDIR': '${STAGING_LIBDIR}'\,,g" \
212 -e "s,^ 'INCLUDEDIR'.*, 'INCLUDEDIR': '${STAGING_INCDIR}'\,,g" \
213 -e "s,^ 'CONFINCLUDEDIR'.*, 'CONFINCLUDEDIR': '${STAGING_INCDIR}'\,,g" \
214 -e "s,^ 'INCLUDEPY'.*, 'INCLUDEPY': '${STAGING_INCDIR}/python${PYTHON_MAJMIN}'\,,g" \
215 -e "s,^ 'CONFINCLUDEPY'.*, 'CONFINCLUDEPY': '${STAGING_INCDIR}/python${PYTHON_MAJMIN}'\,,g" \
216 -e "s,${B},/build/path/unavailable/,g" \
217 $sysconfigfile
218 cp $sysconfigfile ${D}${libdir}/python-sysconfigdata/_sysconfigdata.py
219
220
221 # Unfortunately the following pyc files are non-deterministc due to 'frozenset'
222 # being written without strict ordering, even with PYTHONHASHSEED = 0
223 # Upstream is discussing ways to solve the issue properly, until then let's
224 # just not install the problematic files.
225 # More info: http://benno.id.au/blog/2013/01/15/python-determinism
226 rm -f ${D}${libdir}/python${PYTHON_MAJMIN}/test/__pycache__/test_range.cpython*
227 rm -f ${D}${libdir}/python${PYTHON_MAJMIN}/test/__pycache__/test_xml_etree.cpython*
228
229 # Similar to the above, we're getting reproducibility issues with
230 # /usr/lib/python3.10/__pycache__/traceback.cpython-310.pyc
231 # so remove it too
232 rm -f ${D}${libdir}/python${PYTHON_MAJMIN}/__pycache__/traceback.cpython*
233
234 # Remove the opt-1.pyc and opt-2.pyc files. They effectively waste space on embedded
235 # style targets as they're only used when python is called with the -O or -OO options
236 # which is rare.
237 find ${D} -name *opt-*.pyc -delete
238}
239
240do_install:append:class-nativesdk () {
241 # Make sure we use /usr/bin/env python
242 for PYTHSCRIPT in `grep -rIl ${bindir}/python ${D}${bindir}`; do
243 sed -i -e '1s|^#!.*|#!/usr/bin/env python3|' $PYTHSCRIPT
244 done
245 create_wrapper ${D}${bindir}/python${PYTHON_MAJMIN} TERMINFO_DIRS='${sysconfdir}/terminfo:/etc/terminfo:/usr/share/terminfo:/usr/share/misc/terminfo:/lib/terminfo' PYTHONNOUSERSITE='1'
246}
247
248do_install_ptest:append:class-target:libc-musl () {
249 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
250}
251
252SYSROOT_PREPROCESS_FUNCS:append:class-target = " provide_target_config_script"
253SYSROOT_PREPROCESS_FUNCS:append:class-nativesdk = " provide_target_config_script"
254
255# This is installed into /usr/python-target-config/ and not /usr/bin
256# because adding target sysroot's /usr/bin/ to PATH has unwanted side effects
257# in components erroneously picking up other target executables from it
258provide_target_config_script() {
259 install -d ${SYSROOT_DESTDIR}${prefix}/python-target-config/
260 install ${D}/${bindir}/python3-config ${SYSROOT_DESTDIR}/${prefix}/python-target-config/
261 install ${D}/${bindir}/python${PYTHON_MAJMIN}-config ${SYSROOT_DESTDIR}/${prefix}/python-target-config/
262}
263SYSROOT_DIRS += "${prefix}/python-target-config/"
264
265SSTATE_SCAN_FILES += "Makefile _sysconfigdata.py"
266SSTATE_HASHEQUIV_FILEMAP = " \
267 populate_sysroot:*/lib*/python3*/_sysconfigdata*.py:${TMPDIR} \
268 populate_sysroot:*/lib*/python3*/_sysconfigdata*.py:${COREBASE} \
269 populate_sysroot:*/lib*/python3*/config-*/Makefile:${TMPDIR} \
270 populate_sysroot:*/lib*/python3*/config-*/Makefile:${COREBASE} \
271 populate_sysroot:*/lib*/python-sysconfigdata/_sysconfigdata.py:${TMPDIR} \
272 populate_sysroot:*/lib*/python-sysconfigdata/_sysconfigdata.py:${COREBASE} \
273 "
274PACKAGE_PREPROCESS_FUNCS += "py_package_preprocess"
275
276py_package_preprocess () {
277 # Remove references to buildmachine paths in target Makefile and _sysconfigdata
278 sed -i -e 's:--sysroot=${STAGING_DIR_TARGET}::g' -e s:'--with-libtool-sysroot=${STAGING_DIR_TARGET}'::g \
279 -e 's|${DEBUG_PREFIX_MAP}||g' \
280 -e 's:${HOSTTOOLS_DIR}/::g' \
281 -e 's:${RECIPE_SYSROOT_NATIVE}::g' \
282 -e 's:${RECIPE_SYSROOT}::g' \
283 -e 's:${BASE_WORKDIR}/${MULTIMACH_TARGET_SYS}::g' \
284 ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/config-${PYTHON_MAJMIN}${PYTHON_ABI}*/Makefile \
285 ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/_sysconfigdata*.py \
286 ${PKGD}/${bindir}/python${PYTHON_MAJMIN}-config
287
288 # Reformat _sysconfigdata after modifying it so that it remains
289 # reproducible
290 for c in ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/_sysconfigdata*.py; do
291 python3 ${WORKDIR}/reformat_sysconfig.py $c
292 done
293
294 # Recompile _sysconfigdata after modifying it
295 cd ${PKGD}
296 sysconfigfile=`find . -name _sysconfigdata_*.py`
297 ${STAGING_BINDIR_NATIVE}/python3-native/python3 \
298 -c "from py_compile import compile; compile('$sysconfigfile')"
299 ${STAGING_BINDIR_NATIVE}/python3-native/python3 \
300 -c "from py_compile import compile; compile('$sysconfigfile', optimize=1)"
301 ${STAGING_BINDIR_NATIVE}/python3-native/python3 \
302 -c "from py_compile import compile; compile('$sysconfigfile', optimize=2)"
303 cd -
304
305 mv ${PKGD}/${bindir}/python${PYTHON_MAJMIN}-config ${PKGD}/${bindir}/python${PYTHON_MAJMIN}-config-${MULTILIB_SUFFIX}
306
307 #Remove the unneeded copy of target sysconfig data
308 rm -rf ${PKGD}/${libdir}/python-sysconfigdata
309}
310
311# We want bytecode precompiled .py files (.pyc's) by default
312# but the user may set it on their own conf
313INCLUDE_PYCS ?= "1"
314
315python(){
316 import collections, json
317
318 filename = os.path.join(d.getVar('THISDIR'), 'python3', 'python3-manifest.json')
319 # This python changes the datastore based on the contents of a file, so mark
320 # that dependency.
321 bb.parse.mark_dependency(d, filename)
322
323 with open(filename) as manifest_file:
324 manifest_str = manifest_file.read()
325 json_start = manifest_str.find('# EOC') + 6
326 manifest_file.seek(json_start)
327 manifest_str = manifest_file.read()
328 python_manifest = json.loads(manifest_str, object_pairs_hook=collections.OrderedDict)
329
330 # First set RPROVIDES for -native case
331 # Hardcoded since it cant be python3-native-foo, should be python3-foo-native
332 pn = 'python3'
333 rprovides = (d.getVar('RPROVIDES') or "").split()
334
335 # ${PN}-misc-native is not in the manifest
336 rprovides.append(pn + '-misc-native')
337
338 for key in python_manifest:
339 pypackage = pn + '-' + key + '-native'
340 if pypackage not in rprovides:
341 rprovides.append(pypackage)
342
343 d.setVar('RPROVIDES:class-native', ' '.join(rprovides))
344
345 # Then work on the target
346 include_pycs = d.getVar('INCLUDE_PYCS')
347
348 packages = d.getVar('PACKAGES').split()
349 pn = d.getVar('PN')
350
351 newpackages=[]
352 for key in python_manifest:
353 pypackage = pn + '-' + key
354
355 if pypackage not in packages:
356 # We need to prepend, otherwise python-misc gets everything
357 # so we use a new variable
358 newpackages.append(pypackage)
359
360 # "Build" python's manifest FILES, RDEPENDS and SUMMARY
361 d.setVar('FILES:' + pypackage, '')
362 for value in python_manifest[key]['files']:
363 d.appendVar('FILES:' + pypackage, ' ' + value)
364
365 # Add cached files
366 if include_pycs == '1':
367 for value in python_manifest[key]['cached']:
368 d.appendVar('FILES:' + pypackage, ' ' + value)
369
370 for value in python_manifest[key]['rdepends']:
371 # Make it work with or without $PN
372 if '${PN}' in value:
373 value=value.split('-', 1)[1]
374 d.appendVar('RDEPENDS:' + pypackage, ' ' + pn + '-' + value)
375
376 for value in python_manifest[key].get('rrecommends', ()):
377 if '${PN}' in value:
378 value=value.split('-', 1)[1]
379 d.appendVar('RRECOMMENDS:' + pypackage, ' ' + pn + '-' + value)
380
381 d.setVar('SUMMARY:' + pypackage, python_manifest[key]['summary'])
382
383 # Prepending so to avoid python-misc getting everything
384 packages = newpackages + packages
385 d.setVar('PACKAGES', ' '.join(packages))
386 d.setVar('ALLOW_EMPTY:${PN}-modules', '1')
387 d.setVar('ALLOW_EMPTY:${PN}-pkgutil', '1')
388
389 if "pgo" in d.getVar("PACKAGECONFIG").split() and not bb.utils.contains('MACHINE_FEATURES', 'qemu-usermode', True, False, d):
390 bb.fatal("pgo cannot be enabled as there is no qemu-usermode support for this architecture/machine")
391}
392
393# Files needed to create a new manifest
394
395do_create_manifest() {
396 # This task should be run with every new release of Python.
397 # We must ensure that PACKAGECONFIG enables everything when creating
398 # a new manifest, this is to base our new manifest on a complete
399 # native python build, containing all dependencies, otherwise the task
400 # wont be able to find the required files.
401 # e.g. BerkeleyDB is an optional build dependency so it may or may not
402 # be present, we must ensure it is.
403
404 cd ${WORKDIR}
405 # This needs to be executed by python-native and NOT by HOST's python
406 nativepython3 create_manifest3.py ${PYTHON_MAJMIN}
407 cp python3-manifest.json.new ${THISDIR}/python3/python3-manifest.json
408}
409
410# bitbake python -c create_manifest
411# Make sure we have native python ready when we create a new manifest
412addtask do_create_manifest after do_patch do_prepare_recipe_sysroot
413
414# manual dependency additions
415RRECOMMENDS:${PN}-core:append:class-nativesdk = " nativesdk-python3-modules"
416RRECOMMENDS:${PN}-crypt:append:class-target = " ${MLPREFIX}openssl ${MLPREFIX}ca-certificates"
417RRECOMMENDS:${PN}-crypt:append:class-nativesdk = " ${MLPREFIX}openssl ${MLPREFIX}ca-certificates"
418
419# For historical reasons PN is empty and provided by python3-modules
420FILES:${PN} = ""
421RPROVIDES:${PN}-modules = "${PN}"
422
423FILES:${PN}-pydoc += "${bindir}/pydoc${PYTHON_MAJMIN} ${bindir}/pydoc3"
424FILES:${PN}-idle += "${bindir}/idle3 ${bindir}/idle${PYTHON_MAJMIN}"
425
426# provide python-pyvenv from python3-venv
427RPROVIDES:${PN}-venv += "${MLPREFIX}python3-pyvenv"
428
429# package libpython3
430PACKAGES =+ "libpython3 libpython3-staticdev"
431FILES:libpython3 = "${libdir}/libpython*.so.*"
432FILES:libpython3-staticdev += "${libdir}/python${PYTHON_MAJMIN}/config-${PYTHON_MAJMIN}-*/libpython${PYTHON_MAJMIN}.a"
433INSANE_SKIP:${PN}-dev += "dev-elf"
434INSANE_SKIP:${PN}-ptest = "dev-deps"
435
436# catch all the rest (unsorted)
437PACKAGES += "${PN}-misc"
438RDEPENDS:${PN}-misc += "\
439 ${PN}-audio \
440 ${PN}-codecs \
441 ${PN}-core \
442 ${PN}-email \
443 ${PN}-numbers \
444 ${PN}-pickle \
445 ${PN}-pydoc \
446"
447RDEPENDS:${PN}-modules:append:class-target = " ${MLPREFIX}python3-misc"
448RDEPENDS:${PN}-modules:append:class-nativesdk = " ${MLPREFIX}python3-misc"
449RDEPENDS:${PN}-modules:append:class-target = " ${@bb.utils.contains('PACKAGECONFIG', 'gdbm', '${MLPREFIX}python3-gdbm', '', d)}"
450FILES:${PN}-misc = "${libdir}/python${PYTHON_MAJMIN} ${libdir}/python${PYTHON_MAJMIN}/lib-dynload"
451
452# catch manpage
453PACKAGES += "${PN}-man"
454FILES:${PN}-man = "${datadir}/man"
455
456# See https://bugs.python.org/issue18748 and https://bugs.python.org/issue37395
457RDEPENDS:libpython3:append:libc-glibc = " libgcc"
458RDEPENDS:${PN}-ctypes:append:libc-glibc = " ${MLPREFIX}ldconfig"
459RDEPENDS:${PN}-ptest = "${PN}-modules ${PN}-tests ${PN}-dev ${PN}-cgitb ${PN}-zipapp unzip bzip2 libgcc tzdata coreutils sed gcc g++ binutils \
460 locale-base-fr-fr locale-base-en-us locale-base-de-de"
461RDEPENDS:${PN}-ptest:append:libc-glibc = " locale-base-tr-tr"
462RDEPENDS:${PN}-tkinter += "${@bb.utils.contains('PACKAGECONFIG', 'tk', '${MLPREFIX}tk ${MLPREFIX}tk-lib', '', d)}"
463RDEPENDS:${PN}-idle += "${@bb.utils.contains('PACKAGECONFIG', 'tk', '${PN}-tkinter ${MLPREFIX}tcl', '', d)}"
464DEV_PKG_DEPENDENCY = ""
465RDEPENDS:${PN}-pydoc += "${PN}-io"
466
467RDEPENDS:${PN}-tests:append:class-target = " ${MLPREFIX}bash"
468RDEPENDS:${PN}-tests:append:class-nativesdk = " ${MLPREFIX}bash"
469
470# Python's tests contain large numbers of files we don't need in the recipe sysroots
471SYSROOT_PREPROCESS_FUNCS += " py3_sysroot_cleanup"
472py3_sysroot_cleanup () {
473 rm -rf ${SYSROOT_DESTDIR}${libdir}/python${PYTHON_MAJMIN}/test
474}