blob: f04bfc30530984e26bfc55109e87000a1b194825 [file] [log] [blame]
Andrew Geissler82c905d2020-04-13 13:39:40 -05001SUMMARY = "The Python Programming Language"
2HOMEPAGE = "http://www.python.org"
Andrew Geissler90fd73c2021-03-05 15:25:55 -06003DESCRIPTION = "Python is a programming language that lets you work more quickly and integrate your systems more effectively."
Andrew Geissler82c905d2020-04-13 13:39:40 -05004LICENSE = "PSFv2"
5SECTION = "devel/python"
6
Andrew Geissler90fd73c2021-03-05 15:25:55 -06007LIC_FILES_CHKSUM = "file://LICENSE;md5=c22d2438294c784731bf9dd224a467b7"
Andrew Geissler82c905d2020-04-13 13:39:40 -05008
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 \
Andrew Geissler6ce62a22020-11-30 19:58:47 -060015 file://reformat_sysconfig.py \
Andrew Geissler82c905d2020-04-13 13:39:40 -050016 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-Do-not-use-the-shell-version-of-python-config-that-w.patch \
20 file://python-config.patch \
21 file://0001-Makefile.pre-use-qemu-wrapper-when-gathering-profile.patch \
Andrew Geissler82c905d2020-04-13 13:39:40 -050022 file://0001-python3-use-cc_basename-to-replace-CC-for-checking-c.patch \
Andrew Geissler82c905d2020-04-13 13:39:40 -050023 file://0001-bpo-36852-proper-detection-of-mips-architecture-for-.patch \
24 file://crosspythonpath.patch \
Andrew Geissler82c905d2020-04-13 13:39:40 -050025 file://0001-Use-FLAG_REF-always-for-interned-strings.patch \
26 file://0001-test_locale.py-correct-the-test-output-format.patch \
27 file://0017-setup.py-do-not-report-missing-dependencies-for-disa.patch \
28 file://0001-setup.py-pass-missing-libraries-to-Extension-for-mul.patch \
29 file://0001-Makefile-do-not-compile-.pyc-in-parallel.patch \
Andrew Geissler82c905d2020-04-13 13:39:40 -050030 file://0020-configure.ac-setup.py-do-not-add-a-curses-include-pa.patch \
Andrew Geissler6ce62a22020-11-30 19:58:47 -060031 file://0001-Lib-sysconfig.py-use-libdir-values-from-configuratio.patch \
Andrew Geissler3b8a17c2021-04-15 15:55:55 -050032 file://0001-Skip-failing-tests-due-to-load-variability-on-YP-AB.patch \
Andrew Geissler5f350902021-07-23 13:09:54 -040033 file://0001-test_ctypes.test_find-skip-without-tools-sdk.patch \
34 file://makerace.patch \
Andrew Geissler82c905d2020-04-13 13:39:40 -050035 "
36
Patrick Williams213cb262021-08-07 19:21:33 -050037SRC_URI:append:class-native = " \
Andrew Geissler82c905d2020-04-13 13:39:40 -050038 file://0001-distutils-sysconfig-append-STAGING_LIBDIR-python-sys.patch \
39 file://12-distutils-prefix-is-inside-staging-area.patch \
40 file://0001-Don-t-search-system-for-headers-libraries.patch \
41 "
Andrew Geissler5f350902021-07-23 13:09:54 -040042SRC_URI[sha256sum] = "397920af33efc5b97f2e0b57e91923512ef89fc5b3c1d21dbfc8c4828ce0108a"
Andrew Geissler82c905d2020-04-13 13:39:40 -050043
44# exclude pre-releases for both python 2.x and 3.x
45UPSTREAM_CHECK_REGEX = "[Pp]ython-(?P<pver>\d+(\.\d+)+).tar"
Andrew Geissler4c19ea12020-10-27 13:52:24 -050046UPSTREAM_CHECK_URI = "https://www.python.org/downloads/source/"
Andrew Geissler82c905d2020-04-13 13:39:40 -050047
48CVE_PRODUCT = "python"
49
Andrew Geissler6ce62a22020-11-30 19:58:47 -060050# Upstream consider this expected behaviour
51CVE_CHECK_WHITELIST += "CVE-2007-4559"
Andrew Geissler82c905d2020-04-13 13:39:40 -050052# This is not exploitable when glibc has CVE-2016-10739 fixed.
53CVE_CHECK_WHITELIST += "CVE-2019-18348"
54
Andrew Geissler6ce62a22020-11-30 19:58:47 -060055# This is windows only issue.
56CVE_CHECK_WHITELIST += "CVE-2020-15523"
57
58PYTHON_MAJMIN = "3.9"
Andrew Geissler82c905d2020-04-13 13:39:40 -050059
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
Patrick Williams213cb262021-08-07 19:21:33 -050068ALTERNATIVE:${PN}-dev = "python3-config"
Andrew Geissler82c905d2020-04-13 13:39:40 -050069ALTERNATIVE_LINK_NAME[python3-config] = "${bindir}/python${PYTHON_MAJMIN}-config"
70ALTERNATIVE_TARGET[python3-config] = "${bindir}/python${PYTHON_MAJMIN}-config-${MULTILIB_SUFFIX}"
71
72
Andrew Geisslerc926e172021-05-07 16:11:35 -050073DEPENDS = "bzip2-replacement-native libffi bzip2 openssl sqlite3 zlib virtual/libintl xz virtual/crypt util-linux libtirpc libnsl2 autoconf-archive-native"
Patrick Williams213cb262021-08-07 19:21:33 -050074DEPENDS:append:class-target = " python3-native"
75DEPENDS:append:class-nativesdk = " python3-native"
76
77# force to use the mutex+cond implementation (https://bugs.python.org/issue41710)
78CFLAGS += "-DHAVE_BROKEN_POSIX_SEMAPHORES"
Andrew Geissler82c905d2020-04-13 13:39:40 -050079
Andrew Geissler6ce62a22020-11-30 19:58:47 -060080EXTRA_OECONF = " --without-ensurepip --enable-shared --with-platlibdir=${baselib}"
Patrick Williams213cb262021-08-07 19:21:33 -050081EXTRA_OECONF:append:class-native = " --bindir=${bindir}/${PN}"
Andrew Geissler82c905d2020-04-13 13:39:40 -050082
83export CROSSPYTHONPATH="${STAGING_LIBDIR_NATIVE}/python${PYTHON_MAJMIN}/lib-dynload/"
84
85EXTRANATIVEPATH += "python3-native"
86
Andrew Geissler6ce62a22020-11-30 19:58:47 -060087# LTO will be enabled via packageconfig depending upong distro features
Patrick Williams213cb262021-08-07 19:21:33 -050088LTO:class-target = ""
Andrew Geissler6ce62a22020-11-30 19:58:47 -060089
Andrew Geissler82c905d2020-04-13 13:39:40 -050090CACHED_CONFIGUREVARS = " \
91 ac_cv_file__dev_ptmx=yes \
92 ac_cv_file__dev_ptc=no \
93 ac_cv_working_tzset=yes \
94"
Andrew Geisslerd25ed322020-06-27 00:28:28 -050095
96def possibly_include_pgo(d):
Andrew Geissler82c905d2020-04-13 13:39:40 -050097 # PGO currently causes builds to not be reproducible, so disable it for
98 # now. See YOCTO #13407
99 if bb.utils.contains('MACHINE_FEATURES', 'qemu-usermode', True, False, d) and d.getVar('BUILD_REPRODUCIBLE_BINARIES') != '1':
Andrew Geisslerd25ed322020-06-27 00:28:28 -0500100 return 'pgo'
101
102 return ''
Andrew Geissler82c905d2020-04-13 13:39:40 -0500103
Patrick Williams213cb262021-08-07 19:21:33 -0500104PACKAGECONFIG:class-target ??= "readline ${@possibly_include_pgo(d)} gdbm ${@bb.utils.filter('DISTRO_FEATURES', 'lto', d)}"
105PACKAGECONFIG:class-native ??= "readline gdbm"
106PACKAGECONFIG:class-nativesdk ??= "readline gdbm"
Andrew Geissler82c905d2020-04-13 13:39:40 -0500107PACKAGECONFIG[readline] = ",,readline"
108# Use profile guided optimisation by running PyBench inside qemu-user
109PACKAGECONFIG[pgo] = "--enable-optimizations,,qemu-native"
110PACKAGECONFIG[tk] = ",,tk"
111PACKAGECONFIG[gdbm] = ",,gdbm"
Andrew Geissler6ce62a22020-11-30 19:58:47 -0600112PACKAGECONFIG[lto] = "--with-lto,,"
Andrew Geissler82c905d2020-04-13 13:39:40 -0500113
Patrick Williams213cb262021-08-07 19:21:33 -0500114do_configure:prepend () {
Andrew Geissler82c905d2020-04-13 13:39:40 -0500115 mkdir -p ${B}/Modules
116 cat > ${B}/Modules/Setup.local << EOF
117*disabled*
118${@bb.utils.contains('PACKAGECONFIG', 'gdbm', '', '_gdbm _dbm', d)}
119${@bb.utils.contains('PACKAGECONFIG', 'readline', '', 'readline', d)}
120EOF
121}
122
Patrick Williams213cb262021-08-07 19:21:33 -0500123CPPFLAGS:append = " -I${STAGING_INCDIR}/ncursesw -I${STAGING_INCDIR}/uuid"
Andrew Geissler82c905d2020-04-13 13:39:40 -0500124
125EXTRA_OEMAKE = '\
126 STAGING_LIBDIR=${STAGING_LIBDIR} \
127 STAGING_INCDIR=${STAGING_INCDIR} \
128 LIB=${baselib} \
129'
130
Patrick Williams213cb262021-08-07 19:21:33 -0500131do_compile:prepend:class-target() {
Andrew Geissler82c905d2020-04-13 13:39:40 -0500132 if ${@bb.utils.contains('PACKAGECONFIG', 'pgo', 'true', 'false', d)}; then
133 qemu_binary="${@qemu_wrapper_cmdline(d, '${STAGING_DIR_TARGET}', ['${B}', '${STAGING_DIR_TARGET}/${base_libdir}'])}"
134 cat >pgo-wrapper <<EOF
135#!/bin/sh
136cd ${B}
137$qemu_binary "\$@"
138EOF
139 chmod +x pgo-wrapper
140 fi
141}
142
Patrick Williams213cb262021-08-07 19:21:33 -0500143do_install:prepend() {
Andrew Geissler82c905d2020-04-13 13:39:40 -0500144 ${WORKDIR}/check_build_completeness.py ${T}/log.do_compile
145}
146
Patrick Williams213cb262021-08-07 19:21:33 -0500147do_install:append:class-target() {
Andrew Geissler82c905d2020-04-13 13:39:40 -0500148 oe_multilib_header python${PYTHON_MAJMIN}/pyconfig.h
149}
150
Patrick Williams213cb262021-08-07 19:21:33 -0500151do_install:append:class-native() {
Andrew Geissler82c905d2020-04-13 13:39:40 -0500152 # Make sure we use /usr/bin/env python
153 for PYTHSCRIPT in `grep -rIl ${bindir}/${PN}/python ${D}${bindir}/${PN}`; do
154 sed -i -e '1s|^#!.*|#!/usr/bin/env python3|' $PYTHSCRIPT
155 done
156 # Add a symlink to the native Python so that scripts can just invoke
157 # "nativepython" and get the right one without needing absolute paths
158 # (these often end up too long for the #! parser in the kernel as the
159 # buffer is 128 bytes long).
160 ln -s python3-native/python3 ${D}${bindir}/nativepython3
161}
162
Patrick Williams213cb262021-08-07 19:21:33 -0500163do_install:append() {
Andrew Geissler82c905d2020-04-13 13:39:40 -0500164 mkdir -p ${D}${libdir}/python-sysconfigdata
165 sysconfigfile=`find ${D} -name _sysconfig*.py`
166 cp $sysconfigfile ${D}${libdir}/python-sysconfigdata/_sysconfigdata.py
167
168 sed -i \
169 -e "s,^ 'LIBDIR'.*, 'LIBDIR': '${STAGING_LIBDIR}'\,,g" \
170 -e "s,^ 'INCLUDEDIR'.*, 'INCLUDEDIR': '${STAGING_INCDIR}'\,,g" \
171 -e "s,^ 'CONFINCLUDEDIR'.*, 'CONFINCLUDEDIR': '${STAGING_INCDIR}'\,,g" \
172 -e "/^ 'INCLDIRSTOMAKE'/{N; s,/usr/include,${STAGING_INCDIR},g}" \
173 -e "/^ 'INCLUDEPY'/s,/usr/include,${STAGING_INCDIR},g" \
174 ${D}${libdir}/python-sysconfigdata/_sysconfigdata.py
Andrew Geissler6ce62a22020-11-30 19:58:47 -0600175
176 # Unfortunately the following pyc files are non-deterministc due to 'frozenset'
177 # being written without strict ordering, even with PYTHONHASHSEED = 0
178 # Upstream is discussing ways to solve the issue properly, until then let's
179 # just not install the problematic files.
180 # More info: http://benno.id.au/blog/2013/01/15/python-determinism
181 rm ${D}${libdir}/python${PYTHON_MAJMIN}/test/__pycache__/test_range.cpython*
182 rm ${D}${libdir}/python${PYTHON_MAJMIN}/test/__pycache__/test_xml_etree.cpython*
Andrew Geissler82c905d2020-04-13 13:39:40 -0500183}
184
Patrick Williams213cb262021-08-07 19:21:33 -0500185do_install:append:class-nativesdk () {
Andrew Geissler90fd73c2021-03-05 15:25:55 -0600186 # Make sure we use /usr/bin/env python
187 for PYTHSCRIPT in `grep -rIl ${bindir}/python ${D}${bindir}`; do
188 sed -i -e '1s|^#!.*|#!/usr/bin/env python3|' $PYTHSCRIPT
189 done
Andrew Geissler82c905d2020-04-13 13:39:40 -0500190 create_wrapper ${D}${bindir}/python${PYTHON_MAJMIN} TERMINFO_DIRS='${sysconfdir}/terminfo:/etc/terminfo:/usr/share/terminfo:/usr/share/misc/terminfo:/lib/terminfo' PYTHONNOUSERSITE='1'
191}
192
193SSTATE_SCAN_FILES += "Makefile _sysconfigdata.py"
194PACKAGE_PREPROCESS_FUNCS += "py_package_preprocess"
195
196py_package_preprocess () {
197 # Remove references to buildmachine paths in target Makefile and _sysconfigdata
198 sed -i -e 's:--sysroot=${STAGING_DIR_TARGET}::g' -e s:'--with-libtool-sysroot=${STAGING_DIR_TARGET}'::g \
199 -e 's|${DEBUG_PREFIX_MAP}||g' \
200 -e 's:${HOSTTOOLS_DIR}/::g' \
201 -e 's:${RECIPE_SYSROOT_NATIVE}::g' \
202 -e 's:${RECIPE_SYSROOT}::g' \
203 -e 's:${BASE_WORKDIR}/${MULTIMACH_TARGET_SYS}::g' \
204 ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/config-${PYTHON_MAJMIN}${PYTHON_ABI}*/Makefile \
205 ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/_sysconfigdata*.py \
206 ${PKGD}/${bindir}/python${PYTHON_MAJMIN}-config
207
208 # Reformat _sysconfigdata after modifying it so that it remains
209 # reproducible
210 for c in ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/_sysconfigdata*.py; do
211 python3 ${WORKDIR}/reformat_sysconfig.py $c
212 done
213
214 # Recompile _sysconfigdata after modifying it
215 cd ${PKGD}
216 sysconfigfile=`find . -name _sysconfigdata_*.py`
217 ${STAGING_BINDIR_NATIVE}/python3-native/python3 \
218 -c "from py_compile import compile; compile('$sysconfigfile')"
219 ${STAGING_BINDIR_NATIVE}/python3-native/python3 \
220 -c "from py_compile import compile; compile('$sysconfigfile', optimize=1)"
221 ${STAGING_BINDIR_NATIVE}/python3-native/python3 \
222 -c "from py_compile import compile; compile('$sysconfigfile', optimize=2)"
223 cd -
224
225 mv ${PKGD}/${bindir}/python${PYTHON_MAJMIN}-config ${PKGD}/${bindir}/python${PYTHON_MAJMIN}-config-${MULTILIB_SUFFIX}
226
227 #Remove the unneeded copy of target sysconfig data
228 rm -rf ${PKGD}/${libdir}/python-sysconfigdata
229}
230
231# We want bytecode precompiled .py files (.pyc's) by default
232# but the user may set it on their own conf
233INCLUDE_PYCS ?= "1"
234
235python(){
236 import collections, json
237
238 filename = os.path.join(d.getVar('THISDIR'), 'python3', 'python3-manifest.json')
239 # This python changes the datastore based on the contents of a file, so mark
240 # that dependency.
241 bb.parse.mark_dependency(d, filename)
242
243 with open(filename) as manifest_file:
244 manifest_str = manifest_file.read()
245 json_start = manifest_str.find('# EOC') + 6
246 manifest_file.seek(json_start)
247 manifest_str = manifest_file.read()
248 python_manifest = json.loads(manifest_str, object_pairs_hook=collections.OrderedDict)
249
250 # First set RPROVIDES for -native case
251 # Hardcoded since it cant be python3-native-foo, should be python3-foo-native
252 pn = 'python3'
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600253 rprovides = (d.getVar('RPROVIDES') or "").split()
Andrew Geissler82c905d2020-04-13 13:39:40 -0500254
255 # ${PN}-misc-native is not in the manifest
256 rprovides.append(pn + '-misc-native')
257
258 for key in python_manifest:
259 pypackage = pn + '-' + key + '-native'
260 if pypackage not in rprovides:
261 rprovides.append(pypackage)
262
Patrick Williams213cb262021-08-07 19:21:33 -0500263 d.setVar('RPROVIDES:class-native', ' '.join(rprovides))
Andrew Geissler82c905d2020-04-13 13:39:40 -0500264
265 # Then work on the target
266 include_pycs = d.getVar('INCLUDE_PYCS')
267
268 packages = d.getVar('PACKAGES').split()
269 pn = d.getVar('PN')
270
271 newpackages=[]
272 for key in python_manifest:
273 pypackage = pn + '-' + key
274
275 if pypackage not in packages:
276 # We need to prepend, otherwise python-misc gets everything
277 # so we use a new variable
278 newpackages.append(pypackage)
279
280 # "Build" python's manifest FILES, RDEPENDS and SUMMARY
Patrick Williams213cb262021-08-07 19:21:33 -0500281 d.setVar('FILES:' + pypackage, '')
Andrew Geissler82c905d2020-04-13 13:39:40 -0500282 for value in python_manifest[key]['files']:
Patrick Williams213cb262021-08-07 19:21:33 -0500283 d.appendVar('FILES:' + pypackage, ' ' + value)
Andrew Geissler82c905d2020-04-13 13:39:40 -0500284
285 # Add cached files
286 if include_pycs == '1':
287 for value in python_manifest[key]['cached']:
Patrick Williams213cb262021-08-07 19:21:33 -0500288 d.appendVar('FILES:' + pypackage, ' ' + value)
Andrew Geissler82c905d2020-04-13 13:39:40 -0500289
290 for value in python_manifest[key]['rdepends']:
291 # Make it work with or without $PN
292 if '${PN}' in value:
293 value=value.split('-', 1)[1]
Patrick Williams213cb262021-08-07 19:21:33 -0500294 d.appendVar('RDEPENDS:' + pypackage, ' ' + pn + '-' + value)
Andrew Geissler82c905d2020-04-13 13:39:40 -0500295
296 for value in python_manifest[key].get('rrecommends', ()):
297 if '${PN}' in value:
298 value=value.split('-', 1)[1]
Patrick Williams213cb262021-08-07 19:21:33 -0500299 d.appendVar('RRECOMMENDS:' + pypackage, ' ' + pn + '-' + value)
Andrew Geissler82c905d2020-04-13 13:39:40 -0500300
Patrick Williams213cb262021-08-07 19:21:33 -0500301 d.setVar('SUMMARY:' + pypackage, python_manifest[key]['summary'])
Andrew Geissler82c905d2020-04-13 13:39:40 -0500302
303 # Prepending so to avoid python-misc getting everything
304 packages = newpackages + packages
305 d.setVar('PACKAGES', ' '.join(packages))
Patrick Williams213cb262021-08-07 19:21:33 -0500306 d.setVar('ALLOW_EMPTY:${PN}-modules', '1')
307 d.setVar('ALLOW_EMPTY:${PN}-pkgutil', '1')
Andrew Geissler82c905d2020-04-13 13:39:40 -0500308}
309
310# Files needed to create a new manifest
311
312do_create_manifest() {
313 # This task should be run with every new release of Python.
314 # We must ensure that PACKAGECONFIG enables everything when creating
315 # a new manifest, this is to base our new manifest on a complete
316 # native python build, containing all dependencies, otherwise the task
317 # wont be able to find the required files.
318 # e.g. BerkeleyDB is an optional build dependency so it may or may not
319 # be present, we must ensure it is.
320
321 cd ${WORKDIR}
322 # This needs to be executed by python-native and NOT by HOST's python
323 nativepython3 create_manifest3.py ${PYTHON_MAJMIN}
324 cp python3-manifest.json.new ${THISDIR}/python3/python3-manifest.json
325}
326
327# bitbake python -c create_manifest
Andrew Geissler82c905d2020-04-13 13:39:40 -0500328# Make sure we have native python ready when we create a new manifest
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600329addtask do_create_manifest after do_patch do_prepare_recipe_sysroot
Andrew Geissler82c905d2020-04-13 13:39:40 -0500330
331# manual dependency additions
Patrick Williams213cb262021-08-07 19:21:33 -0500332RRECOMMENDS:${PN}-core:append:class-nativesdk = " nativesdk-python3-modules"
333RRECOMMENDS:${PN}-crypt:append:class-target = " ${MLPREFIX}openssl ${MLPREFIX}ca-certificates"
334RRECOMMENDS:${PN}-crypt:append:class-nativesdk = " ${MLPREFIX}openssl ${MLPREFIX}ca-certificates"
Andrew Geissler82c905d2020-04-13 13:39:40 -0500335
336# For historical reasons PN is empty and provided by python3-modules
Patrick Williams213cb262021-08-07 19:21:33 -0500337FILES:${PN} = ""
338RPROVIDES:${PN}-modules = "${PN}"
Andrew Geissler82c905d2020-04-13 13:39:40 -0500339
Patrick Williams213cb262021-08-07 19:21:33 -0500340FILES:${PN}-pydoc += "${bindir}/pydoc${PYTHON_MAJMIN} ${bindir}/pydoc3"
341FILES:${PN}-idle += "${bindir}/idle3 ${bindir}/idle${PYTHON_MAJMIN}"
Andrew Geissler82c905d2020-04-13 13:39:40 -0500342
343# provide python-pyvenv from python3-venv
Patrick Williams213cb262021-08-07 19:21:33 -0500344RPROVIDES:${PN}-venv += "${MLPREFIX}python3-pyvenv"
Andrew Geissler82c905d2020-04-13 13:39:40 -0500345
346# package libpython3
347PACKAGES =+ "libpython3 libpython3-staticdev"
Patrick Williams213cb262021-08-07 19:21:33 -0500348FILES:libpython3 = "${libdir}/libpython*.so.*"
349FILES:libpython3-staticdev += "${libdir}/python${PYTHON_MAJMIN}/config-${PYTHON_MAJMIN}-*/libpython${PYTHON_MAJMIN}.a"
350INSANE_SKIP:${PN}-dev += "dev-elf"
351INSANE_SKIP:${PN}-ptest = "dev-deps"
Andrew Geissler82c905d2020-04-13 13:39:40 -0500352
353# catch all the rest (unsorted)
354PACKAGES += "${PN}-misc"
Patrick Williams213cb262021-08-07 19:21:33 -0500355RDEPENDS:${PN}-misc += "\
Andrew Geisslerd25ed322020-06-27 00:28:28 -0500356 ${PN}-core \
357 ${PN}-email \
358 ${PN}-codecs \
359 ${PN}-pydoc \
360 ${PN}-pickle \
361 ${PN}-audio \
362 ${PN}-numbers \
363"
Patrick Williams213cb262021-08-07 19:21:33 -0500364RDEPENDS:${PN}-modules:append:class-target = " ${MLPREFIX}python3-misc"
365RDEPENDS:${PN}-modules:append:class-nativesdk = " ${MLPREFIX}python3-misc"
366FILES:${PN}-misc = "${libdir}/python${PYTHON_MAJMIN} ${libdir}/python${PYTHON_MAJMIN}/lib-dynload"
Andrew Geissler82c905d2020-04-13 13:39:40 -0500367
368# catch manpage
369PACKAGES += "${PN}-man"
Patrick Williams213cb262021-08-07 19:21:33 -0500370FILES:${PN}-man = "${datadir}/man"
Andrew Geissler82c905d2020-04-13 13:39:40 -0500371
372# See https://bugs.python.org/issue18748 and https://bugs.python.org/issue37395
Patrick Williams213cb262021-08-07 19:21:33 -0500373RDEPENDS:libpython3:append:libc-glibc = " libgcc"
374RDEPENDS:${PN}-ctypes:append:libc-glibc = " ${MLPREFIX}ldconfig"
375RDEPENDS:${PN}-ptest = "${PN}-modules ${PN}-tests ${PN}-dev unzip bzip2 libgcc tzdata-europe coreutils sed"
376RDEPENDS:${PN}-ptest:append:libc-glibc = " locale-base-tr-tr.iso-8859-9"
Andrew Geissler5199d832021-09-24 16:47:35 -0500377RDEPENDS:${PN}-tkinter += "${@bb.utils.contains('PACKAGECONFIG', 'tk', '${MLPREFIX}tk ${MLPREFIX}tk-lib', '', d)}"
378RDEPENDS:${PN}-idle += "${@bb.utils.contains('PACKAGECONFIG', 'tk', '${PN}-tkinter ${MLPREFIX}tcl', '', d)}"
Patrick Williams213cb262021-08-07 19:21:33 -0500379RDEPENDS:${PN}-dev = ""
380RDEPENDS:${PN}-pydoc += "${PN}-io"
Andrew Geissler82c905d2020-04-13 13:39:40 -0500381
Patrick Williams213cb262021-08-07 19:21:33 -0500382RDEPENDS:${PN}-tests:append:class-target = " ${MLPREFIX}bash"
383RDEPENDS:${PN}-tests:append:class-nativesdk = " ${MLPREFIX}bash"
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600384
385# Python's tests contain large numbers of files we don't need in the recipe sysroots
386SYSROOT_PREPROCESS_FUNCS += " py3_sysroot_cleanup"
387py3_sysroot_cleanup () {
388 rm -rf ${SYSROOT_DESTDIR}${libdir}/python${PYTHON_MAJMIN}/test
389}