From bfe4a5b329b069f8e493e80c18b4091b2b65fba2 Mon Sep 17 00:00:00 2001 From: "James R. Barlow" Date: Tue, 22 Sep 2020 14:32:10 -0700 Subject: [PATCH] Tidy a log message --- src/ocrmypdf/builtin_plugins/ghostscript.py | 8 +++----- tests/test_validation.py | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/ocrmypdf/builtin_plugins/ghostscript.py b/src/ocrmypdf/builtin_plugins/ghostscript.py index 27f4a99b..de21fe30 100644 --- a/src/ocrmypdf/builtin_plugins/ghostscript.py +++ b/src/ocrmypdf/builtin_plugins/ghostscript.py @@ -39,13 +39,11 @@ def check_options(options): if gs_version < '9.20' and options.output_type != 'pdf' and not is_latin: # https://bugs.ghostscript.com/show_bug.cgi?id=696874 # Ghostscript < 9.20 fails to encode multibyte characters properly - msg = ( - "The installed version of Ghostscript does not work correctly " - "with the OCR languages you specified. Use --output-type pdf or " + log.warning( + f"The installed version of Ghostscript ({gs_version}) does not work " + "correctly with the OCR languages you specified. Use --output-type pdf or " "upgrade to Ghostscript 9.20 or later to avoid this issue." ) - msg += f"Found Ghostscript {gs_version}" - log.warning(msg) if options.output_type == 'pdfa': options.output_type = 'pdfa-2' diff --git a/tests/test_validation.py b/tests/test_validation.py index e4445435..06481c05 100644 --- a/tests/test_validation.py +++ b/tests/test_validation.py @@ -55,7 +55,7 @@ def test_old_ghostscript(caplog): vd._check_options( *make_opts_pm(language='chi_sim', output_type='pdfa'), {'chi_sim'} ) - assert 'Ghostscript does not work correctly' in caplog.text + assert 'does not work correctly' in caplog.text with patch('ocrmypdf._exec.ghostscript.version', return_value='9.18'), patch( 'ocrmypdf._exec.tesseract.has_textonly_pdf', return_value=True