Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion: Optional cleanup of pyc and pyo files #137

Open
azimut opened this issue Dec 27, 2017 · 0 comments
Open

Suggestion: Optional cleanup of pyc and pyo files #137

azimut opened this issue Dec 27, 2017 · 0 comments

Comments

@azimut
Copy link
Contributor

azimut commented Dec 27, 2017

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 '{}' + 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants