-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
MAINT: work around non-zero exit status of "pdftops -v" command. #14395
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MAINT: work around non-zero exit status of "pdftops -v" command. #14395
Conversation
|
Unfortunately I couldn't find a public bug report. The problem encountered here was detected with Homebrew's xpdf package (version 4.01.01), because of the following code in ok = parseArgs(argDesc, &argc, argv);
if (!ok || argc < 2 || argc > 3 || printVersion || printHelp) {
fprintf(stderr, "pdftops version %s\n", xpdfVersion);
fprintf(stderr, "%s\n", xpdfCopyright);
if (!printVersion) {
printUsage("pdftops", "<PDF-file> [<PS-file>]", argDesc);
}
exit(1);
} In other words, even if If the |
Seems fair. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While this is suppressing a CalledProcessError
it's actually the exist code that determines this, so maybe better call it ignore_exit_code
?
In the function responsible for probing the presence of external command ("_get_executable_info"), add an optional argument "ignore_error" (default False). If set to True, the external command is allowed to exit with non-zero status, and the content of the output is used anyway. This works around the problem with certain xpdf versions where the exit status of "pdftops -v" command is nonzero. Compatibility is maintained because the optional argument defaults to False which doesn't introduce any new behaviour.
The optional argument "ignore_error" is changed to "ignore_exit_code" based on the suggestion of @timhoffm.
c6cedea
to
ad5ffed
Compare
This is good suggestion and I've updated accordingly (and force-pushed after rebasing). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 looks good to me, thanks for your first code contribution to Matplotlib. Should we backport this to 3.1.1
, and maybe the 2.x
series too?
Owee, I'm MrMeeseeks, Look at me. There seem to be a conflict, please backport manually. Here are approximate instructions:
And apply the correct labels and milestones. Congratulation you did some good work ! Hopefully your backport PR will be tested by the continuous integration and merged soon! If these instruction are inaccurate, feel free to suggest an improvement. |
Thanks @congma ! |
… of "pdftops -v" command.
…395-on-v3.1.x Backport PR #14395 on branch v3.1.x (MAINT: work around non-zero exit status of "pdftops -v" command.)
This code path is not in 2.2.x, it came in via 32ed5bd which is in 3.0+. |
In the function responsible for probing the presence of external
command (
_get_executable_info
), add an optional argumentignore_error
(defaultFalse
). If set toTrue
, the external command isallowed to exit with non-zero status, and the content of the output is
used anyway.
This works around the problem with certain xpdf versions where the
exit status of
pdftops -v
command is nonzero.Compatibility is maintained because the optional argument defaults to
False which doesn't introduce any new behaviour.
PR Summary
PR Checklist
- [ ] Has Pytest style unit testsnot applicable- [ ] New features are documented, with examples if plot relatednot applicable- [ ] Documentation is sphinx and numpydoc compliant- [ ] Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)- [ ] Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way