Move qpdf complaint to after options checking so that it won't break ocrmypdf --version

This commit is contained in:
James R. Barlow
2017-11-29 13:42:55 -08:00
parent 64fd0cb54f
commit 2cc044feed

View File

@@ -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.)