From a6a196699e0246d9f15c711b441a056c6f7a7f75 Mon Sep 17 00:00:00 2001 From: Tatyana Leontovich Date: Thu, 31 Oct 2013 22:32:14 +0200 Subject: [PATCH] Add run_tests.sh script with pep8 command execution Add pep8 command execution usage: ./run_tests.sh -p Change-Id: I558f7618a2e8533a35e63d4bdc001a8109f7fcf5 --- run_tests.sh | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100755 run_tests.sh diff --git a/run_tests.sh b/run_tests.sh new file mode 100755 index 00000000..818ef80e --- /dev/null +++ b/run_tests.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +function usage { + echo "Usage: $0 [OPTION]..." + echo "" + echo " -p, --pep8 Just run pep8" + echo " -h, --help Print this usage message" + echo "" + exit +} + +function process_option { + case "$1" in + -h|--help) usage;; + -p|--pep8) just_pep8=1;; + esac +} + +just_pep8=0 + +for arg in "$@"; do + process_option $arg +done + +function run_pep8 { + echo "Running pep8 ..." + # Opt-out files from pep8 + ignore_scripts="*.pyc,*.pyo,*.sh,*.swp,*.rst" + ignore_files="*eventlet-patch:*pip-requires" + ignore_dirs=".venv,.tox,dist,doc,vendor,*egg" + GLOBIGNORE="$ignore_scripts:$ignore_files:$ignore_dirs" + ignore="$ignore_scripts,$ignore_dirs" + srcfiles="." + ${wrapper} pep8 --repeat $FLAGS --show-source \ + --exclude=${ignore} ${srcfiles} | tee pep8.txt +} + +if [ $just_pep8 -eq 1 ]; then +run_pep8 + exit +fi +