Skip to content

Commit

Permalink
Run flake8 on Python instead of legacy Python (#7388)
Browse files Browse the repository at this point in the history
Blocked by: #7383, #7384, and #7385

Related to: #4552 #7322 

Signed-off-by: cclauss cclauss@me.com

Also adds more critical flake8 tests.

Signed-off-by: cclauss <cclauss@me.com>
  • Loading branch information
cclauss authored and htuch committed Jun 27, 2019
1 parent 9d2068f commit eb65b20
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
3 changes: 2 additions & 1 deletion tools/deprecate_features/deprecate_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import re
import subprocess
import fileinput
from six.moves import input


# Sorts out the list of deprecated proto fields which should be disallowed and returns a tuple of
Expand Down Expand Up @@ -89,7 +90,7 @@ def flip_runtime_features():
print('\n\nSuggested envoy-announce email: \n')
print(email)

if not raw_input('Apply relevant runtime changes? [yN] ').strip().lower() in ('y', 'yes'):
if not input('Apply relevant runtime changes? [yN] ').strip().lower() in ('y', 'yes'):
exit(1)

for line in fileinput.FileInput('source/common/runtime/runtime_features.cc', inplace=1):
Expand Down
8 changes: 5 additions & 3 deletions tools/format_python_tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ cd "$SCRIPTPATH"

source_venv "$VENV_DIR"
echo "Installing requirements..."
pip install -r requirements.txt
pip3 install --upgrade pip
pip3 install -r requirements.txt

echo "Running Python format check..."
python format_python_tools.py $1
python3 format_python_tools.py $1

echo "Running Python3 flake8 check..."
flake8 . --exclude=*/venv/* --count --select=E901,E999,F821,F822,F823 --show-source --statistics
python3 -m flake8 --version
python3 -m flake8 . --exclude=*/venv/* --count --select=E9,F63,F72,F82 --show-source --statistics
2 changes: 1 addition & 1 deletion tools/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
flake8==3.6.0
flake8==3.7.7
yapf==0.25.0
2 changes: 1 addition & 1 deletion tools/shell_utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ source_venv() {
VENV_DIR=$1
if [[ "$VIRTUAL_ENV" == "" ]]; then
if [[ ! -d "${VENV_DIR}"/venv ]]; then
virtualenv "${VENV_DIR}"/venv --no-site-packages --python=python2.7
virtualenv "${VENV_DIR}"/venv --no-site-packages --python=python3.5
fi
source "${VENV_DIR}"/venv/bin/activate
else
Expand Down

0 comments on commit eb65b20

Please sign in to comment.