Add type checking for glfw module as well

This commit is contained in:
Kovid Goyal 2020-03-06 07:59:55 +05:30
parent 804998ca69
commit 6609d219f4
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
3 changed files with 9 additions and 5 deletions

0
glfw/__init__.py Normal file
View file

View file

@ -14,7 +14,7 @@ combine_as_imports = True
multi_line_output = 5
[mypy]
files = kitty,kittens,glfw/glfw.py,*.py
files = kitty,kittens,glfw,*.py
no_implicit_optional = True
sqlite_cache = True
cache_fine_grained = True

View file

@ -18,12 +18,16 @@
from contextlib import suppress
from functools import partial
from pathlib import Path
from typing import Callable, Dict, List, NamedTuple, Optional, Sequence, Tuple, Union, Iterator
from typing import (
Callable, Dict, Iterator, List, NamedTuple, Optional, Sequence, Tuple,
Union
)
from glfw import glfw
if sys.version_info[:2] < (3, 6):
raise SystemExit('kitty requires python >= 3.6')
base = os.path.dirname(os.path.abspath(__file__))
glfw = runpy.run_path('glfw/glfw.py')
verbose = False
del sys.path[0]
build_dir = 'build'
@ -563,7 +567,7 @@ def compile_glfw(compilation_database):
modules = 'cocoa' if is_macos else 'x11 wayland'
for module in modules.split():
try:
genv = glfw['init_env'](env, pkg_config, at_least_version, test_compile, module)
genv = glfw.init_env(env, pkg_config, at_least_version, test_compile, module)
except SystemExit as err:
if module != 'wayland':
raise
@ -574,7 +578,7 @@ def compile_glfw(compilation_database):
all_headers = [os.path.join('glfw', x) for x in genv.all_headers]
if module == 'wayland':
try:
glfw['build_wayland_protocols'](genv, Command, parallel_run, emphasis, newer, 'glfw')
glfw.build_wayland_protocols(genv, Command, parallel_run, emphasis, newer, 'glfw')
except SystemExit as err:
print(err, file=sys.stderr)
print(error('Disabling building of wayland backend'), file=sys.stderr)