Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 1 | SUMMARY = "The Python Programming Language" |
| 2 | HOMEPAGE = "http://www.python.org" |
Andrew Geissler | 90fd73c | 2021-03-05 15:25:55 -0600 | [diff] [blame] | 3 | DESCRIPTION = "Python is a programming language that lets you work more quickly and integrate your systems more effectively." |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 4 | LICENSE = "PSFv2" |
| 5 | SECTION = "devel/python" |
| 6 | |
Andrew Geissler | 90fd73c | 2021-03-05 15:25:55 -0600 | [diff] [blame] | 7 | LIC_FILES_CHKSUM = "file://LICENSE;md5=c22d2438294c784731bf9dd224a467b7" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 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 \ |
Andrew Geissler | 6ce62a2 | 2020-11-30 19:58:47 -0600 | [diff] [blame] | 15 | file://reformat_sysconfig.py \ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 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 \ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 22 | file://0001-python3-use-cc_basename-to-replace-CC-for-checking-c.patch \ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 23 | file://0001-bpo-36852-proper-detection-of-mips-architecture-for-.patch \ |
| 24 | file://crosspythonpath.patch \ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 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-setup.py-pass-missing-libraries-to-Extension-for-mul.patch \ |
| 29 | file://0001-Makefile-do-not-compile-.pyc-in-parallel.patch \ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 30 | file://0020-configure.ac-setup.py-do-not-add-a-curses-include-pa.patch \ |
Andrew Geissler | 6ce62a2 | 2020-11-30 19:58:47 -0600 | [diff] [blame] | 31 | file://0001-Lib-sysconfig.py-use-libdir-values-from-configuratio.patch \ |
Andrew Geissler | 3b8a17c | 2021-04-15 15:55:55 -0500 | [diff] [blame] | 32 | file://0001-Skip-failing-tests-due-to-load-variability-on-YP-AB.patch \ |
Andrew Geissler | 5f35090 | 2021-07-23 13:09:54 -0400 | [diff] [blame^] | 33 | file://0001-test_ctypes.test_find-skip-without-tools-sdk.patch \ |
| 34 | file://makerace.patch \ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 35 | " |
| 36 | |
| 37 | SRC_URI_append_class-native = " \ |
| 38 | 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 Geissler | 5f35090 | 2021-07-23 13:09:54 -0400 | [diff] [blame^] | 42 | SRC_URI[sha256sum] = "397920af33efc5b97f2e0b57e91923512ef89fc5b3c1d21dbfc8c4828ce0108a" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 43 | |
| 44 | # exclude pre-releases for both python 2.x and 3.x |
| 45 | UPSTREAM_CHECK_REGEX = "[Pp]ython-(?P<pver>\d+(\.\d+)+).tar" |
Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 46 | UPSTREAM_CHECK_URI = "https://www.python.org/downloads/source/" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 47 | |
| 48 | CVE_PRODUCT = "python" |
| 49 | |
Andrew Geissler | 6ce62a2 | 2020-11-30 19:58:47 -0600 | [diff] [blame] | 50 | # Upstream consider this expected behaviour |
| 51 | CVE_CHECK_WHITELIST += "CVE-2007-4559" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 52 | # This is not exploitable when glibc has CVE-2016-10739 fixed. |
| 53 | CVE_CHECK_WHITELIST += "CVE-2019-18348" |
| 54 | |
Andrew Geissler | 6ce62a2 | 2020-11-30 19:58:47 -0600 | [diff] [blame] | 55 | # This is windows only issue. |
| 56 | CVE_CHECK_WHITELIST += "CVE-2020-15523" |
| 57 | |
| 58 | PYTHON_MAJMIN = "3.9" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 59 | |
| 60 | S = "${WORKDIR}/Python-${PV}" |
| 61 | |
| 62 | BBCLASSEXTEND = "native nativesdk" |
| 63 | |
| 64 | inherit autotools pkgconfig qemu ptest multilib_header update-alternatives |
| 65 | |
| 66 | MULTILIB_SUFFIX = "${@d.getVar('base_libdir',1).split('/')[-1]}" |
| 67 | |
| 68 | ALTERNATIVE_${PN}-dev = "python3-config" |
| 69 | ALTERNATIVE_LINK_NAME[python3-config] = "${bindir}/python${PYTHON_MAJMIN}-config" |
| 70 | ALTERNATIVE_TARGET[python3-config] = "${bindir}/python${PYTHON_MAJMIN}-config-${MULTILIB_SUFFIX}" |
| 71 | |
| 72 | |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 73 | DEPENDS = "bzip2-replacement-native libffi bzip2 openssl sqlite3 zlib virtual/libintl xz virtual/crypt util-linux libtirpc libnsl2 autoconf-archive-native" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 74 | DEPENDS_append_class-target = " python3-native" |
| 75 | DEPENDS_append_class-nativesdk = " python3-native" |
| 76 | |
Andrew Geissler | 6ce62a2 | 2020-11-30 19:58:47 -0600 | [diff] [blame] | 77 | EXTRA_OECONF = " --without-ensurepip --enable-shared --with-platlibdir=${baselib}" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 78 | EXTRA_OECONF_append_class-native = " --bindir=${bindir}/${PN}" |
| 79 | |
| 80 | export CROSSPYTHONPATH="${STAGING_LIBDIR_NATIVE}/python${PYTHON_MAJMIN}/lib-dynload/" |
| 81 | |
| 82 | EXTRANATIVEPATH += "python3-native" |
| 83 | |
Andrew Geissler | 6ce62a2 | 2020-11-30 19:58:47 -0600 | [diff] [blame] | 84 | # LTO will be enabled via packageconfig depending upong distro features |
| 85 | LTO_class-target = "" |
| 86 | |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 87 | CACHED_CONFIGUREVARS = " \ |
| 88 | ac_cv_file__dev_ptmx=yes \ |
| 89 | ac_cv_file__dev_ptc=no \ |
| 90 | ac_cv_working_tzset=yes \ |
| 91 | " |
Andrew Geissler | d25ed32 | 2020-06-27 00:28:28 -0500 | [diff] [blame] | 92 | |
| 93 | def possibly_include_pgo(d): |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 94 | # PGO currently causes builds to not be reproducible, so disable it for |
| 95 | # now. See YOCTO #13407 |
| 96 | if bb.utils.contains('MACHINE_FEATURES', 'qemu-usermode', True, False, d) and d.getVar('BUILD_REPRODUCIBLE_BINARIES') != '1': |
Andrew Geissler | d25ed32 | 2020-06-27 00:28:28 -0500 | [diff] [blame] | 97 | return 'pgo' |
| 98 | |
| 99 | return '' |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 100 | |
Andrew Geissler | 6ce62a2 | 2020-11-30 19:58:47 -0600 | [diff] [blame] | 101 | PACKAGECONFIG_class-target ??= "readline ${@possibly_include_pgo(d)} gdbm ${@bb.utils.filter('DISTRO_FEATURES', 'lto', d)}" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 102 | PACKAGECONFIG_class-native ??= "readline gdbm" |
| 103 | PACKAGECONFIG_class-nativesdk ??= "readline gdbm" |
| 104 | PACKAGECONFIG[readline] = ",,readline" |
| 105 | # Use profile guided optimisation by running PyBench inside qemu-user |
| 106 | PACKAGECONFIG[pgo] = "--enable-optimizations,,qemu-native" |
| 107 | PACKAGECONFIG[tk] = ",,tk" |
| 108 | PACKAGECONFIG[gdbm] = ",,gdbm" |
Andrew Geissler | 6ce62a2 | 2020-11-30 19:58:47 -0600 | [diff] [blame] | 109 | PACKAGECONFIG[lto] = "--with-lto,," |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 110 | |
| 111 | do_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('PACKAGECONFIG', 'readline', '', 'readline', d)} |
| 117 | EOF |
| 118 | } |
| 119 | |
| 120 | CPPFLAGS_append = " -I${STAGING_INCDIR}/ncursesw -I${STAGING_INCDIR}/uuid" |
| 121 | |
| 122 | EXTRA_OEMAKE = '\ |
| 123 | STAGING_LIBDIR=${STAGING_LIBDIR} \ |
| 124 | STAGING_INCDIR=${STAGING_INCDIR} \ |
| 125 | LIB=${baselib} \ |
| 126 | ' |
| 127 | |
| 128 | do_compile_prepend_class-target() { |
| 129 | if ${@bb.utils.contains('PACKAGECONFIG', 'pgo', 'true', 'false', d)}; then |
| 130 | qemu_binary="${@qemu_wrapper_cmdline(d, '${STAGING_DIR_TARGET}', ['${B}', '${STAGING_DIR_TARGET}/${base_libdir}'])}" |
| 131 | cat >pgo-wrapper <<EOF |
| 132 | #!/bin/sh |
| 133 | cd ${B} |
| 134 | $qemu_binary "\$@" |
| 135 | EOF |
| 136 | chmod +x pgo-wrapper |
| 137 | fi |
| 138 | } |
| 139 | |
| 140 | do_install_prepend() { |
| 141 | ${WORKDIR}/check_build_completeness.py ${T}/log.do_compile |
| 142 | } |
| 143 | |
| 144 | do_install_append_class-target() { |
| 145 | oe_multilib_header python${PYTHON_MAJMIN}/pyconfig.h |
| 146 | } |
| 147 | |
| 148 | do_install_append_class-native() { |
| 149 | # Make sure we use /usr/bin/env python |
| 150 | for PYTHSCRIPT in `grep -rIl ${bindir}/${PN}/python ${D}${bindir}/${PN}`; do |
| 151 | sed -i -e '1s|^#!.*|#!/usr/bin/env python3|' $PYTHSCRIPT |
| 152 | done |
| 153 | # Add a symlink to the native Python so that scripts can just invoke |
| 154 | # "nativepython" and get the right one without needing absolute paths |
| 155 | # (these often end up too long for the #! parser in the kernel as the |
| 156 | # buffer is 128 bytes long). |
| 157 | ln -s python3-native/python3 ${D}${bindir}/nativepython3 |
| 158 | } |
| 159 | |
| 160 | do_install_append() { |
| 161 | mkdir -p ${D}${libdir}/python-sysconfigdata |
| 162 | sysconfigfile=`find ${D} -name _sysconfig*.py` |
| 163 | cp $sysconfigfile ${D}${libdir}/python-sysconfigdata/_sysconfigdata.py |
| 164 | |
| 165 | sed -i \ |
| 166 | -e "s,^ 'LIBDIR'.*, 'LIBDIR': '${STAGING_LIBDIR}'\,,g" \ |
| 167 | -e "s,^ 'INCLUDEDIR'.*, 'INCLUDEDIR': '${STAGING_INCDIR}'\,,g" \ |
| 168 | -e "s,^ 'CONFINCLUDEDIR'.*, 'CONFINCLUDEDIR': '${STAGING_INCDIR}'\,,g" \ |
| 169 | -e "/^ 'INCLDIRSTOMAKE'/{N; s,/usr/include,${STAGING_INCDIR},g}" \ |
| 170 | -e "/^ 'INCLUDEPY'/s,/usr/include,${STAGING_INCDIR},g" \ |
| 171 | ${D}${libdir}/python-sysconfigdata/_sysconfigdata.py |
Andrew Geissler | 6ce62a2 | 2020-11-30 19:58:47 -0600 | [diff] [blame] | 172 | |
| 173 | # Unfortunately the following pyc files are non-deterministc due to 'frozenset' |
| 174 | # being written without strict ordering, even with PYTHONHASHSEED = 0 |
| 175 | # Upstream is discussing ways to solve the issue properly, until then let's |
| 176 | # just not install the problematic files. |
| 177 | # More info: http://benno.id.au/blog/2013/01/15/python-determinism |
| 178 | rm ${D}${libdir}/python${PYTHON_MAJMIN}/test/__pycache__/test_range.cpython* |
| 179 | rm ${D}${libdir}/python${PYTHON_MAJMIN}/test/__pycache__/test_xml_etree.cpython* |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 180 | } |
| 181 | |
| 182 | do_install_append_class-nativesdk () { |
Andrew Geissler | 90fd73c | 2021-03-05 15:25:55 -0600 | [diff] [blame] | 183 | # Make sure we use /usr/bin/env python |
| 184 | for PYTHSCRIPT in `grep -rIl ${bindir}/python ${D}${bindir}`; do |
| 185 | sed -i -e '1s|^#!.*|#!/usr/bin/env python3|' $PYTHSCRIPT |
| 186 | done |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 187 | create_wrapper ${D}${bindir}/python${PYTHON_MAJMIN} TERMINFO_DIRS='${sysconfdir}/terminfo:/etc/terminfo:/usr/share/terminfo:/usr/share/misc/terminfo:/lib/terminfo' PYTHONNOUSERSITE='1' |
| 188 | } |
| 189 | |
| 190 | SSTATE_SCAN_FILES += "Makefile _sysconfigdata.py" |
| 191 | PACKAGE_PREPROCESS_FUNCS += "py_package_preprocess" |
| 192 | |
| 193 | py_package_preprocess () { |
| 194 | # Remove references to buildmachine paths in target Makefile and _sysconfigdata |
| 195 | sed -i -e 's:--sysroot=${STAGING_DIR_TARGET}::g' -e s:'--with-libtool-sysroot=${STAGING_DIR_TARGET}'::g \ |
| 196 | -e 's|${DEBUG_PREFIX_MAP}||g' \ |
| 197 | -e 's:${HOSTTOOLS_DIR}/::g' \ |
| 198 | -e 's:${RECIPE_SYSROOT_NATIVE}::g' \ |
| 199 | -e 's:${RECIPE_SYSROOT}::g' \ |
| 200 | -e 's:${BASE_WORKDIR}/${MULTIMACH_TARGET_SYS}::g' \ |
| 201 | ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/config-${PYTHON_MAJMIN}${PYTHON_ABI}*/Makefile \ |
| 202 | ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/_sysconfigdata*.py \ |
| 203 | ${PKGD}/${bindir}/python${PYTHON_MAJMIN}-config |
| 204 | |
| 205 | # Reformat _sysconfigdata after modifying it so that it remains |
| 206 | # reproducible |
| 207 | for c in ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/_sysconfigdata*.py; do |
| 208 | python3 ${WORKDIR}/reformat_sysconfig.py $c |
| 209 | done |
| 210 | |
| 211 | # Recompile _sysconfigdata after modifying it |
| 212 | cd ${PKGD} |
| 213 | sysconfigfile=`find . -name _sysconfigdata_*.py` |
| 214 | ${STAGING_BINDIR_NATIVE}/python3-native/python3 \ |
| 215 | -c "from py_compile import compile; compile('$sysconfigfile')" |
| 216 | ${STAGING_BINDIR_NATIVE}/python3-native/python3 \ |
| 217 | -c "from py_compile import compile; compile('$sysconfigfile', optimize=1)" |
| 218 | ${STAGING_BINDIR_NATIVE}/python3-native/python3 \ |
| 219 | -c "from py_compile import compile; compile('$sysconfigfile', optimize=2)" |
| 220 | cd - |
| 221 | |
| 222 | mv ${PKGD}/${bindir}/python${PYTHON_MAJMIN}-config ${PKGD}/${bindir}/python${PYTHON_MAJMIN}-config-${MULTILIB_SUFFIX} |
| 223 | |
| 224 | #Remove the unneeded copy of target sysconfig data |
| 225 | rm -rf ${PKGD}/${libdir}/python-sysconfigdata |
| 226 | } |
| 227 | |
| 228 | # We want bytecode precompiled .py files (.pyc's) by default |
| 229 | # but the user may set it on their own conf |
| 230 | INCLUDE_PYCS ?= "1" |
| 231 | |
| 232 | python(){ |
| 233 | import collections, json |
| 234 | |
| 235 | filename = os.path.join(d.getVar('THISDIR'), 'python3', 'python3-manifest.json') |
| 236 | # This python changes the datastore based on the contents of a file, so mark |
| 237 | # that dependency. |
| 238 | bb.parse.mark_dependency(d, filename) |
| 239 | |
| 240 | with open(filename) as manifest_file: |
| 241 | manifest_str = manifest_file.read() |
| 242 | json_start = manifest_str.find('# EOC') + 6 |
| 243 | manifest_file.seek(json_start) |
| 244 | manifest_str = manifest_file.read() |
| 245 | python_manifest = json.loads(manifest_str, object_pairs_hook=collections.OrderedDict) |
| 246 | |
| 247 | # First set RPROVIDES for -native case |
| 248 | # Hardcoded since it cant be python3-native-foo, should be python3-foo-native |
| 249 | pn = 'python3' |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 250 | rprovides = (d.getVar('RPROVIDES') or "").split() |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 251 | |
| 252 | # ${PN}-misc-native is not in the manifest |
| 253 | rprovides.append(pn + '-misc-native') |
| 254 | |
| 255 | for key in python_manifest: |
| 256 | pypackage = pn + '-' + key + '-native' |
| 257 | if pypackage not in rprovides: |
| 258 | rprovides.append(pypackage) |
| 259 | |
| 260 | d.setVar('RPROVIDES_class-native', ' '.join(rprovides)) |
| 261 | |
| 262 | # Then work on the target |
| 263 | include_pycs = d.getVar('INCLUDE_PYCS') |
| 264 | |
| 265 | packages = d.getVar('PACKAGES').split() |
| 266 | pn = d.getVar('PN') |
| 267 | |
| 268 | newpackages=[] |
| 269 | for key in python_manifest: |
| 270 | pypackage = pn + '-' + key |
| 271 | |
| 272 | if pypackage not in packages: |
| 273 | # We need to prepend, otherwise python-misc gets everything |
| 274 | # so we use a new variable |
| 275 | newpackages.append(pypackage) |
| 276 | |
| 277 | # "Build" python's manifest FILES, RDEPENDS and SUMMARY |
| 278 | d.setVar('FILES_' + pypackage, '') |
| 279 | for value in python_manifest[key]['files']: |
| 280 | d.appendVar('FILES_' + pypackage, ' ' + value) |
| 281 | |
| 282 | # Add cached files |
| 283 | if include_pycs == '1': |
| 284 | for value in python_manifest[key]['cached']: |
| 285 | d.appendVar('FILES_' + pypackage, ' ' + value) |
| 286 | |
| 287 | for value in python_manifest[key]['rdepends']: |
| 288 | # Make it work with or without $PN |
| 289 | if '${PN}' in value: |
| 290 | value=value.split('-', 1)[1] |
| 291 | d.appendVar('RDEPENDS_' + pypackage, ' ' + pn + '-' + value) |
| 292 | |
| 293 | for value in python_manifest[key].get('rrecommends', ()): |
| 294 | if '${PN}' in value: |
| 295 | value=value.split('-', 1)[1] |
| 296 | d.appendVar('RRECOMMENDS_' + pypackage, ' ' + pn + '-' + value) |
| 297 | |
| 298 | d.setVar('SUMMARY_' + pypackage, python_manifest[key]['summary']) |
| 299 | |
| 300 | # Prepending so to avoid python-misc getting everything |
| 301 | packages = newpackages + packages |
| 302 | d.setVar('PACKAGES', ' '.join(packages)) |
| 303 | d.setVar('ALLOW_EMPTY_${PN}-modules', '1') |
| 304 | d.setVar('ALLOW_EMPTY_${PN}-pkgutil', '1') |
| 305 | } |
| 306 | |
| 307 | # Files needed to create a new manifest |
| 308 | |
| 309 | do_create_manifest() { |
| 310 | # This task should be run with every new release of Python. |
| 311 | # We must ensure that PACKAGECONFIG enables everything when creating |
| 312 | # a new manifest, this is to base our new manifest on a complete |
| 313 | # native python build, containing all dependencies, otherwise the task |
| 314 | # wont be able to find the required files. |
| 315 | # e.g. BerkeleyDB is an optional build dependency so it may or may not |
| 316 | # be present, we must ensure it is. |
| 317 | |
| 318 | cd ${WORKDIR} |
| 319 | # This needs to be executed by python-native and NOT by HOST's python |
| 320 | nativepython3 create_manifest3.py ${PYTHON_MAJMIN} |
| 321 | cp python3-manifest.json.new ${THISDIR}/python3/python3-manifest.json |
| 322 | } |
| 323 | |
| 324 | # bitbake python -c create_manifest |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 325 | # Make sure we have native python ready when we create a new manifest |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 326 | addtask do_create_manifest after do_patch do_prepare_recipe_sysroot |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 327 | |
| 328 | # manual dependency additions |
| 329 | RRECOMMENDS_${PN}-core_append_class-nativesdk = " nativesdk-python3-modules" |
Andrew Geissler | 1e34c2d | 2020-05-29 16:02:59 -0500 | [diff] [blame] | 330 | RRECOMMENDS_${PN}-crypt_append_class-target = " ${MLPREFIX}openssl ${MLPREFIX}ca-certificates" |
| 331 | RRECOMMENDS_${PN}-crypt_append_class-nativesdk = " ${MLPREFIX}openssl ${MLPREFIX}ca-certificates" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 332 | |
| 333 | # For historical reasons PN is empty and provided by python3-modules |
| 334 | FILES_${PN} = "" |
| 335 | RPROVIDES_${PN}-modules = "${PN}" |
| 336 | |
| 337 | FILES_${PN}-pydoc += "${bindir}/pydoc${PYTHON_MAJMIN} ${bindir}/pydoc3" |
| 338 | FILES_${PN}-idle += "${bindir}/idle3 ${bindir}/idle${PYTHON_MAJMIN}" |
| 339 | |
| 340 | # provide python-pyvenv from python3-venv |
Andrew Geissler | 1e34c2d | 2020-05-29 16:02:59 -0500 | [diff] [blame] | 341 | RPROVIDES_${PN}-venv += "${MLPREFIX}python3-pyvenv" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 342 | |
| 343 | # package libpython3 |
| 344 | PACKAGES =+ "libpython3 libpython3-staticdev" |
| 345 | FILES_libpython3 = "${libdir}/libpython*.so.*" |
| 346 | FILES_libpython3-staticdev += "${libdir}/python${PYTHON_MAJMIN}/config-${PYTHON_MAJMIN}-*/libpython${PYTHON_MAJMIN}.a" |
| 347 | INSANE_SKIP_${PN}-dev += "dev-elf" |
William A. Kennington III | ac69b48 | 2021-06-02 12:28:27 -0700 | [diff] [blame] | 348 | INSANE_SKIP_${PN}-ptest = "dev-deps" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 349 | |
| 350 | # catch all the rest (unsorted) |
| 351 | PACKAGES += "${PN}-misc" |
Andrew Geissler | d25ed32 | 2020-06-27 00:28:28 -0500 | [diff] [blame] | 352 | RDEPENDS_${PN}-misc += "\ |
| 353 | ${PN}-core \ |
| 354 | ${PN}-email \ |
| 355 | ${PN}-codecs \ |
| 356 | ${PN}-pydoc \ |
| 357 | ${PN}-pickle \ |
| 358 | ${PN}-audio \ |
| 359 | ${PN}-numbers \ |
| 360 | " |
Andrew Geissler | 1e34c2d | 2020-05-29 16:02:59 -0500 | [diff] [blame] | 361 | RDEPENDS_${PN}-modules_append_class-target = " ${MLPREFIX}python3-misc" |
| 362 | RDEPENDS_${PN}-modules_append_class-nativesdk = " ${MLPREFIX}python3-misc" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 363 | FILES_${PN}-misc = "${libdir}/python${PYTHON_MAJMIN} ${libdir}/python${PYTHON_MAJMIN}/lib-dynload" |
| 364 | |
| 365 | # catch manpage |
| 366 | PACKAGES += "${PN}-man" |
| 367 | FILES_${PN}-man = "${datadir}/man" |
| 368 | |
| 369 | # See https://bugs.python.org/issue18748 and https://bugs.python.org/issue37395 |
| 370 | RDEPENDS_libpython3_append_libc-glibc = " libgcc" |
Andrew Geissler | 475cb72 | 2020-07-10 16:00:51 -0500 | [diff] [blame] | 371 | RDEPENDS_${PN}-ctypes_append_libc-glibc = " ${MLPREFIX}ldconfig" |
William A. Kennington III | ac69b48 | 2021-06-02 12:28:27 -0700 | [diff] [blame] | 372 | RDEPENDS_${PN}-ptest = "${PN}-modules ${PN}-tests ${PN}-dev unzip bzip2 libgcc tzdata-europe coreutils sed" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 373 | RDEPENDS_${PN}-ptest_append_libc-glibc = " locale-base-tr-tr.iso-8859-9" |
| 374 | RDEPENDS_${PN}-tkinter += "${@bb.utils.contains('PACKAGECONFIG', 'tk', 'tk tk-lib', '', d)}" |
Andrew Geissler | d25ed32 | 2020-06-27 00:28:28 -0500 | [diff] [blame] | 375 | RDEPENDS_${PN}-idle += "${@bb.utils.contains('PACKAGECONFIG', 'tk', '${PN}-tkinter tcl', '', d)}" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 376 | RDEPENDS_${PN}-dev = "" |
Andrew Geissler | 95ac1b8 | 2021-03-31 14:34:31 -0500 | [diff] [blame] | 377 | RDEPENDS_${PN}-pydoc += "${PN}-io" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 378 | |
Andrew Geissler | 1e34c2d | 2020-05-29 16:02:59 -0500 | [diff] [blame] | 379 | RDEPENDS_${PN}-tests_append_class-target = " ${MLPREFIX}bash" |
| 380 | RDEPENDS_${PN}-tests_append_class-nativesdk = " ${MLPREFIX}bash" |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 381 | |
| 382 | # Python's tests contain large numbers of files we don't need in the recipe sysroots |
| 383 | SYSROOT_PREPROCESS_FUNCS += " py3_sysroot_cleanup" |
| 384 | py3_sysroot_cleanup () { |
| 385 | rm -rf ${SYSROOT_DESTDIR}${libdir}/python${PYTHON_MAJMIN}/test |
| 386 | } |