@@ -379,23 +379,13 @@ py_package_preprocess () {
${PKGD}/${libdir}/python${PYTHON_MAJMIN}/_sysconfigdata*.py \
${PKGD}/${bindir}/python${PYTHON_MAJMIN}-config
- # Reformat _sysconfigdata after modifying it so that it remains
+ # Reformat and recompile _sysconfigdata after modifying it so that it remains
# reproducible
for c in ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/_sysconfigdata*.py; do
python3 ${UNPACKDIR}/reformat_sysconfig.py $c
+ python3 -mcompileall $c -s ${PKGD} -p /
done
- # Recompile _sysconfigdata after modifying it
- cd ${PKGD}
- sysconfigfile=`find . -name _sysconfigdata_*.py`
- ${STAGING_BINDIR_NATIVE}/python3-native/python3 \
- -c "from py_compile import compile; compile('$sysconfigfile')"
- ${STAGING_BINDIR_NATIVE}/python3-native/python3 \
- -c "from py_compile import compile; compile('$sysconfigfile', optimize=1)"
- ${STAGING_BINDIR_NATIVE}/python3-native/python3 \
- -c "from py_compile import compile; compile('$sysconfigfile', optimize=2)"
- cd -
-
mv ${PKGD}/${bindir}/python${PYTHON_MAJMIN}-config ${PKGD}/${bindir}/python${PYTHON_MAJMIN}-config-${MULTILIB_SUFFIX}
#Remove the unneeded copy of target sysconfig data
There's no need to compile sysconfigdata.py for all optimisation levels, as we only ship the rest of the standard library compiled without optimisation: ... stringprep.cpython-314.pyc struct.cpython-314.pyc subprocess.cpython-314.pyc _sysconfigdata__linux_aarch64-linux-gnu.cpython-314.opt-1.pyc _sysconfigdata__linux_aarch64-linux-gnu.cpython-314.opt-2.pyc _sysconfigdata__linux_aarch64-linux-gnu.cpython-314.pyc textwrap.cpython-314.pyc threading.cpython-314.pyc token.cpython-314.pyc ... Invoke compileall as a module after reformatting the source, so we do not need to find the files twice. Pass the correct prefix manipulation so that the path to the source is correct. Previous, as the file was found with 'find', the source filename in the .pyc started with './usr/lib' instead of '/usr/lib'. Signed-off-by: Ross Burton <ross.burton@arm.com> --- meta/recipes-devtools/python/python3_3.14.10.bb | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-)