]> code.ossystems Code Review - openembedded-core.git/commitdiff
pip_install_wheel: Recompile modified files
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 24 Feb 2022 23:41:55 +0000 (23:41 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 25 Feb 2022 15:06:46 +0000 (15:06 +0000)
If we modify the file, we need to recompile the pyc files since the file
hash has changed. This would otherwise result in reproducibility failrues.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes/pip_install_wheel.bbclass

index 70f47d6f79caa9906f402a8b819cb83a8dd82370..2f21a8ee56f814ce6c17d5546327c2f166cc36be 100644 (file)
@@ -32,6 +32,11 @@ pip_install_wheel_do_install () {
             sed -i -e "1s,#!.*nativepython3,#!${USRBINPATH}/env ${PIP_INSTALL_PYTHON}," $i
             sed -i -e "s:${PYTHON}:${USRBINPATH}/env\ ${PIP_INSTALL_PYTHON}:g" $i
             sed -i -e "s:${STAGING_BINDIR_NATIVE}:${bindir}:g" $i
+            # Recompile after modifying it
+            cd ${D}
+            file=`echo $i | sed 's:^${D}/::'`
+            ${STAGING_BINDIR_NATIVE}/python3-native/python3 -c "from py_compile import compile; compile('$file')"
+            cd -
         fi
     done
 }