Python 3 incompatibility detection using futurize
//Add migrated fixers to this file |
#!/bin/bash | |
set -e | |
# Enter space separated list of files to ignore. Note that this will ignore the files for all fixers. | |
declare -a EXLUDE_FILES=("dags/foo") | |
for file in ${EXLUDE_FILES[@]}; do | |
[ -f $file ] && mv $file $file.ignore | |
done | |
TMP="$(mktemp -d "/tmp/futurize-airflow-XXXXXX")" | |
echo $TMP | |
trap "rm -rf $TMP" EXIT INT QUIT TERM | |
# Create a new virtual environement to install futurize | |
VENV=".future-venv" | |
virtualenv --python=python3 "$VENV" | |
source $VENV/bin/activate | |
pip install future | |
# Create the futurize command to run | |
CMD="futurize" | |
for i in $(cat ./migrated-fixers);do | |
CMD="$CMD -f $i" | |
done | |
CMD="$CMD dags/ lib/ plugins/ tests/" | |
echo $CMD | |
eval '$CMD' | tee "$TMP/output" | |
# If there are incompatibilities, then the output file will not be empty. Exit with error if thats the case. | |
if [ -s "$TMP/output" ]; then | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment