The Meson Build System http://mesonbuild.com/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

112 lines
3.1 KiB

#!/usr/bin/env python3
from pathlib import Path
import argparse
import os
import subprocess
import sys
import typing as T
from mesonbuild.mesonlib import version_compare
modules = [
# fully typed submodules
# 'mesonbuild/ast',
'mesonbuild/cmake',
'mesonbuild/compilers',
'mesonbuild/dependencies',
'mesonbuild/interpreter/primitives',
'mesonbuild/interpreterbase',
'mesonbuild/linkers',
'mesonbuild/scripts',
'mesonbuild/wrap',
# specific files
'mesonbuild/arglist.py',
'mesonbuild/backend/backends.py',
# 'mesonbuild/coredata.py',
'mesonbuild/depfile.py',
'mesonbuild/envconfig.py',
'mesonbuild/interpreter/compiler.py',
'mesonbuild/interpreter/mesonmain.py',
'mesonbuild/interpreter/interpreterobjects.py',
'mesonbuild/interpreter/type_checking.py',
'mesonbuild/mcompile.py',
'mesonbuild/mdevenv.py',
'mesonbuild/utils/platform.py',
'mesonbuild/utils/universal.py',
'mesonbuild/minit.py',
'mesonbuild/minstall.py',
'mesonbuild/mintro.py',
'mesonbuild/mlog.py',
'mesonbuild/msubprojects.py',
'mesonbuild/modules/external_project.py',
'mesonbuild/modules/fs.py',
'mesonbuild/modules/gnome.py',
'mesonbuild/modules/i18n.py',
'mesonbuild/modules/icestorm.py',
'mesonbuild/modules/java.py',
'mesonbuild/modules/keyval.py',
'mesonbuild/modules/modtest.py',
'mesonbuild/modules/pkgconfig.py',
'mesonbuild/modules/qt.py',
'mesonbuild/modules/rust.py',
'mesonbuild/modules/sourceset.py',
'mesonbuild/modules/wayland.py',
'mesonbuild/modules/windows.py',
'mesonbuild/mparser.py',
'mesonbuild/msetup.py',
'mesonbuild/mtest.py',
'mesonbuild/optinterpreter.py',
'mesonbuild/programs.py',
'run_mypy.py',
'run_project_tests.py',
'run_single_test.py',
'tools',
'docs/genrefman.py',
'docs/refman',
]
if os.name == 'posix':
modules.append('mesonbuild/utils/posix.py')
elif os.name == 'nt':
modules.append('mesonbuild/utils/win32.py')
def check_mypy() -> None:
try:
import mypy
except ImportError:
print('Failed import mypy')
sys.exit(1)
from mypy.version import __version__ as mypy_version
if not version_compare(mypy_version, '>=0.812'):
print('mypy >=0.812 is required, older versions report spurious errors')
sys.exit(1)
def main() -> int:
check_mypy()
root = Path(__file__).absolute().parent
args = [] # type: T.List[str]
parser = argparse.ArgumentParser(description='Process some integers.')
parser.add_argument('-p', '--pretty', action='store_true', help='pretty print mypy errors')
parser.add_argument('-C', '--clear', action='store_true', help='clear the terminal before running mypy')
opts = parser.parse_args()
if opts.pretty:
args.append('--pretty')
if opts.clear:
print('\x1bc', end='', flush=True)
print('Running mypy (this can take some time) ...')
p = subprocess.run(
[sys.executable, '-m', 'mypy'] + args + modules,
cwd=root,
)
return p.returncode
if __name__ == '__main__':
sys.exit(main())