This does not work: SYSROOT_PREPROCESS_FUNCS += " python_sysroot_cleanup" python_sysroot_cleanup () { rm -rf ${SYSROOT_DESTDIR}${libdir}/python${PYTHON_MAJMIN}/test } and interestingly and perhaps revealingly, it gives a warning about tab indentation in a python function when its a shell function. This works: SYSROOT_PREPROCESS_FUNCS += " py3_sysroot_cleanup" py3_sysroot_cleanup () { rm -rf ${SYSROOT_DESTDIR}${libdir}/python${PYTHON_MAJMIN}/test } so it would appear calling variables something with "python_" at the start is problematic.
http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=a30a06d9c1e6e585dba11d55266440de6f4ac35a