From 2cc044feed06d4e5aa12987147736cbbcf5dbe53 Mon Sep 17 00:00:00 2001 From: "James R. Barlow" Date: Wed, 29 Nov 2017 13:42:55 -0800 Subject: [PATCH] Move qpdf complaint to after options checking so that it won't break ocrmypdf --version --- ocrmypdf/__main__.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/ocrmypdf/__main__.py b/ocrmypdf/__main__.py index e8af6a05..fc83830c 100755 --- a/ocrmypdf/__main__.py +++ b/ocrmypdf/__main__.py @@ -59,12 +59,6 @@ if tesseract.version() < MINIMUM_TESS_VERSION: MINIMUM_TESS_VERSION, tesseract.version())) sys.exit(ExitCode.missing_dependency) -if qpdf.version() < '7.0.0': - complain( - "You are using qpdf version {0} which has known issues and security " - "vulnerabilities handling certain PDFs. Consider upgrading to the " - "latest version.".format(qpdf.version())) - # ------------- # Parser @@ -689,6 +683,15 @@ def run_pipeline(): check_options(options, _log) + # Complain about qpdf version < 7.0.0 + # Suppress the warning if in the test suite, since there are no PPAs + # for qpdf 7.0.0 for Ubuntu trusty (i.e. Travis) + if qpdf.version() < '7.0.0' and not os.environ.get('PYTEST_CURRENT_TEST'): + complain( + "You are using qpdf version {0} which has known issues including " + "security vulnerabilities with certain malformed PDFs. Consider " + "upgrading to version 7.0.0 or newer.".format(qpdf.version())) + # Any changes to options will not take effect for options that are already # bound to function parameters in the pipeline. (For example # options.input_file, options.pdf_renderer are already bound.)