Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f1cb77f

Browse files
authored
Merge pull request #6711 from Kojoley/fix-ghostscript-dependency-check
ENH: Added support for `mgs` to Ghostscript dependecy checker
2 parents d6e2d81 + 8f2576e commit f1cb77f

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

setupext.py

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2106,23 +2106,21 @@ class Ghostscript(SetupPackage):
21062106
optional = True
21072107

21082108
def check(self):
2109-
try:
2110-
if sys.platform == 'win32':
2111-
command = 'gswin32c --version'
2112-
try:
2113-
output = check_output(command, shell=True,
2114-
stderr=subprocess.STDOUT)
2115-
except subprocess.CalledProcessError:
2116-
command = 'gswin64c --version'
2117-
output = check_output(command, shell=True,
2118-
stderr=subprocess.STDOUT)
2119-
else:
2120-
command = 'gs --version'
2109+
if sys.platform == 'win32':
2110+
# mgs is the name in miktex
2111+
gs_execs = ['gswin32c', 'gswin64c', 'mgs', 'gs']
2112+
else:
2113+
gs_execs = ['gs']
2114+
for gs_exec in gs_execs:
2115+
try:
2116+
command = gs_exec + ' --version'
21212117
output = check_output(command, shell=True,
21222118
stderr=subprocess.STDOUT)
2123-
return "version %s" % output.decode()[:-1]
2124-
except (IndexError, ValueError, subprocess.CalledProcessError):
2125-
raise CheckFailed()
2119+
return "version %s" % output.decode()[:-1]
2120+
except (IndexError, ValueError, subprocess.CalledProcessError):
2121+
pass
2122+
2123+
raise CheckFailed()
21262124

21272125

21282126
class LaTeX(SetupPackage):

0 commit comments

Comments
 (0)