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