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

Skip to content

Commit 486df66

Browse files
committed
Rename new error
1 parent b6fe9e5 commit 486df66

File tree

5 files changed

+21
-21
lines changed

5 files changed

+21
-21
lines changed

lib/matplotlib/__init__.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ def wrapper():
283283
_ExecInfo = namedtuple("_ExecInfo", "executable version")
284284

285285

286-
class ExecutableUnavailableError(FileNotFoundError):
286+
class ExecutableNotFoundError(FileNotFoundError):
287287
"""Error raised when an executable that Matplotlib optionally
288288
depends on can't be found."""
289289
pass
@@ -313,7 +313,7 @@ def _get_executable_info(name):
313313
314314
Raises
315315
------
316-
ExecutableUnavailableError
316+
ExecutableNotFoundError
317317
If the executable is not found or older than the oldest version
318318
supported by Matplotlib.
319319
ValueError
@@ -325,27 +325,27 @@ def impl(args, regex, min_ver=None, ignore_exit_code=False):
325325
# Search for a regex match in the output; if the match succeeds, the
326326
# first group of the match is the version.
327327
# 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.
329329
try:
330330
output = subprocess.check_output(
331331
args, stderr=subprocess.STDOUT, universal_newlines=True)
332332
except subprocess.CalledProcessError as _cpe:
333333
if ignore_exit_code:
334334
output = _cpe.output
335335
else:
336-
raise ExecutableUnavailableError(str(_cpe)) from _cpe
336+
raise ExecutableNotFoundError(str(_cpe)) from _cpe
337337
except FileNotFoundError as _fnf:
338-
raise ExecutableUnavailableError(str(_fnf)) from _fnf
338+
raise ExecutableNotFoundError(str(_fnf)) from _fnf
339339
match = re.search(regex, output)
340340
if match:
341341
version = LooseVersion(match.group(1))
342342
if min_ver is not None and version < min_ver:
343-
raise ExecutableUnavailableError(
343+
raise ExecutableNotFoundError(
344344
f"You have {args[0]} version {version} but the minimum "
345345
f"version supported by Matplotlib is {min_ver}.")
346346
return _ExecInfo(args[0], version)
347347
else:
348-
raise ExecutableUnavailableError(
348+
raise ExecutableNotFoundError(
349349
f"Failed to determine the version of {args[0]} from "
350350
f"{' '.join(args)}, which output {output}")
351351

@@ -358,10 +358,10 @@ def impl(args, regex, min_ver=None, ignore_exit_code=False):
358358
for e in execs:
359359
try:
360360
return impl([e, "--version"], "(.*)", "9")
361-
except ExecutableUnavailableError:
361+
except ExecutableNotFoundError:
362362
pass
363363
message = "Failed to find a Ghostscript installation"
364-
raise ExecutableUnavailableError(message)
364+
raise ExecutableNotFoundError(message)
365365
elif name == "inkscape":
366366
return impl(["inkscape", "-V"], "^Inkscape ([^ ]*)")
367367
elif name == "magick":
@@ -389,7 +389,7 @@ def impl(args, regex, min_ver=None, ignore_exit_code=False):
389389
else:
390390
path = "convert"
391391
if path is None:
392-
raise ExecutableUnavailableError(
392+
raise ExecutableNotFoundError(
393393
"Failed to find an ImageMagick installation")
394394
return impl([path, "--version"], r"^Version: ImageMagick (\S*)")
395395
elif name == "pdftops":
@@ -398,7 +398,7 @@ def impl(args, regex, min_ver=None, ignore_exit_code=False):
398398
if info and not ("3.0" <= info.version
399399
# poppler version numbers.
400400
or "0.9" <= info.version <= "1.0"):
401-
raise ExecutableUnavailableError(
401+
raise ExecutableNotFoundError(
402402
f"You have pdftops version {info.version} but the minimum "
403403
f"version supported by Matplotlib is 3.0.")
404404
return info
@@ -487,14 +487,14 @@ def checkdep_ps_distiller(s):
487487
return False
488488
try:
489489
_get_executable_info("gs")
490-
except ExecutableUnavailableError:
490+
except ExecutableNotFoundError:
491491
_log.warning(
492492
"Setting rcParams['ps.usedistiller'] requires ghostscript.")
493493
return False
494494
if s == "xpdf":
495495
try:
496496
_get_executable_info("pdftops")
497-
except ExecutableUnavailableError:
497+
except ExecutableNotFoundError:
498498
_log.warning(
499499
"Setting rcParams['ps.usedistiller'] to 'xpdf' requires xpdf.")
500500
return False
@@ -509,12 +509,12 @@ def checkdep_usetex(s):
509509
return False
510510
try:
511511
_get_executable_info("dvipng")
512-
except ExecutableUnavailableError:
512+
except ExecutableNotFoundError:
513513
_log.warning("usetex mode requires dvipng.")
514514
return False
515515
try:
516516
_get_executable_info("gs")
517-
except ExecutableUnavailableError:
517+
except ExecutableNotFoundError:
518518
_log.warning("usetex mode requires ghostscript.")
519519
return False
520520
return True

lib/matplotlib/animation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -725,7 +725,7 @@ def bin_path(cls):
725725
def isAvailable(cls):
726726
try:
727727
return super().isAvailable()
728-
except mpl.ExecutableUnavailableError:
728+
except mpl.ExecutableNotFoundError:
729729
# May be raised by get_executable_info.
730730
return False
731731

lib/matplotlib/backends/backend_pgf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ def cairo_convert(pdffile, pngfile, dpi):
157157
return cairo_convert
158158
try:
159159
gs_info = mpl._get_executable_info("gs")
160-
except mpl.ExecutableUnavailableError:
160+
except mpl.ExecutableNotFoundError:
161161
pass
162162
else:
163163
def gs_convert(pdffile, pngfile, dpi):

lib/matplotlib/rcsetup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -483,14 +483,14 @@ def validate_ps_distiller(s):
483483
elif s in ('ghostscript', 'xpdf'):
484484
try:
485485
mpl._get_executable_info("gs")
486-
except mpl.ExecutableUnavailableError:
486+
except mpl.ExecutableNotFoundError:
487487
_log.warning("Setting rcParams['ps.usedistiller'] requires "
488488
"ghostscript.")
489489
return None
490490
if s == "xpdf":
491491
try:
492492
mpl._get_executable_info("pdftops")
493-
except mpl.ExecutableUnavailableError:
493+
except mpl.ExecutableNotFoundError:
494494
_log.warning("Setting rcParams['ps.usedistiller'] to 'xpdf' "
495495
"requires xpdf.")
496496
return None

lib/matplotlib/testing/compare.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,13 +220,13 @@ def __call__(self, orig, dest):
220220
def _update_converter():
221221
try:
222222
mpl._get_executable_info("gs")
223-
except mpl.ExecutableUnavailableError:
223+
except mpl.ExecutableNotFoundError:
224224
pass
225225
else:
226226
converter['pdf'] = converter['eps'] = _GSConverter()
227227
try:
228228
mpl._get_executable_info("inkscape")
229-
except mpl.ExecutableUnavailableError:
229+
except mpl.ExecutableNotFoundError:
230230
pass
231231
else:
232232
converter['svg'] = _SVGConverter()

0 commit comments

Comments
 (0)