diff options
author | Daniel Mensinger <daniel@mensinger-ka.de> | 2020-09-29 10:33:53 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-29 10:33:53 +0200 |
commit | be2598a4e208860762b081e8398f6abbf6158a1c (patch) | |
tree | 4e0978b41e7e87af2bc8aa49e00ab441cc4d3398 /run_mypy.py | |
parent | a3e628092fb8bce670e0eb33e0d668683bdb2cde (diff) | |
parent | 2f3ef6f1afa7ac70f79075f88c9d72ba17c002ba (diff) | |
download | meson-be2598a4e208860762b081e8398f6abbf6158a1c.zip meson-be2598a4e208860762b081e8398f6abbf6158a1c.tar.gz meson-be2598a4e208860762b081e8398f6abbf6158a1c.tar.bz2 |
Merge pull request #7794 from mensinda/cmTyping
typing: CMake module
Diffstat (limited to 'run_mypy.py')
-rwxr-xr-x | run_mypy.py | 102 |
1 files changed, 54 insertions, 48 deletions
diff --git a/run_mypy.py b/run_mypy.py index db38112..04f563a 100755 --- a/run_mypy.py +++ b/run_mypy.py @@ -7,64 +7,70 @@ from pathlib import Path import typing as T modules = [ - # fully typed submodules - 'mesonbuild/ast', - 'mesonbuild/compilers/mixins', - 'mesonbuild/scripts', - 'mesonbuild/wrap', + # fully typed submodules + 'mesonbuild/ast', + 'mesonbuild/cmake', + 'mesonbuild/compilers/mixins', + 'mesonbuild/scripts', + 'mesonbuild/wrap', - # specific files - 'mesonbuild/arglist.py', - 'mesonbuild/compilers/compilers.py', - 'mesonbuild/compilers/c_function_attributes.py', - 'mesonbuild/compilers/objc.py', - 'mesonbuild/compilers/objcpp.py', - # 'mesonbuild/coredata.py', - 'mesonbuild/dependencies/boost.py', - 'mesonbuild/dependencies/hdf5.py', - 'mesonbuild/dependencies/mpi.py', - 'mesonbuild/envconfig.py', - 'mesonbuild/interpreterbase.py', - 'mesonbuild/linkers.py', - 'mesonbuild/mcompile.py', - 'mesonbuild/mesonlib.py', - 'mesonbuild/minit.py', - 'mesonbuild/mintro.py', - 'mesonbuild/mlog.py', - 'mesonbuild/modules/fs.py', - 'mesonbuild/mparser.py', - 'mesonbuild/msetup.py', - 'mesonbuild/mtest.py', + # specific files + 'mesonbuild/arglist.py', + 'mesonbuild/compilers/compilers.py', + 'mesonbuild/compilers/c_function_attributes.py', + 'mesonbuild/compilers/objc.py', + 'mesonbuild/compilers/objcpp.py', + # 'mesonbuild/coredata.py', + 'mesonbuild/dependencies/boost.py', + 'mesonbuild/dependencies/hdf5.py', + 'mesonbuild/dependencies/mpi.py', + 'mesonbuild/envconfig.py', + 'mesonbuild/interpreterbase.py', + 'mesonbuild/linkers.py', + 'mesonbuild/mcompile.py', + 'mesonbuild/mesonlib.py', + 'mesonbuild/minit.py', + 'mesonbuild/mintro.py', + 'mesonbuild/mlog.py', + 'mesonbuild/modules/fs.py', + 'mesonbuild/mparser.py', + 'mesonbuild/msetup.py', + 'mesonbuild/mtest.py', - 'run_mypy.py', - 'tools' + 'run_mypy.py', + 'tools' ] def check_mypy() -> None: - try: - import mypy - except ImportError: - print('Failed import mypy') - sys.exit(1) + try: + import mypy + except ImportError: + print('Failed import mypy') + sys.exit(1) def main() -> int: - check_mypy() + check_mypy() - root = Path(__file__).absolute().parent - args = [] # type: T.List[str] + 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 = 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') + opts = parser.parse_args() + if opts.pretty: + args.append('--pretty') - p = subprocess.run( - [sys.executable, '-m', 'mypy'] + args + modules, - cwd=root, - ) - return p.returncode + 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()) + sys.exit(main()) |