Andrew Geissler | e84b046 | 2020-04-14 11:25:29 -0500 | [diff] [blame] | 1 | inherit update-alternatives |
| 2 | |
| 3 | ALTERNATIVE_${PN}-core += "python" |
| 4 | ALTERNATIVE_LINK_NAME[python] = "${bindir}/python" |
| 5 | ALTERNATIVE_TARGET[python] = "${bindir}/python3" |
Andrew Geissler | d23fed5 | 2020-04-14 11:26:24 -0500 | [diff] [blame] | 6 | |
Andrew Geissler | f846a83 | 2020-04-15 10:26:16 -0500 | [diff] [blame] | 7 | # python3 takes up a lot of space that most embedded systems |
| 8 | # do not have, so remove some un-needed files from the rootfs |
Andrew Geissler | d23fed5 | 2020-04-14 11:26:24 -0500 | [diff] [blame] | 9 | do_install_append_class-target() { |
Andrew Geissler | f846a83 | 2020-04-15 10:26:16 -0500 | [diff] [blame] | 10 | # Even though python3 is built with --without-ensurepip, it still installs |
| 11 | # a large, compressed version of pip. Remove it to free up the space. |
Andrew Geissler | d23fed5 | 2020-04-14 11:26:24 -0500 | [diff] [blame] | 12 | rm -rf ${D}${libdir}/python${PYTHON_MAJMIN}/ensurepip |
Andrew Geissler | f846a83 | 2020-04-15 10:26:16 -0500 | [diff] [blame] | 13 | |
| 14 | # Remove all python .py files from python recipe. Only the .pyc |
| 15 | # files are required. |
| 16 | # The _sysconfigdata*.py files are system configuration files generated |
| 17 | # during build time. It's used in the yocto packaging process so |
| 18 | # it is required to remain in the image. |
| 19 | find ${D}${libdir}/python${PYTHON_MAJMIN} -name \*.py ! -name _sysconfigdata*.py -exec rm {} \; |
Andrew Geissler | d23fed5 | 2020-04-14 11:26:24 -0500 | [diff] [blame] | 20 | } |