From 053ba7f08231d44e8bcea2eec5ddb3d1d728cf66 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 27 Feb 2018 19:56:52 +0530 Subject: [PATCH] Nicer error message when user tries to run logo/make.py with missing tools --- logo/make.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/logo/make.py b/logo/make.py index 9c09ba232..e61e35621 100755 --- a/logo/make.py +++ b/logo/make.py @@ -10,10 +10,17 @@ os.chdir(os.path.dirname(os.path.abspath(__file__))) src = os.path.abspath('kitty.svg') +def run(*args): + try: + subprocess.check_call(args) + except EnvironmentError: + raise SystemExit('You are missing the {} program needed to generate the kitty logo'.format(args[0])) + + def render(output, sz=256): print('Rendering at {0}x{0}...'.format(sz)) - subprocess.check_call(['rsvg-convert', '-w', str(sz), '-h', str(sz), '-o', output, src]) - subprocess.check_call(['optipng', '-quiet', '-o7', '-strip', 'all', output]) + run('rsvg-convert', '-w', str(sz), '-h', str(sz), '-o', output, src) + run('optipng', '-quiet', '-o7', '-strip', 'all', output) render('kitty.png')