I added the python-helloworld from https://github.com/yoctocookbook/meta-custom/tree/master/recipes-python/python-helloworld to my yocto build, which works fine. The files get precompiled and are copied to the image:
ls /usr/lib/python2.7/site-packages/helloworld
__init__.py __init__.pyc main.py main.pyc
I need to use python3. Changing inherit setuptools
to inherit setuptools3
in the recipe adds python 3.7 instead 2.7 to my image and the script works, but the precompiled files are now in the subfolder __pycache__
with an extension to their name:
ls /usr/lib/python3.7/site-packages/helloworld/__pycache__/
__init__.cpython-37.pyc main.cpython-37.pyc
I want to remove the .py source code files from the target build.
With setuptools
I can delete the .py files and the script works fine using the .pyc files. With setuptools3
, python3 raises a ModuleNotFoundError
after deleting the .py files.
Moving and renaming (like __pycache__/main.cpython-37.pyc
to main.pyc
) it works again.
What is the correct way to tell setuptools3
to create the precompiles .pyc files in the same way as setuptools
does to avoid this moving and renaming?
When reading through pep-3147 you seem to be relying on a legacy case 4 behavior but case 3 is normal behavior, I would suggest to not rely on legacy behavior as it is supposed to go away.