blob: d375de4b19c90f694e864fc649d4dabf63c4f9ae [file] [log] [blame]
Andrew Geissler517393d2023-01-13 08:55:19 -06001SUMMARY = "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
Andrew Geissler6aa7eec2023-03-03 12:41:14 -06007LIC_FILES_CHKSUM = "file://LICENSE;md5=fcf6b249c2641540219a727f35d8d2c2"
Andrew Geissler517393d2023-01-13 08:55:19 -06008
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-Do-not-add-usr-lib-termcap-to-linker-flags-to-avoid-.patch \
18 ${@bb.utils.contains('PACKAGECONFIG', 'tk', '', 'file://avoid_warning_about_tkinter.patch', d)} \
19 file://0001-Makefile.pre-use-qemu-wrapper-when-gathering-profile.patch \
20 file://0001-python3-use-cc_basename-to-replace-CC-for-checking-c.patch \
21 file://crosspythonpath.patch \
22 file://0001-test_locale.py-correct-the-test-output-format.patch \
23 file://0017-setup.py-do-not-report-missing-dependencies-for-disa.patch \
24 file://0001-Makefile-do-not-compile-.pyc-in-parallel.patch \
25 file://0020-configure.ac-setup.py-do-not-add-a-curses-include-pa.patch \
26 file://0001-Skip-failing-tests-due-to-load-variability-on-YP-AB.patch \
27 file://0001-test_ctypes.test_find-skip-without-tools-sdk.patch \
28 file://makerace.patch \
29 file://0001-sysconfig.py-use-platlibdir-also-for-purelib.patch \
30 file://0001-Lib-pty.py-handle-stdin-I-O-errors-same-way-as-maste.patch \
31 file://0001-setup.py-Do-not-detect-multiarch-paths-when-cross-co.patch \
32 file://deterministic_imports.patch \
33 file://0001-Avoid-shebang-overflow-on-python-config.py.patch \
Patrick Williams8e7b46e2023-05-01 14:19:06 -050034 file://0001-Update-test_sysconfig-for-posix_user-purelib.patch \
Andrew Geissler220dafd2023-10-04 10:18:08 -050035 file://0001-skip-no_stdout_fileno-test-due-to-load-variability.patch \
Patrick Williamsda295312023-12-05 16:48:56 -060036 file://0001-test_storlines-skip-due-to-load-variability.patch \
Andrew Geissler517393d2023-01-13 08:55:19 -060037 "
38
39SRC_URI:append:class-native = " \
40 file://0001-Lib-sysconfig.py-use-prefix-value-from-build-configu.patch \
41 file://12-distutils-prefix-is-inside-staging-area.patch \
42 file://0001-Don-t-search-system-for-headers-libraries.patch \
43 "
Andrew Geissler5082cc72023-09-11 08:41:39 -040044SRC_URI[sha256sum] = "85cd12e9cf1d6d5a45f17f7afe1cebe7ee628d3282281c492e86adf636defa3f"
Andrew Geissler517393d2023-01-13 08:55:19 -060045
46# exclude pre-releases for both python 2.x and 3.x
47UPSTREAM_CHECK_REGEX = "[Pp]ython-(?P<pver>\d+(\.\d+)+).tar"
48UPSTREAM_CHECK_URI = "https://www.python.org/downloads/source/"
49
Andrew Geissler220dafd2023-10-04 10:18:08 -050050CVE_PRODUCT = "python cpython"
Andrew Geissler517393d2023-01-13 08:55:19 -060051
Andrew Geissler8f840682023-07-21 09:09:43 -050052CVE_STATUS[CVE-2007-4559] = "disputed: Upstream consider this expected behaviour"
53CVE_STATUS[CVE-2019-18348] = "not-applicable-config: This is not exploitable when glibc has CVE-2016-10739 fixed"
54CVE_STATUS[CVE-2020-15523] = "not-applicable-platform: Issue only applies on Windows"
55CVE_STATUS[CVE-2022-26488] = "not-applicable-platform: Issue only applies on Windows"
Andrew Geissler517393d2023-01-13 08:55:19 -060056# The module will be removed in the future and flaws documented.
Andrew Geissler8f840682023-07-21 09:09:43 -050057CVE_STATUS[CVE-2015-20107] = "upstream-wontfix: The mailcap module is insecure by design, so this can't be fixed in a meaningful way"
Andrew Geissler5082cc72023-09-11 08:41:39 -040058CVE_STATUS[CVE-2023-36632] = "disputed: Not an issue, in fact expected behaviour"
Andrew Geissler517393d2023-01-13 08:55:19 -060059
60PYTHON_MAJMIN = "3.11"
61
62S = "${WORKDIR}/Python-${PV}"
63
64BBCLASSEXTEND = "native nativesdk"
65
66inherit autotools pkgconfig qemu ptest multilib_header update-alternatives
67
68MULTILIB_SUFFIX = "${@d.getVar('base_libdir',1).split('/')[-1]}"
69
70ALTERNATIVE:${PN}-dev = "python3-config"
71ALTERNATIVE_LINK_NAME[python3-config] = "${bindir}/python${PYTHON_MAJMIN}-config"
72ALTERNATIVE_TARGET[python3-config] = "${bindir}/python${PYTHON_MAJMIN}-config-${MULTILIB_SUFFIX}"
73
74
Andrew Geissler3eeda902023-05-19 10:14:02 -050075DEPENDS = "bzip2-replacement-native expat libffi bzip2 openssl sqlite3 zlib virtual/libintl xz virtual/crypt util-linux-libuuid libtirpc libnsl2 autoconf-archive-native ncurses"
Andrew Geissler517393d2023-01-13 08:55:19 -060076DEPENDS:append:class-target = " python3-native"
77DEPENDS:append:class-nativesdk = " python3-native"
78
Andrew Geissler3eeda902023-05-19 10:14:02 -050079EXTRA_OECONF = " --without-ensurepip --enable-shared --with-platlibdir=${baselib} --with-system-expat"
Andrew Geissler517393d2023-01-13 08:55:19 -060080EXTRA_OECONF:append:class-native = " --bindir=${bindir}/${PN}"
81EXTRA_OECONF:append:class-target = " --with-build-python=nativepython3"
82EXTRA_OECONF:append:class-nativesdk = " --with-build-python=nativepython3"
83
84export CROSSPYTHONPATH="${STAGING_LIBDIR_NATIVE}/python${PYTHON_MAJMIN}/lib-dynload/"
85
86EXTRANATIVEPATH += "python3-native"
87
88# LTO will be enabled via packageconfig depending upong distro features
89LTO:class-target = ""
90
91CACHED_CONFIGUREVARS = " \
92 ac_cv_file__dev_ptmx=yes \
93 ac_cv_file__dev_ptc=no \
94 ac_cv_working_tzset=yes \
95"
Andrew Geissler5082cc72023-09-11 08:41:39 -040096# set thread stack size to 2MB on musl for interpreter and stdlib C extensions
97# so it does not run into stack limits due to musl's small thread stack
98# This is only needed to build interpreter and not the subsequent modules
99# Thats why CFLAGS_NODIST is modified instead of CFLAGS
100CACHED_CONFIGUREVARS:append:libc-musl = "\
101 CFLAGS_NODIST='${CFLAGS} -DTHREAD_STACK_SIZE=0x200000' \
102"
Andrew Geissler517393d2023-01-13 08:55:19 -0600103
104# PGO currently causes builds to not be reproducible so disable by default, see YOCTO #13407
Andrew Geissler3eeda902023-05-19 10:14:02 -0500105PACKAGECONFIG ??= "editline gdbm ${@bb.utils.filter('DISTRO_FEATURES', 'lto', d)}"
106PACKAGECONFIG[readline] = "--with-readline=readline,,readline,,,editline"
Andrew Geissler517393d2023-01-13 08:55:19 -0600107PACKAGECONFIG[editline] = "--with-readline=editline,,libedit,,,readline"
108# Use profile guided optimisation by running PyBench inside qemu-user
109PACKAGECONFIG[pgo] = "--enable-optimizations,,qemu-native"
110PACKAGECONFIG[tk] = ",,tk"
111PACKAGECONFIG[tcl] = ",,tcl"
112PACKAGECONFIG[gdbm] = ",,gdbm"
Andrew Geissler3eeda902023-05-19 10:14:02 -0500113PACKAGECONFIG[lto] = "--with-lto,--without-lto"
Andrew Geissler517393d2023-01-13 08:55:19 -0600114
115do_configure:prepend () {
116 mkdir -p ${B}/Modules
117 cat > ${B}/Modules/Setup.local << EOF
118*disabled*
119${@bb.utils.contains('PACKAGECONFIG', 'gdbm', '', '_gdbm _dbm', d)}
120${@bb.utils.contains('PACKAGECONFIG', 'readline', '', 'readline', d)}
121EOF
122}
123
124CPPFLAGS:append = " -I${STAGING_INCDIR}/ncursesw -I${STAGING_INCDIR}/uuid"
125
126EXTRA_OEMAKE = '\
127 STAGING_LIBDIR=${STAGING_LIBDIR} \
128 STAGING_INCDIR=${STAGING_INCDIR} \
129 LIB=${baselib} \
130'
131
132do_compile:prepend:class-target() {
133 if ${@bb.utils.contains('PACKAGECONFIG', 'pgo', 'true', 'false', d)}; then
134 qemu_binary="${@qemu_wrapper_cmdline(d, '${STAGING_DIR_TARGET}', ['${B}', '${STAGING_DIR_TARGET}/${base_libdir}'])}"
135 cat >pgo-wrapper <<EOF
136#!/bin/sh
137cd ${B}
138$qemu_binary "\$@"
139EOF
140 chmod +x pgo-wrapper
141 fi
142}
143
144do_install:prepend() {
145 ${WORKDIR}/check_build_completeness.py ${T}/log.do_compile
146}
147
148do_install:append:class-target() {
149 oe_multilib_header python${PYTHON_MAJMIN}/pyconfig.h
150}
151
152do_install:append:class-native() {
153 # Make sure we use /usr/bin/env python
154 for PYTHSCRIPT in `grep -rIl ${bindir}/${PN}/python ${D}${bindir}/${PN}`; do
155 sed -i -e '1s|^#!.*|#!/usr/bin/env python3|' $PYTHSCRIPT
156 done
157 # Add a symlink to the native Python so that scripts can just invoke
158 # "nativepython" and get the right one without needing absolute paths
159 # (these often end up too long for the #! parser in the kernel as the
160 # buffer is 128 bytes long).
161 ln -s python3-native/python3 ${D}${bindir}/nativepython3
162
163 # Remove the opt-1.pyc and opt-2.pyc files. There are over 3,000 of them
164 # and the overhead in each recipe-sysroot-native isn't worth it, particularly
165 # when they're only used for python called with -O or -OO.
166 #find ${D} -name *opt-*.pyc -delete
167 # Remove all pyc files. There are a ton of them and it is probably faster to let
168 # python create the ones it wants at runtime rather than manage in the sstate
169 # tarballs and sysroot creation.
170 find ${D} -name *.pyc -delete
171
172 # Nothing should be looking into ${B} for python3-native
173 sed -i -e 's:${B}:/build/path/unavailable/:g' \
174 ${D}/${libdir}/python${PYTHON_MAJMIN}/config-${PYTHON_MAJMIN}${PYTHON_ABI}*/Makefile
175
176 # disable the lookup in user's site-packages globally
177 sed -i 's#ENABLE_USER_SITE = None#ENABLE_USER_SITE = False#' ${D}${libdir}/python${PYTHON_MAJMIN}/site.py
178
179 # python3-config needs to be in /usr/bin and not in a subdir of it to work properly
180 mv ${D}/${bindir}/${PN}/python*config ${D}/${bindir}/
181}
182
183do_install:append() {
184 for c in ${D}/${libdir}/python${PYTHON_MAJMIN}/_sysconfigdata*.py; do
185 python3 ${WORKDIR}/reformat_sysconfig.py $c
186 done
187 rm -f ${D}${libdir}/python${PYTHON_MAJMIN}/__pycache__/_sysconfigdata*.cpython*
188
189 mkdir -p ${D}${libdir}/python-sysconfigdata
190 sysconfigfile=`find ${D} -name _sysconfig*.py`
191 sed -i \
192 -e "s,^ 'LIBDIR'.*, 'LIBDIR': '${STAGING_LIBDIR}'\,,g" \
193 -e "s,^ 'INCLUDEDIR'.*, 'INCLUDEDIR': '${STAGING_INCDIR}'\,,g" \
194 -e "s,^ 'CONFINCLUDEDIR'.*, 'CONFINCLUDEDIR': '${STAGING_INCDIR}'\,,g" \
195 -e "s,^ 'INCLUDEPY'.*, 'INCLUDEPY': '${STAGING_INCDIR}/python${PYTHON_MAJMIN}'\,,g" \
196 -e "s,^ 'CONFINCLUDEPY'.*, 'CONFINCLUDEPY': '${STAGING_INCDIR}/python${PYTHON_MAJMIN}'\,,g" \
197 -e "s,${B},/build/path/unavailable/,g" \
198 $sysconfigfile
199 cp $sysconfigfile ${D}${libdir}/python-sysconfigdata/_sysconfigdata.py
200
201
202 # Unfortunately the following pyc files are non-deterministc due to 'frozenset'
203 # being written without strict ordering, even with PYTHONHASHSEED = 0
204 # Upstream is discussing ways to solve the issue properly, until then let's
205 # just not install the problematic files.
206 # More info: http://benno.id.au/blog/2013/01/15/python-determinism
207 rm -f ${D}${libdir}/python${PYTHON_MAJMIN}/test/__pycache__/test_range.cpython*
208 rm -f ${D}${libdir}/python${PYTHON_MAJMIN}/test/__pycache__/test_xml_etree.cpython*
209
210 # Similar to the above, we're getting reproducibility issues with
211 # /usr/lib/python3.10/__pycache__/traceback.cpython-310.pyc
212 # so remove it too
213 rm -f ${D}${libdir}/python${PYTHON_MAJMIN}/__pycache__/traceback.cpython*
214
215 # Remove the opt-1.pyc and opt-2.pyc files. They effectively waste space on embedded
216 # style targets as they're only used when python is called with the -O or -OO options
217 # which is rare.
218 find ${D} -name *opt-*.pyc -delete
219}
220
221do_install:append:class-nativesdk () {
222 # Make sure we use /usr/bin/env python
223 for PYTHSCRIPT in `grep -rIl ${bindir}/python ${D}${bindir}`; do
224 sed -i -e '1s|^#!.*|#!/usr/bin/env python3|' $PYTHSCRIPT
225 done
226 create_wrapper ${D}${bindir}/python${PYTHON_MAJMIN} TERMINFO_DIRS='${sysconfdir}/terminfo:/etc/terminfo:/usr/share/terminfo:/usr/share/misc/terminfo:/lib/terminfo' PYTHONNOUSERSITE='1'
227}
228
Andrew Geissler5082cc72023-09-11 08:41:39 -0400229do_install_ptest:append:class-target:libc-musl () {
230 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
231}
232
Andrew Geissler517393d2023-01-13 08:55:19 -0600233SYSROOT_PREPROCESS_FUNCS:append:class-target = " provide_target_config_script"
234SYSROOT_PREPROCESS_FUNCS:append:class-nativesdk = " provide_target_config_script"
235
236# This is installed into /usr/python-target-config/ and not /usr/bin
237# because adding target sysroot's /usr/bin/ to PATH has unwanted side effects
238# in components erroneously picking up other target executables from it
239provide_target_config_script() {
240 install -d ${SYSROOT_DESTDIR}${prefix}/python-target-config/
241 install ${D}/${bindir}/python3-config ${SYSROOT_DESTDIR}/${prefix}/python-target-config/
242 install ${D}/${bindir}/python${PYTHON_MAJMIN}-config ${SYSROOT_DESTDIR}/${prefix}/python-target-config/
243}
244SYSROOT_DIRS += "${prefix}/python-target-config/"
245
246SSTATE_SCAN_FILES += "Makefile _sysconfigdata.py"
247SSTATE_HASHEQUIV_FILEMAP = " \
248 populate_sysroot:*/lib*/python3*/_sysconfigdata*.py:${TMPDIR} \
249 populate_sysroot:*/lib*/python3*/_sysconfigdata*.py:${COREBASE} \
250 populate_sysroot:*/lib*/python3*/config-*/Makefile:${TMPDIR} \
251 populate_sysroot:*/lib*/python3*/config-*/Makefile:${COREBASE} \
252 populate_sysroot:*/lib*/python-sysconfigdata/_sysconfigdata.py:${TMPDIR} \
253 populate_sysroot:*/lib*/python-sysconfigdata/_sysconfigdata.py:${COREBASE} \
254 "
255PACKAGE_PREPROCESS_FUNCS += "py_package_preprocess"
256
257py_package_preprocess () {
258 # Remove references to buildmachine paths in target Makefile and _sysconfigdata
259 sed -i -e 's:--sysroot=${STAGING_DIR_TARGET}::g' -e s:'--with-libtool-sysroot=${STAGING_DIR_TARGET}'::g \
260 -e 's|${DEBUG_PREFIX_MAP}||g' \
261 -e 's:${HOSTTOOLS_DIR}/::g' \
262 -e 's:${RECIPE_SYSROOT_NATIVE}::g' \
263 -e 's:${RECIPE_SYSROOT}::g' \
264 -e 's:${BASE_WORKDIR}/${MULTIMACH_TARGET_SYS}::g' \
265 ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/config-${PYTHON_MAJMIN}${PYTHON_ABI}*/Makefile \
266 ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/_sysconfigdata*.py \
267 ${PKGD}/${bindir}/python${PYTHON_MAJMIN}-config
268
269 # Reformat _sysconfigdata after modifying it so that it remains
270 # reproducible
271 for c in ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/_sysconfigdata*.py; do
272 python3 ${WORKDIR}/reformat_sysconfig.py $c
273 done
274
275 # Recompile _sysconfigdata after modifying it
276 cd ${PKGD}
277 sysconfigfile=`find . -name _sysconfigdata_*.py`
278 ${STAGING_BINDIR_NATIVE}/python3-native/python3 \
279 -c "from py_compile import compile; compile('$sysconfigfile')"
280 ${STAGING_BINDIR_NATIVE}/python3-native/python3 \
281 -c "from py_compile import compile; compile('$sysconfigfile', optimize=1)"
282 ${STAGING_BINDIR_NATIVE}/python3-native/python3 \
283 -c "from py_compile import compile; compile('$sysconfigfile', optimize=2)"
284 cd -
285
286 mv ${PKGD}/${bindir}/python${PYTHON_MAJMIN}-config ${PKGD}/${bindir}/python${PYTHON_MAJMIN}-config-${MULTILIB_SUFFIX}
287
288 #Remove the unneeded copy of target sysconfig data
289 rm -rf ${PKGD}/${libdir}/python-sysconfigdata
290}
291
292# We want bytecode precompiled .py files (.pyc's) by default
293# but the user may set it on their own conf
294INCLUDE_PYCS ?= "1"
295
296python(){
297 import collections, json
298
299 filename = os.path.join(d.getVar('THISDIR'), 'python3', 'python3-manifest.json')
300 # This python changes the datastore based on the contents of a file, so mark
301 # that dependency.
302 bb.parse.mark_dependency(d, filename)
303
304 with open(filename) as manifest_file:
305 manifest_str = manifest_file.read()
306 json_start = manifest_str.find('# EOC') + 6
307 manifest_file.seek(json_start)
308 manifest_str = manifest_file.read()
309 python_manifest = json.loads(manifest_str, object_pairs_hook=collections.OrderedDict)
310
311 # First set RPROVIDES for -native case
312 # Hardcoded since it cant be python3-native-foo, should be python3-foo-native
313 pn = 'python3'
314 rprovides = (d.getVar('RPROVIDES') or "").split()
315
316 # ${PN}-misc-native is not in the manifest
317 rprovides.append(pn + '-misc-native')
318
319 for key in python_manifest:
320 pypackage = pn + '-' + key + '-native'
321 if pypackage not in rprovides:
322 rprovides.append(pypackage)
323
324 d.setVar('RPROVIDES:class-native', ' '.join(rprovides))
325
326 # Then work on the target
327 include_pycs = d.getVar('INCLUDE_PYCS')
328
329 packages = d.getVar('PACKAGES').split()
330 pn = d.getVar('PN')
331
332 newpackages=[]
333 for key in python_manifest:
334 pypackage = pn + '-' + key
335
336 if pypackage not in packages:
337 # We need to prepend, otherwise python-misc gets everything
338 # so we use a new variable
339 newpackages.append(pypackage)
340
341 # "Build" python's manifest FILES, RDEPENDS and SUMMARY
342 d.setVar('FILES:' + pypackage, '')
343 for value in python_manifest[key]['files']:
344 d.appendVar('FILES:' + pypackage, ' ' + value)
345
346 # Add cached files
347 if include_pycs == '1':
348 for value in python_manifest[key]['cached']:
349 d.appendVar('FILES:' + pypackage, ' ' + value)
350
351 for value in python_manifest[key]['rdepends']:
352 # Make it work with or without $PN
353 if '${PN}' in value:
354 value=value.split('-', 1)[1]
355 d.appendVar('RDEPENDS:' + pypackage, ' ' + pn + '-' + value)
356
357 for value in python_manifest[key].get('rrecommends', ()):
358 if '${PN}' in value:
359 value=value.split('-', 1)[1]
360 d.appendVar('RRECOMMENDS:' + pypackage, ' ' + pn + '-' + value)
361
362 d.setVar('SUMMARY:' + pypackage, python_manifest[key]['summary'])
363
364 # Prepending so to avoid python-misc getting everything
365 packages = newpackages + packages
366 d.setVar('PACKAGES', ' '.join(packages))
367 d.setVar('ALLOW_EMPTY:${PN}-modules', '1')
368 d.setVar('ALLOW_EMPTY:${PN}-pkgutil', '1')
369
370 if "pgo" in d.getVar("PACKAGECONFIG").split() and not bb.utils.contains('MACHINE_FEATURES', 'qemu-usermode', True, False, d):
371 bb.fatal("pgo cannot be enabled as there is no qemu-usermode support for this architecture/machine")
372}
373
374# Files needed to create a new manifest
375
376do_create_manifest() {
377 # This task should be run with every new release of Python.
378 # We must ensure that PACKAGECONFIG enables everything when creating
379 # a new manifest, this is to base our new manifest on a complete
380 # native python build, containing all dependencies, otherwise the task
381 # wont be able to find the required files.
382 # e.g. BerkeleyDB is an optional build dependency so it may or may not
383 # be present, we must ensure it is.
384
385 cd ${WORKDIR}
386 # This needs to be executed by python-native and NOT by HOST's python
387 nativepython3 create_manifest3.py ${PYTHON_MAJMIN}
388 cp python3-manifest.json.new ${THISDIR}/python3/python3-manifest.json
389}
390
391# bitbake python -c create_manifest
392# Make sure we have native python ready when we create a new manifest
393addtask do_create_manifest after do_patch do_prepare_recipe_sysroot
394
395# manual dependency additions
396RRECOMMENDS:${PN}-core:append:class-nativesdk = " nativesdk-python3-modules"
397RRECOMMENDS:${PN}-crypt:append:class-target = " ${MLPREFIX}openssl ${MLPREFIX}ca-certificates"
398RRECOMMENDS:${PN}-crypt:append:class-nativesdk = " ${MLPREFIX}openssl ${MLPREFIX}ca-certificates"
399
400# For historical reasons PN is empty and provided by python3-modules
401FILES:${PN} = ""
402RPROVIDES:${PN}-modules = "${PN}"
403
404FILES:${PN}-pydoc += "${bindir}/pydoc${PYTHON_MAJMIN} ${bindir}/pydoc3"
405FILES:${PN}-idle += "${bindir}/idle3 ${bindir}/idle${PYTHON_MAJMIN}"
406
407# provide python-pyvenv from python3-venv
408RPROVIDES:${PN}-venv += "${MLPREFIX}python3-pyvenv"
409
410# package libpython3
411PACKAGES =+ "libpython3 libpython3-staticdev"
412FILES:libpython3 = "${libdir}/libpython*.so.*"
413FILES:libpython3-staticdev += "${libdir}/python${PYTHON_MAJMIN}/config-${PYTHON_MAJMIN}-*/libpython${PYTHON_MAJMIN}.a"
414INSANE_SKIP:${PN}-dev += "dev-elf"
415INSANE_SKIP:${PN}-ptest = "dev-deps"
416
417# catch all the rest (unsorted)
418PACKAGES += "${PN}-misc"
419RDEPENDS:${PN}-misc += "\
Andrew Geissler8f840682023-07-21 09:09:43 -0500420 ${PN}-audio \
421 ${PN}-codecs \
Andrew Geissler517393d2023-01-13 08:55:19 -0600422 ${PN}-core \
423 ${PN}-email \
Andrew Geissler517393d2023-01-13 08:55:19 -0600424 ${PN}-numbers \
Andrew Geissler8f840682023-07-21 09:09:43 -0500425 ${PN}-pickle \
426 ${PN}-pydoc \
Andrew Geissler517393d2023-01-13 08:55:19 -0600427"
428RDEPENDS:${PN}-modules:append:class-target = " ${MLPREFIX}python3-misc"
429RDEPENDS:${PN}-modules:append:class-nativesdk = " ${MLPREFIX}python3-misc"
Andrew Geisslerfc113ea2023-03-31 09:59:46 -0500430RDEPENDS:${PN}-modules:append:class-target = " ${@bb.utils.contains('PACKAGECONFIG', 'gdbm', '${MLPREFIX}python3-gdbm', '', d)}"
Andrew Geissler517393d2023-01-13 08:55:19 -0600431FILES:${PN}-misc = "${libdir}/python${PYTHON_MAJMIN} ${libdir}/python${PYTHON_MAJMIN}/lib-dynload"
432
433# catch manpage
434PACKAGES += "${PN}-man"
435FILES:${PN}-man = "${datadir}/man"
436
437# See https://bugs.python.org/issue18748 and https://bugs.python.org/issue37395
438RDEPENDS:libpython3:append:libc-glibc = " libgcc"
439RDEPENDS:${PN}-ctypes:append:libc-glibc = " ${MLPREFIX}ldconfig"
Andrew Geissler5082cc72023-09-11 08:41:39 -0400440RDEPENDS:${PN}-ptest = "${PN}-modules ${PN}-tests ${PN}-dev ${PN}-cgitb ${PN}-zipapp unzip bzip2 libgcc tzdata coreutils sed gcc g++ binutils \
441 locale-base-fr-fr locale-base-en-us locale-base-de-de"
442RDEPENDS:${PN}-ptest:append:libc-glibc = " locale-base-tr-tr"
Andrew Geissler517393d2023-01-13 08:55:19 -0600443RDEPENDS:${PN}-tkinter += "${@bb.utils.contains('PACKAGECONFIG', 'tk', '${MLPREFIX}tk ${MLPREFIX}tk-lib', '', d)}"
444RDEPENDS:${PN}-idle += "${@bb.utils.contains('PACKAGECONFIG', 'tk', '${PN}-tkinter ${MLPREFIX}tcl', '', d)}"
445DEV_PKG_DEPENDENCY = ""
446RDEPENDS:${PN}-pydoc += "${PN}-io"
447
448RDEPENDS:${PN}-tests:append:class-target = " ${MLPREFIX}bash"
449RDEPENDS:${PN}-tests:append:class-nativesdk = " ${MLPREFIX}bash"
450
451# Python's tests contain large numbers of files we don't need in the recipe sysroots
452SYSROOT_PREPROCESS_FUNCS += " py3_sysroot_cleanup"
453py3_sysroot_cleanup () {
454 rm -rf ${SYSROOT_DESTDIR}${libdir}/python${PYTHON_MAJMIN}/test
455}