Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame^] | 1 | SUMMARY = "The Python Programming Language" |
| 2 | HOMEPAGE = "http://www.python.org" |
| 3 | DESCRIPTION = "Python is a programming language that lets you work more quickly and integrate your systems more effectively." |
| 4 | LICENSE = "PSF-2.0" |
| 5 | SECTION = "devel/python" |
| 6 | |
| 7 | LIC_FILES_CHKSUM = "file://LICENSE;md5=4b8801e752a2c70ac41a5f9aa243f766" |
| 8 | |
| 9 | SRC_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-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 \ |
| 22 | file://0001-python3-use-cc_basename-to-replace-CC-for-checking-c.patch \ |
| 23 | file://0001-bpo-36852-proper-detection-of-mips-architecture-for-.patch \ |
| 24 | file://crosspythonpath.patch \ |
| 25 | 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-Makefile-do-not-compile-.pyc-in-parallel.patch \ |
| 29 | file://0020-configure.ac-setup.py-do-not-add-a-curses-include-pa.patch \ |
| 30 | file://0001-Skip-failing-tests-due-to-load-variability-on-YP-AB.patch \ |
| 31 | file://0001-test_ctypes.test_find-skip-without-tools-sdk.patch \ |
| 32 | file://makerace.patch \ |
| 33 | file://0001-sysconfig.py-use-platlibdir-also-for-purelib.patch \ |
| 34 | file://0001-Lib-pty.py-handle-stdin-I-O-errors-same-way-as-maste.patch \ |
| 35 | file://0001-setup.py-Do-not-detect-multiarch-paths-when-cross-co.patch \ |
| 36 | file://deterministic_imports.patch \ |
| 37 | file://0001-Avoid-shebang-overflow-on-python-config.py.patch \ |
| 38 | file://0001-Mitigate-the-race-condition-in-testSockName.patch \ |
| 39 | " |
| 40 | |
| 41 | SRC_URI:append:class-native = " \ |
| 42 | file://0001-Lib-sysconfig.py-use-prefix-value-from-build-configu.patch \ |
| 43 | file://0001-distutils-sysconfig-append-STAGING_LIBDIR-python-sys.patch \ |
| 44 | file://12-distutils-prefix-is-inside-staging-area.patch \ |
| 45 | file://0001-Don-t-search-system-for-headers-libraries.patch \ |
| 46 | " |
| 47 | SRC_URI[sha256sum] = "f795ff87d11d4b0c7c33bc8851b0c28648d8a4583aa2100a98c22b4326b6d3f3" |
| 48 | |
| 49 | # exclude pre-releases for both python 2.x and 3.x |
| 50 | UPSTREAM_CHECK_REGEX = "[Pp]ython-(?P<pver>\d+(\.\d+)+).tar" |
| 51 | UPSTREAM_CHECK_URI = "https://www.python.org/downloads/source/" |
| 52 | |
| 53 | CVE_PRODUCT = "python" |
| 54 | |
| 55 | # Upstream consider this expected behaviour |
| 56 | CVE_CHECK_IGNORE += "CVE-2007-4559" |
| 57 | # This is not exploitable when glibc has CVE-2016-10739 fixed. |
| 58 | CVE_CHECK_IGNORE += "CVE-2019-18348" |
| 59 | # These are specific to Microsoft Windows |
| 60 | CVE_CHECK_IGNORE += "CVE-2020-15523 CVE-2022-26488" |
| 61 | # The mailcap module is insecure by design, so this can't be fixed in a meaningful way. |
| 62 | # The module will be removed in the future and flaws documented. |
| 63 | CVE_CHECK_IGNORE += "CVE-2015-20107" |
| 64 | |
| 65 | PYTHON_MAJMIN = "3.10" |
| 66 | |
| 67 | S = "${WORKDIR}/Python-${PV}" |
| 68 | |
| 69 | BBCLASSEXTEND = "native nativesdk" |
| 70 | |
| 71 | inherit autotools pkgconfig qemu ptest multilib_header update-alternatives |
| 72 | |
| 73 | MULTILIB_SUFFIX = "${@d.getVar('base_libdir',1).split('/')[-1]}" |
| 74 | |
| 75 | ALTERNATIVE:${PN}-dev = "python3-config" |
| 76 | ALTERNATIVE_LINK_NAME[python3-config] = "${bindir}/python${PYTHON_MAJMIN}-config" |
| 77 | ALTERNATIVE_TARGET[python3-config] = "${bindir}/python${PYTHON_MAJMIN}-config-${MULTILIB_SUFFIX}" |
| 78 | |
| 79 | |
| 80 | DEPENDS = "bzip2-replacement-native libffi bzip2 openssl sqlite3 zlib virtual/libintl xz virtual/crypt util-linux-libuuid libtirpc libnsl2 autoconf-archive-native ncurses" |
| 81 | DEPENDS:append:class-target = " python3-native" |
| 82 | DEPENDS:append:class-nativesdk = " python3-native" |
| 83 | |
| 84 | # force to use the mutex+cond implementation (https://bugs.python.org/issue41710) |
| 85 | CFLAGS += "-DHAVE_BROKEN_POSIX_SEMAPHORES" |
| 86 | |
| 87 | EXTRA_OECONF = " --without-ensurepip --enable-shared --with-platlibdir=${baselib}" |
| 88 | EXTRA_OECONF:append:class-native = " --bindir=${bindir}/${PN}" |
| 89 | |
| 90 | export CROSSPYTHONPATH="${STAGING_LIBDIR_NATIVE}/python${PYTHON_MAJMIN}/lib-dynload/" |
| 91 | |
| 92 | EXTRANATIVEPATH += "python3-native" |
| 93 | |
| 94 | # LTO will be enabled via packageconfig depending upong distro features |
| 95 | LTO:class-target = "" |
| 96 | |
| 97 | CACHED_CONFIGUREVARS = " \ |
| 98 | ac_cv_file__dev_ptmx=yes \ |
| 99 | ac_cv_file__dev_ptc=no \ |
| 100 | ac_cv_working_tzset=yes \ |
| 101 | " |
| 102 | |
| 103 | # PGO currently causes builds to not be reproducible so disable by default, see YOCTO #13407 |
| 104 | PACKAGECONFIG:class-target ??= "readline gdbm ${@bb.utils.filter('DISTRO_FEATURES', 'lto', d)}" |
| 105 | PACKAGECONFIG:class-native ??= "readline gdbm" |
| 106 | PACKAGECONFIG:class-nativesdk ??= "readline gdbm" |
| 107 | PACKAGECONFIG[readline] = ",,readline" |
| 108 | # Use profile guided optimisation by running PyBench inside qemu-user |
| 109 | PACKAGECONFIG[pgo] = "--enable-optimizations,,qemu-native" |
| 110 | PACKAGECONFIG[tk] = ",,tk" |
| 111 | PACKAGECONFIG[gdbm] = ",,gdbm" |
| 112 | PACKAGECONFIG[lto] = "--with-lto,," |
| 113 | |
| 114 | do_configure:prepend () { |
| 115 | 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)} |
| 120 | EOF |
| 121 | } |
| 122 | |
| 123 | CPPFLAGS:append = " -I${STAGING_INCDIR}/ncursesw -I${STAGING_INCDIR}/uuid" |
| 124 | |
| 125 | EXTRA_OEMAKE = '\ |
| 126 | STAGING_LIBDIR=${STAGING_LIBDIR} \ |
| 127 | STAGING_INCDIR=${STAGING_INCDIR} \ |
| 128 | LIB=${baselib} \ |
| 129 | ' |
| 130 | |
| 131 | do_compile:prepend:class-target() { |
| 132 | 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 |
| 136 | cd ${B} |
| 137 | $qemu_binary "\$@" |
| 138 | EOF |
| 139 | chmod +x pgo-wrapper |
| 140 | fi |
| 141 | } |
| 142 | |
| 143 | do_install:prepend() { |
| 144 | ${WORKDIR}/check_build_completeness.py ${T}/log.do_compile |
| 145 | } |
| 146 | |
| 147 | do_install:append:class-target() { |
| 148 | oe_multilib_header python${PYTHON_MAJMIN}/pyconfig.h |
| 149 | } |
| 150 | |
| 151 | do_install:append:class-native() { |
| 152 | # 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 | # Remove the opt-1.pyc and opt-2.pyc files. There are over 3,000 of them |
| 163 | # and the overhead in each recipe-sysroot-native isn't worth it, particularly |
| 164 | # when they're only used for python called with -O or -OO. |
| 165 | #find ${D} -name *opt-*.pyc -delete |
| 166 | # Remove all pyc files. There are a ton of them and it is probably faster to let |
| 167 | # python create the ones it wants at runtime rather than manage in the sstate |
| 168 | # tarballs and sysroot creation. |
| 169 | find ${D} -name *.pyc -delete |
| 170 | |
| 171 | # Nothing should be looking into ${B} for python3-native |
| 172 | sed -i -e 's:${B}:/build/path/unavailable/:g' \ |
| 173 | ${D}/${libdir}/python${PYTHON_MAJMIN}/config-${PYTHON_MAJMIN}${PYTHON_ABI}*/Makefile |
| 174 | |
| 175 | # disable the lookup in user's site-packages globally |
| 176 | sed -i 's#ENABLE_USER_SITE = None#ENABLE_USER_SITE = False#' ${D}${libdir}/python${PYTHON_MAJMIN}/site.py |
| 177 | } |
| 178 | |
| 179 | do_install:append() { |
| 180 | for c in ${D}/${libdir}/python${PYTHON_MAJMIN}/_sysconfigdata*.py; do |
| 181 | python3 ${WORKDIR}/reformat_sysconfig.py $c |
| 182 | done |
| 183 | rm -f ${D}${libdir}/python${PYTHON_MAJMIN}/__pycache__/_sysconfigdata*.cpython* |
| 184 | |
| 185 | mkdir -p ${D}${libdir}/python-sysconfigdata |
| 186 | sysconfigfile=`find ${D} -name _sysconfig*.py` |
| 187 | sed -i \ |
| 188 | -e "s,^ 'LIBDIR'.*, 'LIBDIR': '${STAGING_LIBDIR}'\,,g" \ |
| 189 | -e "s,^ 'INCLUDEDIR'.*, 'INCLUDEDIR': '${STAGING_INCDIR}'\,,g" \ |
| 190 | -e "s,^ 'CONFINCLUDEDIR'.*, 'CONFINCLUDEDIR': '${STAGING_INCDIR}'\,,g" \ |
| 191 | -e "/^ 'INCLDIRSTOMAKE'/{N; s,/usr/include,${STAGING_INCDIR},g}" \ |
| 192 | -e "/^ 'INCLUDEPY'/s,/usr/include,${STAGING_INCDIR},g" \ |
| 193 | -e "s,${B},/build/path/unavailable/,g" \ |
| 194 | $sysconfigfile |
| 195 | cp $sysconfigfile ${D}${libdir}/python-sysconfigdata/_sysconfigdata.py |
| 196 | |
| 197 | |
| 198 | # Unfortunately the following pyc files are non-deterministc due to 'frozenset' |
| 199 | # being written without strict ordering, even with PYTHONHASHSEED = 0 |
| 200 | # Upstream is discussing ways to solve the issue properly, until then let's |
| 201 | # just not install the problematic files. |
| 202 | # More info: http://benno.id.au/blog/2013/01/15/python-determinism |
| 203 | rm -f ${D}${libdir}/python${PYTHON_MAJMIN}/test/__pycache__/test_range.cpython* |
| 204 | rm -f ${D}${libdir}/python${PYTHON_MAJMIN}/test/__pycache__/test_xml_etree.cpython* |
| 205 | |
| 206 | # Similar to the above, we're getting reproducibility issues with |
| 207 | # /usr/lib/python3.10/__pycache__/traceback.cpython-310.pyc |
| 208 | # so remove it too |
| 209 | rm -f ${D}${libdir}/python${PYTHON_MAJMIN}/__pycache__/traceback.cpython* |
| 210 | |
| 211 | # Remove the opt-1.pyc and opt-2.pyc files. They effectively waste space on embedded |
| 212 | # style targets as they're only used when python is called with the -O or -OO options |
| 213 | # which is rare. |
| 214 | find ${D} -name *opt-*.pyc -delete |
| 215 | } |
| 216 | |
| 217 | do_install:append:class-nativesdk () { |
| 218 | # Make sure we use /usr/bin/env python |
| 219 | for PYTHSCRIPT in `grep -rIl ${bindir}/python ${D}${bindir}`; do |
| 220 | sed -i -e '1s|^#!.*|#!/usr/bin/env python3|' $PYTHSCRIPT |
| 221 | done |
| 222 | create_wrapper ${D}${bindir}/python${PYTHON_MAJMIN} TERMINFO_DIRS='${sysconfdir}/terminfo:/etc/terminfo:/usr/share/terminfo:/usr/share/misc/terminfo:/lib/terminfo' PYTHONNOUSERSITE='1' |
| 223 | } |
| 224 | |
| 225 | SSTATE_SCAN_FILES += "Makefile _sysconfigdata.py" |
| 226 | SSTATE_HASHEQUIV_FILEMAP = " \ |
| 227 | populate_sysroot:*/lib*/python3*/_sysconfigdata*.py:${TMPDIR} \ |
| 228 | populate_sysroot:*/lib*/python3*/_sysconfigdata*.py:${COREBASE} \ |
| 229 | populate_sysroot:*/lib*/python3*/config-*/Makefile:${TMPDIR} \ |
| 230 | populate_sysroot:*/lib*/python3*/config-*/Makefile:${COREBASE} \ |
| 231 | populate_sysroot:*/lib*/python-sysconfigdata/_sysconfigdata.py:${TMPDIR} \ |
| 232 | populate_sysroot:*/lib*/python-sysconfigdata/_sysconfigdata.py:${COREBASE} \ |
| 233 | " |
| 234 | PACKAGE_PREPROCESS_FUNCS += "py_package_preprocess" |
| 235 | |
| 236 | py_package_preprocess () { |
| 237 | # Remove references to buildmachine paths in target Makefile and _sysconfigdata |
| 238 | sed -i -e 's:--sysroot=${STAGING_DIR_TARGET}::g' -e s:'--with-libtool-sysroot=${STAGING_DIR_TARGET}'::g \ |
| 239 | -e 's|${DEBUG_PREFIX_MAP}||g' \ |
| 240 | -e 's:${HOSTTOOLS_DIR}/::g' \ |
| 241 | -e 's:${RECIPE_SYSROOT_NATIVE}::g' \ |
| 242 | -e 's:${RECIPE_SYSROOT}::g' \ |
| 243 | -e 's:${BASE_WORKDIR}/${MULTIMACH_TARGET_SYS}::g' \ |
| 244 | ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/config-${PYTHON_MAJMIN}${PYTHON_ABI}*/Makefile \ |
| 245 | ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/_sysconfigdata*.py \ |
| 246 | ${PKGD}/${bindir}/python${PYTHON_MAJMIN}-config |
| 247 | |
| 248 | # Reformat _sysconfigdata after modifying it so that it remains |
| 249 | # reproducible |
| 250 | for c in ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/_sysconfigdata*.py; do |
| 251 | python3 ${WORKDIR}/reformat_sysconfig.py $c |
| 252 | done |
| 253 | |
| 254 | # Recompile _sysconfigdata after modifying it |
| 255 | cd ${PKGD} |
| 256 | sysconfigfile=`find . -name _sysconfigdata_*.py` |
| 257 | ${STAGING_BINDIR_NATIVE}/python3-native/python3 \ |
| 258 | -c "from py_compile import compile; compile('$sysconfigfile')" |
| 259 | ${STAGING_BINDIR_NATIVE}/python3-native/python3 \ |
| 260 | -c "from py_compile import compile; compile('$sysconfigfile', optimize=1)" |
| 261 | ${STAGING_BINDIR_NATIVE}/python3-native/python3 \ |
| 262 | -c "from py_compile import compile; compile('$sysconfigfile', optimize=2)" |
| 263 | cd - |
| 264 | |
| 265 | mv ${PKGD}/${bindir}/python${PYTHON_MAJMIN}-config ${PKGD}/${bindir}/python${PYTHON_MAJMIN}-config-${MULTILIB_SUFFIX} |
| 266 | |
| 267 | #Remove the unneeded copy of target sysconfig data |
| 268 | rm -rf ${PKGD}/${libdir}/python-sysconfigdata |
| 269 | } |
| 270 | |
| 271 | # We want bytecode precompiled .py files (.pyc's) by default |
| 272 | # but the user may set it on their own conf |
| 273 | INCLUDE_PYCS ?= "1" |
| 274 | |
| 275 | python(){ |
| 276 | import collections, json |
| 277 | |
| 278 | filename = os.path.join(d.getVar('THISDIR'), 'python3', 'python3-manifest.json') |
| 279 | # This python changes the datastore based on the contents of a file, so mark |
| 280 | # that dependency. |
| 281 | bb.parse.mark_dependency(d, filename) |
| 282 | |
| 283 | with open(filename) as manifest_file: |
| 284 | manifest_str = manifest_file.read() |
| 285 | json_start = manifest_str.find('# EOC') + 6 |
| 286 | manifest_file.seek(json_start) |
| 287 | manifest_str = manifest_file.read() |
| 288 | python_manifest = json.loads(manifest_str, object_pairs_hook=collections.OrderedDict) |
| 289 | |
| 290 | # First set RPROVIDES for -native case |
| 291 | # Hardcoded since it cant be python3-native-foo, should be python3-foo-native |
| 292 | pn = 'python3' |
| 293 | rprovides = (d.getVar('RPROVIDES') or "").split() |
| 294 | |
| 295 | # ${PN}-misc-native is not in the manifest |
| 296 | rprovides.append(pn + '-misc-native') |
| 297 | |
| 298 | for key in python_manifest: |
| 299 | pypackage = pn + '-' + key + '-native' |
| 300 | if pypackage not in rprovides: |
| 301 | rprovides.append(pypackage) |
| 302 | |
| 303 | d.setVar('RPROVIDES:class-native', ' '.join(rprovides)) |
| 304 | |
| 305 | # Then work on the target |
| 306 | include_pycs = d.getVar('INCLUDE_PYCS') |
| 307 | |
| 308 | packages = d.getVar('PACKAGES').split() |
| 309 | pn = d.getVar('PN') |
| 310 | |
| 311 | newpackages=[] |
| 312 | for key in python_manifest: |
| 313 | pypackage = pn + '-' + key |
| 314 | |
| 315 | if pypackage not in packages: |
| 316 | # We need to prepend, otherwise python-misc gets everything |
| 317 | # so we use a new variable |
| 318 | newpackages.append(pypackage) |
| 319 | |
| 320 | # "Build" python's manifest FILES, RDEPENDS and SUMMARY |
| 321 | d.setVar('FILES:' + pypackage, '') |
| 322 | for value in python_manifest[key]['files']: |
| 323 | d.appendVar('FILES:' + pypackage, ' ' + value) |
| 324 | |
| 325 | # Add cached files |
| 326 | if include_pycs == '1': |
| 327 | for value in python_manifest[key]['cached']: |
| 328 | d.appendVar('FILES:' + pypackage, ' ' + value) |
| 329 | |
| 330 | for value in python_manifest[key]['rdepends']: |
| 331 | # Make it work with or without $PN |
| 332 | if '${PN}' in value: |
| 333 | value=value.split('-', 1)[1] |
| 334 | d.appendVar('RDEPENDS:' + pypackage, ' ' + pn + '-' + value) |
| 335 | |
| 336 | for value in python_manifest[key].get('rrecommends', ()): |
| 337 | if '${PN}' in value: |
| 338 | value=value.split('-', 1)[1] |
| 339 | d.appendVar('RRECOMMENDS:' + pypackage, ' ' + pn + '-' + value) |
| 340 | |
| 341 | d.setVar('SUMMARY:' + pypackage, python_manifest[key]['summary']) |
| 342 | |
| 343 | # Prepending so to avoid python-misc getting everything |
| 344 | packages = newpackages + packages |
| 345 | d.setVar('PACKAGES', ' '.join(packages)) |
| 346 | d.setVar('ALLOW_EMPTY:${PN}-modules', '1') |
| 347 | d.setVar('ALLOW_EMPTY:${PN}-pkgutil', '1') |
| 348 | |
| 349 | if "pgo" in d.getVar("PACKAGECONFIG").split() and not bb.utils.contains('MACHINE_FEATURES', 'qemu-usermode', True, False, d): |
| 350 | bb.fatal("pgo cannot be enabled as there is no qemu-usermode support for this architecture/machine") |
| 351 | } |
| 352 | |
| 353 | # Files needed to create a new manifest |
| 354 | |
| 355 | do_create_manifest() { |
| 356 | # This task should be run with every new release of Python. |
| 357 | # We must ensure that PACKAGECONFIG enables everything when creating |
| 358 | # a new manifest, this is to base our new manifest on a complete |
| 359 | # native python build, containing all dependencies, otherwise the task |
| 360 | # wont be able to find the required files. |
| 361 | # e.g. BerkeleyDB is an optional build dependency so it may or may not |
| 362 | # be present, we must ensure it is. |
| 363 | |
| 364 | cd ${WORKDIR} |
| 365 | # This needs to be executed by python-native and NOT by HOST's python |
| 366 | nativepython3 create_manifest3.py ${PYTHON_MAJMIN} |
| 367 | cp python3-manifest.json.new ${THISDIR}/python3/python3-manifest.json |
| 368 | } |
| 369 | |
| 370 | # bitbake python -c create_manifest |
| 371 | # Make sure we have native python ready when we create a new manifest |
| 372 | addtask do_create_manifest after do_patch do_prepare_recipe_sysroot |
| 373 | |
| 374 | # manual dependency additions |
| 375 | RRECOMMENDS:${PN}-core:append:class-nativesdk = " nativesdk-python3-modules" |
| 376 | RRECOMMENDS:${PN}-crypt:append:class-target = " ${MLPREFIX}openssl ${MLPREFIX}ca-certificates" |
| 377 | RRECOMMENDS:${PN}-crypt:append:class-nativesdk = " ${MLPREFIX}openssl ${MLPREFIX}ca-certificates" |
| 378 | |
| 379 | # For historical reasons PN is empty and provided by python3-modules |
| 380 | FILES:${PN} = "" |
| 381 | RPROVIDES:${PN}-modules = "${PN}" |
| 382 | |
| 383 | FILES:${PN}-pydoc += "${bindir}/pydoc${PYTHON_MAJMIN} ${bindir}/pydoc3" |
| 384 | FILES:${PN}-idle += "${bindir}/idle3 ${bindir}/idle${PYTHON_MAJMIN}" |
| 385 | |
| 386 | # provide python-pyvenv from python3-venv |
| 387 | RPROVIDES:${PN}-venv += "${MLPREFIX}python3-pyvenv" |
| 388 | |
| 389 | # package libpython3 |
| 390 | PACKAGES =+ "libpython3 libpython3-staticdev" |
| 391 | FILES:libpython3 = "${libdir}/libpython*.so.*" |
| 392 | FILES:libpython3-staticdev += "${libdir}/python${PYTHON_MAJMIN}/config-${PYTHON_MAJMIN}-*/libpython${PYTHON_MAJMIN}.a" |
| 393 | INSANE_SKIP:${PN}-dev += "dev-elf" |
| 394 | INSANE_SKIP:${PN}-ptest = "dev-deps" |
| 395 | |
| 396 | # catch all the rest (unsorted) |
| 397 | PACKAGES += "${PN}-misc" |
| 398 | RDEPENDS:${PN}-misc += "\ |
| 399 | ${PN}-core \ |
| 400 | ${PN}-email \ |
| 401 | ${PN}-codecs \ |
| 402 | ${PN}-pydoc \ |
| 403 | ${PN}-pickle \ |
| 404 | ${PN}-audio \ |
| 405 | ${PN}-numbers \ |
| 406 | " |
| 407 | RDEPENDS:${PN}-modules:append:class-target = " ${MLPREFIX}python3-misc" |
| 408 | RDEPENDS:${PN}-modules:append:class-nativesdk = " ${MLPREFIX}python3-misc" |
| 409 | FILES:${PN}-misc = "${libdir}/python${PYTHON_MAJMIN} ${libdir}/python${PYTHON_MAJMIN}/lib-dynload" |
| 410 | |
| 411 | # catch manpage |
| 412 | PACKAGES += "${PN}-man" |
| 413 | FILES:${PN}-man = "${datadir}/man" |
| 414 | |
| 415 | # See https://bugs.python.org/issue18748 and https://bugs.python.org/issue37395 |
| 416 | RDEPENDS:libpython3:append:libc-glibc = " libgcc" |
| 417 | RDEPENDS:${PN}-ctypes:append:libc-glibc = " ${MLPREFIX}ldconfig" |
| 418 | RDEPENDS:${PN}-ptest = "${PN}-modules ${PN}-tests ${PN}-dev unzip bzip2 libgcc tzdata-europe coreutils sed" |
| 419 | RDEPENDS:${PN}-ptest:append:libc-glibc = " locale-base-tr-tr.iso-8859-9" |
| 420 | RDEPENDS:${PN}-tkinter += "${@bb.utils.contains('PACKAGECONFIG', 'tk', '${MLPREFIX}tk ${MLPREFIX}tk-lib', '', d)}" |
| 421 | RDEPENDS:${PN}-idle += "${@bb.utils.contains('PACKAGECONFIG', 'tk', '${PN}-tkinter ${MLPREFIX}tcl', '', d)}" |
| 422 | DEV_PKG_DEPENDENCY = "" |
| 423 | RDEPENDS:${PN}-pydoc += "${PN}-io" |
| 424 | |
| 425 | RDEPENDS:${PN}-tests:append:class-target = " ${MLPREFIX}bash" |
| 426 | RDEPENDS:${PN}-tests:append:class-nativesdk = " ${MLPREFIX}bash" |
| 427 | |
| 428 | # Python's tests contain large numbers of files we don't need in the recipe sysroots |
| 429 | SYSROOT_PREPROCESS_FUNCS += " py3_sysroot_cleanup" |
| 430 | py3_sysroot_cleanup () { |
| 431 | rm -rf ${SYSROOT_DESTDIR}${libdir}/python${PYTHON_MAJMIN}/test |
| 432 | } |