run_mypy: Check mypy version to avoid spurious errors

pull/8607/merge
Xavier Claessens 4 years ago committed by Daniel Mensinger
parent d5917c1b87
commit 97bedd015f
  1. 6
      run_mypy.py

@ -7,6 +7,8 @@ import subprocess
import sys
import typing as T
from mesonbuild.mesonlib import version_compare
modules = [
# fully typed submodules
'mesonbuild/ast',
@ -55,6 +57,10 @@ def check_mypy() -> None:
except ImportError:
print('Failed import mypy')
sys.exit(1)
from mypy.version import __version__ as mypy_version
if not version_compare(mypy_version, '>=0.902'):
print('mypy >=0.902 is required, older versions report spurious errors')
sys.exit(1)
def main() -> int:
check_mypy()

Loading…
Cancel
Save