@@ -283,7 +283,7 @@ def wrapper():
283
283
_ExecInfo = namedtuple ("_ExecInfo" , "executable version" )
284
284
285
285
286
- class ExecutableUnavailableError (FileNotFoundError ):
286
+ class ExecutableNotFoundError (FileNotFoundError ):
287
287
"""Error raised when an executable that Matplotlib optionally
288
288
depends on can't be found."""
289
289
pass
@@ -313,7 +313,7 @@ def _get_executable_info(name):
313
313
314
314
Raises
315
315
------
316
- ExecutableUnavailableError
316
+ ExecutableNotFoundError
317
317
If the executable is not found or older than the oldest version
318
318
supported by Matplotlib.
319
319
ValueError
@@ -325,27 +325,27 @@ def impl(args, regex, min_ver=None, ignore_exit_code=False):
325
325
# Search for a regex match in the output; if the match succeeds, the
326
326
# first group of the match is the version.
327
327
# Return an _ExecInfo if the executable exists, and has a version of
328
- # at least min_ver (if set); else, raise ExecutableUnavailableError .
328
+ # at least min_ver (if set); else, raise ExecutableNotFoundError .
329
329
try :
330
330
output = subprocess .check_output (
331
331
args , stderr = subprocess .STDOUT , universal_newlines = True )
332
332
except subprocess .CalledProcessError as _cpe :
333
333
if ignore_exit_code :
334
334
output = _cpe .output
335
335
else :
336
- raise ExecutableUnavailableError (str (_cpe )) from _cpe
336
+ raise ExecutableNotFoundError (str (_cpe )) from _cpe
337
337
except FileNotFoundError as _fnf :
338
- raise ExecutableUnavailableError (str (_fnf )) from _fnf
338
+ raise ExecutableNotFoundError (str (_fnf )) from _fnf
339
339
match = re .search (regex , output )
340
340
if match :
341
341
version = LooseVersion (match .group (1 ))
342
342
if min_ver is not None and version < min_ver :
343
- raise ExecutableUnavailableError (
343
+ raise ExecutableNotFoundError (
344
344
f"You have { args [0 ]} version { version } but the minimum "
345
345
f"version supported by Matplotlib is { min_ver } ." )
346
346
return _ExecInfo (args [0 ], version )
347
347
else :
348
- raise ExecutableUnavailableError (
348
+ raise ExecutableNotFoundError (
349
349
f"Failed to determine the version of { args [0 ]} from "
350
350
f"{ ' ' .join (args )} , which output { output } " )
351
351
@@ -358,10 +358,10 @@ def impl(args, regex, min_ver=None, ignore_exit_code=False):
358
358
for e in execs :
359
359
try :
360
360
return impl ([e , "--version" ], "(.*)" , "9" )
361
- except ExecutableUnavailableError :
361
+ except ExecutableNotFoundError :
362
362
pass
363
363
message = "Failed to find a Ghostscript installation"
364
- raise ExecutableUnavailableError (message )
364
+ raise ExecutableNotFoundError (message )
365
365
elif name == "inkscape" :
366
366
return impl (["inkscape" , "-V" ], "^Inkscape ([^ ]*)" )
367
367
elif name == "magick" :
@@ -389,7 +389,7 @@ def impl(args, regex, min_ver=None, ignore_exit_code=False):
389
389
else :
390
390
path = "convert"
391
391
if path is None :
392
- raise ExecutableUnavailableError (
392
+ raise ExecutableNotFoundError (
393
393
"Failed to find an ImageMagick installation" )
394
394
return impl ([path , "--version" ], r"^Version: ImageMagick (\S*)" )
395
395
elif name == "pdftops" :
@@ -398,7 +398,7 @@ def impl(args, regex, min_ver=None, ignore_exit_code=False):
398
398
if info and not ("3.0" <= info .version
399
399
# poppler version numbers.
400
400
or "0.9" <= info .version <= "1.0" ):
401
- raise ExecutableUnavailableError (
401
+ raise ExecutableNotFoundError (
402
402
f"You have pdftops version { info .version } but the minimum "
403
403
f"version supported by Matplotlib is 3.0." )
404
404
return info
@@ -487,14 +487,14 @@ def checkdep_ps_distiller(s):
487
487
return False
488
488
try :
489
489
_get_executable_info ("gs" )
490
- except ExecutableUnavailableError :
490
+ except ExecutableNotFoundError :
491
491
_log .warning (
492
492
"Setting rcParams['ps.usedistiller'] requires ghostscript." )
493
493
return False
494
494
if s == "xpdf" :
495
495
try :
496
496
_get_executable_info ("pdftops" )
497
- except ExecutableUnavailableError :
497
+ except ExecutableNotFoundError :
498
498
_log .warning (
499
499
"Setting rcParams['ps.usedistiller'] to 'xpdf' requires xpdf." )
500
500
return False
@@ -509,12 +509,12 @@ def checkdep_usetex(s):
509
509
return False
510
510
try :
511
511
_get_executable_info ("dvipng" )
512
- except ExecutableUnavailableError :
512
+ except ExecutableNotFoundError :
513
513
_log .warning ("usetex mode requires dvipng." )
514
514
return False
515
515
try :
516
516
_get_executable_info ("gs" )
517
- except ExecutableUnavailableError :
517
+ except ExecutableNotFoundError :
518
518
_log .warning ("usetex mode requires ghostscript." )
519
519
return False
520
520
return True
0 commit comments