From 8f2576ed795dc3b0d0ed4330b4b9912ff7652243 Mon Sep 17 00:00:00 2001 From: Nikita Kniazev Date: Sat, 9 Jul 2016 19:21:09 +0300 Subject: [PATCH] Added support for `mgs` to Ghostscript dependecy checker --- setupext.py | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/setupext.py b/setupext.py index 14e7ae835b2..0da84e8ca06 100755 --- a/setupext.py +++ b/setupext.py @@ -2106,23 +2106,21 @@ class Ghostscript(SetupPackage): optional = True def check(self): - try: - if sys.platform == 'win32': - command = 'gswin32c --version' - try: - output = check_output(command, shell=True, - stderr=subprocess.STDOUT) - except subprocess.CalledProcessError: - command = 'gswin64c --version' - output = check_output(command, shell=True, - stderr=subprocess.STDOUT) - else: - command = 'gs --version' + if sys.platform == 'win32': + # mgs is the name in miktex + gs_execs = ['gswin32c', 'gswin64c', 'mgs', 'gs'] + else: + gs_execs = ['gs'] + for gs_exec in gs_execs: + try: + command = gs_exec + ' --version' output = check_output(command, shell=True, stderr=subprocess.STDOUT) - return "version %s" % output.decode()[:-1] - except (IndexError, ValueError, subprocess.CalledProcessError): - raise CheckFailed() + return "version %s" % output.decode()[:-1] + except (IndexError, ValueError, subprocess.CalledProcessError): + pass + + raise CheckFailed() class LaTeX(SetupPackage):