diff --git a/scripts/check_format.sh b/scripts/check_format.sh index d5f55f733..a061d2799 100755 --- a/scripts/check_format.sh +++ b/scripts/check_format.sh @@ -110,13 +110,21 @@ else fi rm -f scripts/posix.log -if hash pep8; then +if hash pep8 2>/dev/null; then + PEP8=pep8 +fi + +if hash pycodestyle 2>/dev/null; then + PEP8=pycodestyle +fi + +if [ ! -z ${PEP8} ]; then echo -n "Checking Python style..." PEP8_ARGS+=" --max-line-length=140" error=0 - git ls-files '*.py' | xargs -n1 pep8 $PEP8_ARGS > pep8.log || error=1 + git ls-files '*.py' | xargs -n1 $PEP8 $PEP8_ARGS > pep8.log || error=1 if [ $error -ne 0 ]; then echo " Python formatting errors detected" cat pep8.log diff --git a/scripts/pkgdep.sh b/scripts/pkgdep.sh index 03b9d3f3d..828bc5152 100755 --- a/scripts/pkgdep.sh +++ b/scripts/pkgdep.sh @@ -46,10 +46,10 @@ elif [ -f /etc/SuSE-release ]; then # Additional dependencies for building docs zypper install -y doxygen mscgen graphviz elif [ $SYSTEM = "FreeBSD" ] ; then - pkg install gmake cunit openssl git devel/astyle bash devel/pep8 \ + pkg install -y gmake cunit openssl git devel/astyle bash py27-pycodestyle \ python misc/e2fsprogs-libuuid sysutils/sg3_utils nasm # Additional dependencies for building docs - pkg install doxygen mscgen graphviz + pkg install -y doxygen mscgen graphviz else echo "pkgdep: unknown system type." exit 1 diff --git a/scripts/spdkcli.py b/scripts/spdkcli.py index c7c3867b0..4d794cab2 100755 --- a/scripts/spdkcli.py +++ b/scripts/spdkcli.py @@ -22,7 +22,7 @@ def main(): root_node = UIRoot(args.socket, shell) try: root_node.refresh() - except: + except BaseException: pass if len(args.commands) > 0: diff --git a/test/iscsi_tgt/rpc_config/rpc_config.py b/test/iscsi_tgt/rpc_config/rpc_config.py index 6ee2c5a42..dddd1e658 100755 --- a/test/iscsi_tgt/rpc_config/rpc_config.py +++ b/test/iscsi_tgt/rpc_config/rpc_config.py @@ -431,7 +431,7 @@ def verify_add_delete_ip_address(rpc_py): "add ip {} to nic {} failed.".format(faked_ip, x["name"])) try: check_call(ping_cmd.split()) - except: + except BaseException: verify(False, 1, "ping ip {} for {} was failed(adding was successful)".format (faked_ip, x["name"])) diff --git a/test/lvol/lvol_test.py b/test/lvol/lvol_test.py index 684430827..0eca30ed8 100755 --- a/test/lvol/lvol_test.py +++ b/test/lvol/lvol_test.py @@ -50,6 +50,6 @@ if __name__ == "__main__": print("RESULT: Some test cases FAIL") print(tc_failed) sys.exit(1) - except: + except BaseException: print("Test: {num_test} - FAIL".format(num_test=num_test)) sys.exit(1)