Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d76fbc5

Browse filesBrowse files
authored
Merge pull request matplotlib#14505 from meeseeksmachine/auto-backport-of-pr-14395-on-v3.1.x
Backport PR matplotlib#14395 on branch v3.1.x (MAINT: work around non-zero exit status of "pdftops -v" command.)
2 parents 1c62bb7 + eb005ef commit d76fbc5
Copy full SHA for d76fbc5

File tree

Expand file treeCollapse file tree

1 file changed

+11
-4
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+11
-4
lines changed

‎lib/matplotlib/__init__.py

Copy file name to clipboardExpand all lines: lib/matplotlib/__init__.py
+11-4Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -313,14 +313,20 @@ def _get_executable_info(name):
313313
If the executable is not one that we know how to query.
314314
"""
315315

316-
def impl(args, regex, min_ver=None):
316+
def impl(args, regex, min_ver=None, ignore_exit_code=False):
317317
# Execute the subprocess specified by args; capture stdout and stderr.
318318
# Search for a regex match in the output; if the match succeeds, the
319319
# first group of the match is the version.
320320
# Return an _ExecInfo if the executable exists, and has a version of
321321
# at least min_ver (if set); else, raise FileNotFoundError.
322-
output = subprocess.check_output(
323-
args, stderr=subprocess.STDOUT, universal_newlines=True)
322+
try:
323+
output = subprocess.check_output(
324+
args, stderr=subprocess.STDOUT, universal_newlines=True)
325+
except subprocess.CalledProcessError as _cpe:
326+
if ignore_exit_code:
327+
output = _cpe.output
328+
else:
329+
raise _cpe
324330
match = re.search(regex, output)
325331
if match:
326332
version = LooseVersion(match.group(1))
@@ -377,7 +383,8 @@ def impl(args, regex, min_ver=None):
377383
"Failed to find an ImageMagick installation")
378384
return impl([path, "--version"], r"^Version: ImageMagick (\S*)")
379385
elif name == "pdftops":
380-
info = impl(["pdftops", "-v"], "^pdftops version (.*)")
386+
info = impl(["pdftops", "-v"], "^pdftops version (.*)",
387+
ignore_exit_code=True)
381388
if info and not ("3.0" <= info.version
382389
# poppler version numbers.
383390
or "0.9" <= info.version <= "1.0"):

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.