tools/check-all: Optimize computing the list of Python files.

For reasons I don't totally understand, the previous code took like 2
seconds to compute the list of Python files.

(imported from commit 23668e7d79f1d69e1225389be7d8c8a3fbb6fad1)
This commit is contained in:
Tim Abbott 2012-10-25 15:06:30 -04:00
parent a01d641b2a
commit 6f1f2a15a1
1 changed files with 3 additions and 5 deletions

View File

@ -14,11 +14,9 @@ fi
cd "$SCRIPT_DIR"/..;
PYTHON_FILES=""
for file in $(git ls-files); do
if ([ -f "$file" ] && (head -n1 "$file" | grep -q "^#!.*python" ||
echo "$file" | grep -q [.]py$) && \
echo "$file" | egrep -vq '^(confirmation/|humbug/test_settings\.py)'); then
PYTHON_FILES=$(git ls-files | grep [.]py$ | egrep -v '^(confirmation/|humbug/test_settings\.py)')
for file in $(git ls-files | grep -v [.][^/]*$ | egrep -v '^(confirmation/|humbug/test_settings\.py)'); do
if [ -f "$file" ] && head -n1 "$file" | grep -q "^#!.*python"; then
PYTHON_FILES="$PYTHON_FILES $file"
fi
done