kubler
kubler copied to clipboard
Suggestion: Optional cleanup of pyc and pyo files
It might be desired add a function that cleans up created pyc,pyo files as the official python images do. https://github.com/docker-library/python/blob/master/3.6/jessie/Dockerfile#L58
People or us we can add that function call on the last stage of the build.sh to cleanup these files.
Idea being that is likely that those optimized files are not going to be useful on the target host where the container runs. Anyway those pyc pyo are generated automatically on start of a script (pyo might not be created though).
Afaik gentoo enforce the creation of these on the eclass https://wiki.gentoo.org/wiki/Project:Python/python-utils-r1#python_optimize
Edit: Aditionally I delete whl and pycache (now empty) folders. Though that might be an overkill. Edit2: removed from the list of dirs "testing" as it breaks numpy.
find ${_EMERGE_ROOT}/ -depth \
\( \
\( -type d -a -name test -o -name tests -o -name __pycache__ \) \
-o \
\( -type f -a -name '*.pyo' -o -name '*.pyc' -o -name '*.whl' \) \
\) -print -exec rm -rf '{}' +