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