From 4621ff41d9a964849088108ee2ccd0f40f87f411 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 27 Dec 2017 06:22:36 +0530 Subject: [PATCH] Skip building the wayland backend on systems with missing wayland protocol definitions Fixes #254 --- glfw/glfw.py | 2 ++ setup.py | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/glfw/glfw.py b/glfw/glfw.py index 57de4cce4..b440a667c 100755 --- a/glfw/glfw.py +++ b/glfw/glfw.py @@ -69,6 +69,8 @@ def init_env(env, pkg_config, at_least_version, module='x11'): def build_wayland_protocols(env, run_tool, emphasis, newer, dest_dir): for protocol in env.wayland_protocols: src = os.path.join(env.wayland_packagedir, protocol) + if not os.path.exists(src): + raise SystemExit('The wayland-protocols package on your system is missing the {} protocol definition file'.format(protocol)) for ext in 'hc': dest = wayland_protocol_file_name(src, ext) dest = os.path.join(dest_dir, dest) diff --git a/setup.py b/setup.py index 407624ae9..79dff7883 100755 --- a/setup.py +++ b/setup.py @@ -401,7 +401,12 @@ def compile_glfw(incremental, compilation_database, all_keys): sources = [os.path.join('glfw', x) for x in genv.sources] all_headers = [os.path.join('glfw', x) for x in genv.all_headers] if module == 'wayland': - glfw.build_wayland_protocols(genv, run_tool, emphasis, newer, os.path.join(base, 'glfw')) + try: + glfw.build_wayland_protocols(genv, run_tool, emphasis, newer, os.path.join(base, 'glfw')) + except SystemExit as err: + print(err, file=sys.stderr) + print(error('Disabling building of wayland backend'), file=sys.stderr) + continue compile_c_extension(genv, 'kitty/glfw-' + module, incremental, compilation_database, all_keys, sources, all_headers)