Commit b7322649 authored by John Meneghini's avatar John Meneghini Committed by Jim Harris
Browse files

pkgdep: support pycodestyle in check_format.sh

 - install py27-pycodestyle on Freebsd
 - conditionally use pycodestyle in check_format.sh
 - fix various E722 do not use bare except errors caught by pycodestyle
 - see: https://github.com/PyCQA/pycodestyle/issues/466



Change-Id: I64ecf3f204a456134d891d1339f3aa1db281965a
Signed-off-by: default avatarJohn Meneghini <johnm@netapp.com>
Signed-off-by: default avatarEd Rodriguez <ed.rodriguez@netapp.com>
Reviewed-on: https://review.gerrithub.io/416460


Reviewed-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
parent 8a0a98d3
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -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
+2 −2
Original line number Diff line number Diff line
@@ -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
+1 −1
Original line number Diff line number Diff line
@@ -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:
+1 −1
Original line number Diff line number Diff line
@@ -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"]))
+1 −1
Original line number Diff line number Diff line
@@ -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)