From: Sebastian Wagner Date: Mon, 28 Oct 2019 12:13:33 +0000 (+0100) Subject: script/run_mypy: Support mypy 0.740 X-Git-Tag: v15.1.0~1048^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=057d5ee7fa20c9ea5aec74b021e55ec187c6e76b;p=ceph.git script/run_mypy: Support mypy 0.740 Signed-off-by: Sebastian Wagner Co-Authored-By: Ernesto Puerta <37327689+epuertat@users.noreply.github.com> --- diff --git a/src/script/run_mypy.sh b/src/script/run_mypy.sh index ee2e97911457c..318a2c622e622 100755 --- a/src/script/run_mypy.sh +++ b/src/script/run_mypy.sh @@ -3,11 +3,13 @@ # needs to be executed from the src directory. # generates a report at src/mypy_report.txt +set -e + python3 -m venv .mypy_venv . .mypy_venv/bin/activate -pip install $(find * -name requirements.txt | grep -v node_modules | awk '{print "-r " $0}') +! pip install $(find -name requirements.txt -not -path './frontend/*' -printf '-r%p ') pip install mypy MYPY_INI="$PWD"/mypy.ini @@ -29,6 +31,7 @@ popd SORT_MYPY=$(cat <<-EOF #!/bin/python3 +import re from collections import namedtuple class Line(namedtuple('Line', 'prefix no rest')): @@ -36,6 +39,8 @@ class Line(namedtuple('Line', 'prefix no rest')): def parse(cls, l): if not l: return cls('', 0, '') + if re.search('Found [0-9]+ errors in [0-9]+ files', l): + return cls('', 0, '') p, *rest = l.split(':', 2) if len(rest) == 1: return cls(p, 0, rest[0]) @@ -100,4 +105,4 @@ with open('mypy_report.txt', 'w') as f: EOF ) -python <(echo "$SORT_MYPY") \ No newline at end of file +python <(echo "$SORT_MYPY")