Skip to content

Instantly share code, notes, and snippets.

@teepark
Created March 1, 2011 02:50
Show Gist options
  • Save teepark/848508 to your computer and use it in GitHub Desktop.
Save teepark/848508 to your computer and use it in GitHub Desktop.
see which of your modules will shadow standard library modules
#!/usr/bin/env sh
EXCLUDES="htdocs mod py vendor tools client qa test"
stdlib_dir=`python -c 'import os; print os.path.dirname(os.__file__)'`
stdlib=`find $stdlib_dir -maxdepth 1 -name '*.py' -exec basename {} .py \;;\
find $stdlib_dir -maxdepth 2 -name __init__.py -exec dirname {} \; | xargs -L1 basename`
find `[ -n "$1" ] && echo $1 || echo .` \
-not \( -false \
`for name in $EXCLUDES; do
echo " -o -name $name -type d -prune"
done` \
\) \
\( -false \
`for name in $stdlib; do
echo " -o -name $name.py -type f -o -name $name -type d"
done` \
\)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment