Skip to content

Commit 28683b4

Browse files
nchammasJoshRosen
authored andcommitted
[SPARK-6219] Reuse pep8.py
Per the discussion in the comments on [this commit](apache@f17d43b#commitcomment-10780649), this PR allows the Python lint script to reuse `pep8.py` when possible. Author: Nicholas Chammas <[email protected]> Closes apache#5561 from nchammas/save-dem-pep8-bytes and squashes the following commits: b7c91e6 [Nicholas Chammas] reuse pep8.py
1 parent 327ebf0 commit 28683b4

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

dev/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pep8*.py

dev/lint-python

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,19 @@ compile_status="${PIPESTATUS[0]}"
3232
#+ See: https://github.com/apache/spark/pull/1744#issuecomment-50982162
3333
#+ TODOs:
3434
#+ - Download pep8 from PyPI. It's more "official".
35-
PEP8_SCRIPT_PATH="$SPARK_ROOT_DIR/dev/pep8.py"
36-
PEP8_SCRIPT_REMOTE_PATH="https://raw.githubusercontent.com/jcrocholl/pep8/1.6.2/pep8.py"
35+
PEP8_VERSION="1.6.2"
36+
PEP8_SCRIPT_PATH="$SPARK_ROOT_DIR/dev/pep8-$PEP8_VERSION.py"
37+
PEP8_SCRIPT_REMOTE_PATH="https://raw.githubusercontent.com/jcrocholl/pep8/$PEP8_VERSION/pep8.py"
3738

38-
# if [ ! -e "$PEP8_SCRIPT_PATH" ]; then
39-
curl --silent -o "$PEP8_SCRIPT_PATH" "$PEP8_SCRIPT_REMOTE_PATH"
40-
curl_status="$?"
39+
if [ ! -e "$PEP8_SCRIPT_PATH" ]; then
40+
curl --silent -o "$PEP8_SCRIPT_PATH" "$PEP8_SCRIPT_REMOTE_PATH"
41+
curl_status="$?"
4142

42-
if [ "$curl_status" -ne 0 ]; then
43-
echo "Failed to download pep8.py from \"$PEP8_SCRIPT_REMOTE_PATH\"."
44-
exit "$curl_status"
43+
if [ "$curl_status" -ne 0 ]; then
44+
echo "Failed to download pep8.py from \"$PEP8_SCRIPT_REMOTE_PATH\"."
45+
exit "$curl_status"
46+
fi
4547
fi
46-
# fi
4748

4849
# There is no need to write this output to a file
4950
#+ first, but we do so so that the check status can
@@ -65,7 +66,7 @@ else
6566
echo "Python lint checks passed."
6667
fi
6768

68-
rm "$PEP8_SCRIPT_PATH"
69+
# rm "$PEP8_SCRIPT_PATH"
6970
rm "$PYTHON_LINT_REPORT_PATH"
7071

7172
exit "$lint_status"

0 commit comments

Comments
 (0)