Last active
February 18, 2016 15:55
-
-
Save ryansb/a794fb84c804775de2a5 to your computer and use it in GitHub Desktop.
Strip down a Python virtualenv by removing symbols from compiled files, thanks to @ogrisel for the tip!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
set -o pipefail | |
echo "venv original size $(du -sh $VIRTUAL_ENV)" | |
find $VIRTUAL_ENV/lib/python2.7/site-packages/ -name "*.so" | xargs strip | |
echo "venv after stripping $(du -sh $VIRTUAL_ENV)" | |
pushd $VIRTUAL_ENV/lib/python2.7/site-packages/ && zip -r -9 -q ~/venv.zip * ; popd | |
echo "final zip size $(du -sh venv.zip)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment