@@ -2106,23 +2106,21 @@ class Ghostscript(SetupPackage):
2106
2106
optional = True
2107
2107
2108
2108
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'
2121
2117
output = check_output (command , shell = True ,
2122
2118
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 ()
2126
2124
2127
2125
2128
2126
class LaTeX (SetupPackage ):
0 commit comments