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: John Meneghini <johnm@netapp.com> Signed-off-by: Ed Rodriguez <ed.rodriguez@netapp.com> Reviewed-on: https://review.gerrithub.io/416460 Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
This commit is contained in:
parent
8a0a98d35e
commit
b7322649db
@ -110,13 +110,21 @@ else
|
|||||||
fi
|
fi
|
||||||
rm -f scripts/posix.log
|
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..."
|
echo -n "Checking Python style..."
|
||||||
|
|
||||||
PEP8_ARGS+=" --max-line-length=140"
|
PEP8_ARGS+=" --max-line-length=140"
|
||||||
|
|
||||||
error=0
|
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
|
if [ $error -ne 0 ]; then
|
||||||
echo " Python formatting errors detected"
|
echo " Python formatting errors detected"
|
||||||
cat pep8.log
|
cat pep8.log
|
||||||
|
@ -46,10 +46,10 @@ elif [ -f /etc/SuSE-release ]; then
|
|||||||
# Additional dependencies for building docs
|
# Additional dependencies for building docs
|
||||||
zypper install -y doxygen mscgen graphviz
|
zypper install -y doxygen mscgen graphviz
|
||||||
elif [ $SYSTEM = "FreeBSD" ] ; then
|
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
|
python misc/e2fsprogs-libuuid sysutils/sg3_utils nasm
|
||||||
# Additional dependencies for building docs
|
# Additional dependencies for building docs
|
||||||
pkg install doxygen mscgen graphviz
|
pkg install -y doxygen mscgen graphviz
|
||||||
else
|
else
|
||||||
echo "pkgdep: unknown system type."
|
echo "pkgdep: unknown system type."
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -22,7 +22,7 @@ def main():
|
|||||||
root_node = UIRoot(args.socket, shell)
|
root_node = UIRoot(args.socket, shell)
|
||||||
try:
|
try:
|
||||||
root_node.refresh()
|
root_node.refresh()
|
||||||
except:
|
except BaseException:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if len(args.commands) > 0:
|
if len(args.commands) > 0:
|
||||||
|
@ -431,7 +431,7 @@ def verify_add_delete_ip_address(rpc_py):
|
|||||||
"add ip {} to nic {} failed.".format(faked_ip, x["name"]))
|
"add ip {} to nic {} failed.".format(faked_ip, x["name"]))
|
||||||
try:
|
try:
|
||||||
check_call(ping_cmd.split())
|
check_call(ping_cmd.split())
|
||||||
except:
|
except BaseException:
|
||||||
verify(False, 1,
|
verify(False, 1,
|
||||||
"ping ip {} for {} was failed(adding was successful)".format
|
"ping ip {} for {} was failed(adding was successful)".format
|
||||||
(faked_ip, x["name"]))
|
(faked_ip, x["name"]))
|
||||||
|
@ -50,6 +50,6 @@ if __name__ == "__main__":
|
|||||||
print("RESULT: Some test cases FAIL")
|
print("RESULT: Some test cases FAIL")
|
||||||
print(tc_failed)
|
print(tc_failed)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
except:
|
except BaseException:
|
||||||
print("Test: {num_test} - FAIL".format(num_test=num_test))
|
print("Test: {num_test} - FAIL".format(num_test=num_test))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
Loading…
Reference in New Issue
Block a user