diff --git a/glfw/__init__.py b/glfw/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/setup.cfg b/setup.cfg index 01baa811c..88d29e3fd 100644 --- a/setup.cfg +++ b/setup.cfg @@ -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 diff --git a/setup.py b/setup.py index c9456a250..92786fb4d 100755 --- a/setup.py +++ b/setup.py @@ -18,12 +18,16 @@ from collections import namedtuple 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)