@@ -365,23 +365,27 @@ def checkdep_dvipng():
365
365
366
366
367
367
def checkdep_ghostscript ():
368
- if sys .platform == 'win32' :
369
- # mgs is the name in miktex
370
- gs_execs = ['gswin32c' , 'gswin64c' , 'mgs' , 'gs' ]
371
- else :
372
- gs_execs = ['gs' ]
373
- for gs_exec in gs_execs :
374
- try :
375
- s = subprocess .Popen (
376
- [gs_exec , '--version' ], stdout = subprocess .PIPE ,
377
- stderr = subprocess .PIPE )
378
- stdout , stderr = s .communicate ()
379
- if s .returncode == 0 :
380
- v = stdout [:- 1 ].decode ('ascii' )
381
- return gs_exec , v
382
- except (IndexError , ValueError , OSError ):
383
- pass
384
- return None , None
368
+ if checkdep_ghostscript .executable is None :
369
+ if sys .platform == 'win32' :
370
+ # mgs is the name in miktex
371
+ gs_execs = ['gswin32c' , 'gswin64c' , 'mgs' , 'gs' ]
372
+ else :
373
+ gs_execs = ['gs' ]
374
+ for gs_exec in gs_execs :
375
+ try :
376
+ s = subprocess .Popen (
377
+ [gs_exec , '--version' ], stdout = subprocess .PIPE ,
378
+ stderr = subprocess .PIPE )
379
+ stdout , stderr = s .communicate ()
380
+ if s .returncode == 0 :
381
+ v = stdout [:- 1 ].decode ('ascii' )
382
+ checkdep_ghostscript .executable = gs_exec
383
+ checkdep_ghostscript .version = v
384
+ except (IndexError , ValueError , OSError ):
385
+ pass
386
+ return checkdep_ghostscript .executable , checkdep_ghostscript .version
387
+ checkdep_ghostscript .executable = None
388
+ checkdep_ghostscript .version = None
385
389
386
390
387
391
def checkdep_tex ():
@@ -413,18 +417,21 @@ def checkdep_pdftops():
413
417
414
418
415
419
def checkdep_inkscape ():
416
- try :
417
- s = subprocess .Popen (['inkscape' , '-V' ], stdout = subprocess .PIPE ,
418
- stderr = subprocess .PIPE )
419
- stdout , stderr = s .communicate ()
420
- lines = stdout .decode ('ascii' ).split ('\n ' )
421
- for line in lines :
422
- if 'Inkscape' in line :
423
- v = line .split ()[1 ]
424
- break
425
- return v
426
- except (IndexError , ValueError , UnboundLocalError , OSError ):
427
- return None
420
+ if checkdep_inkscape .version is None :
421
+ try :
422
+ s = subprocess .Popen (['inkscape' , '-V' ], stdout = subprocess .PIPE ,
423
+ stderr = subprocess .PIPE )
424
+ stdout , stderr = s .communicate ()
425
+ lines = stdout .decode ('ascii' ).split ('\n ' )
426
+ for line in lines :
427
+ if 'Inkscape' in line :
428
+ v = line .split ()[1 ]
429
+ break
430
+ checkdep_inkscape .version = v
431
+ except (IndexError , ValueError , UnboundLocalError , OSError ):
432
+ pass
433
+ return checkdep_inkscape .version
434
+ checkdep_inkscape .version = None
428
435
429
436
430
437
def checkdep_xmllint ():
0 commit comments