Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
failed="no"
find . -name '*.py' -not -path "./.env/*" -not -path "./node_modules/*" -print0 |
while IFS= read -r -d $'\0' line; do
if [ -s $line ]; then
grep -L "from __future__ import unicode_literals" $line
if [ "$?" -ne "0" ]; then
failed="yes"
fi
fi
done
if [ $failed != "no" ]; then
echo
echo "The above files are not UTF-8 safe. Please add this to the top of the files:"
echo
echo "# -*- coding: utf-8 -*-"
echo
echo "from __future__ import unicode_literals"
echo
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.