diff --git a/dev/lint-python b/dev/lint-python index 50e52460be1e7..2d67084dd9587 100755 --- a/dev/lint-python +++ b/dev/lint-python @@ -22,11 +22,21 @@ SPARK_ROOT_DIR="$(dirname $SCRIPT_DIR)" PEP8_REPORT_PATH="$SPARK_ROOT_DIR/dev/pep8-report.txt" cd $SPARK_ROOT_DIR + +# See: https://github.com/apache/spark/pull/1744#issuecomment-50982162 +# Get pep8 at runtime so that we don't rely on it being installed on the build server. +# TODOs: +# - Dynamically determine latest release version of pep8 and use that. +# - Download this from a more reliable source. (GitHub raw can be flaky, apparently. (?)) +PEP8_SCRIPT_PATH="$SPARK_ROOT_DIR/dev/pep8.py" +curl --silent -o "$PEP8_SCRIPT_PATH" \ + "https://raw.githubusercontent.com/jcrocholl/pep8/1.5.7/pep8.py" + # There is no need to write this output to a file #+ first, but we do so so that the check status can #+ be output before the report, like with the #+ scalastyle and RAT checks. -pep8 ./python --exclude="cloudpickle.py" \ +python $PEP8_SCRIPT_PATH ./python --exclude="cloudpickle.py" \ > "$PEP8_REPORT_PATH" pep8_status=${PIPESTATUS[0]} #$? @@ -39,4 +49,6 @@ if [ $pep8_status -ne 0 ] fi rm -f "$PEP8_REPORT_PATH" +rm "$PEP8_SCRIPT_PATH" + exit $pep8_status