From 4b69a600e576c98f0308551cb5a81116d74225f0 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 16 Aug 2022 10:04:12 +0530 Subject: [PATCH] Nicer error when go is not found during build --- setup.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 9c121943b..9133173c9 100755 --- a/setup.py +++ b/setup.py @@ -876,12 +876,16 @@ def safe_makedirs(path: str) -> None: def build_kitty_tool(args: Options, launcher_dir: str = '.') -> None: - cmd = ['go', 'build'] + go = shutil.which('go') + if not go: + raise SystemExit('The go tool was not found on this system. Install Go') + cmd = [go, 'build'] if args.verbose: cmd.append('-v') if not args.debug: cmd += ['-ldflags', '-s -w'] cmd += ['-o', os.path.join(launcher_dir, 'kitty-tool'), os.path.abspath('tools/cmd')] + print(shlex.join(cmd)) cp = subprocess.run(cmd) if cp.returncode != 0: raise SystemExit(cp.returncode)