Created
May 15, 2016 21:55
-
-
Save stav/10875bfd57bf2a7f5125aa46900cba88 to your computer and use it in GitHub Desktop.
Remove Python bytecodes and deployment cache
This file contains 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 | |
if [ -n "$1" ]; then | |
TARGET="$1" | |
else | |
TARGET="." | |
fi | |
# Remove Python compiled bytecode files | |
command="find $TARGET -name '*.pyc' -type f -delete -print 2>/dev/null"; | |
eval "$command"; | |
# Remove python cache dirs | |
command="find $TARGET -name __pycache__ -type d -delete -print"; | |
eval "$command"; | |
# Remove dist dirs | |
command="find $TARGET -name dist -type d -print -exec rm -rf '{}' \;"; | |
eval "$command"; | |
# Remove build dirs | |
command="find $TARGET -name build -type d -print -exec rm -rf '{}' \;"; | |
eval "$command"; | |
# Remove build dirs created by Sphinx-doc | |
command="find $TARGET -name _build -type d -print -exec rm -rf '{}' \;"; | |
eval "$command"; | |
# Remove egg stuff | |
command="find $TARGET -name '*.egg-info' -type d -exec rm -rf '{}' \;"; | |
eval "$command"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment