@@ -2017,23 +2017,21 @@ class Ghostscript(SetupPackage):
2017
2017
optional = True
2018
2018
2019
2019
def check (self ):
2020
- try :
2021
- if sys .platform == 'win32' :
2022
- command = 'gswin32c --version'
2023
- try :
2024
- output = check_output (command , shell = True ,
2025
- stderr = subprocess .STDOUT )
2026
- except subprocess .CalledProcessError :
2027
- command = 'gswin64c --version'
2028
- output = check_output (command , shell = True ,
2029
- stderr = subprocess .STDOUT )
2030
- else :
2031
- command = 'gs --version'
2020
+ if sys .platform == 'win32' :
2021
+ # mgs is the name in miktex
2022
+ gs_execs = ['gswin32c' , 'gswin64c' , 'mgs' , 'gs' ]
2023
+ else :
2024
+ gs_execs = ['gs' ]
2025
+ for gs_exec in gs_execs :
2026
+ try :
2027
+ command = gs_exec + ' --version'
2032
2028
output = check_output (command , shell = True ,
2033
2029
stderr = subprocess .STDOUT )
2034
- return "version %s" % output .decode ()[:- 1 ]
2035
- except (IndexError , ValueError , subprocess .CalledProcessError ):
2036
- raise CheckFailed ()
2030
+ return "version %s" % output .decode ()[:- 1 ]
2031
+ except (IndexError , ValueError , subprocess .CalledProcessError ):
2032
+ pass
2033
+
2034
+ raise CheckFailed ()
2037
2035
2038
2036
2039
2037
class LaTeX (SetupPackage ):
0 commit comments