Commit 85bf76f0 authored by Chris Lamb's avatar Chris Lamb 👀
Browse files

Improve "[X] may produce better output" messages. Based on a patch by Helmut...

Improve "[X] may produce better output" messages. Based on a patch by Helmut Grohne. (Closes: Debian:#1026982)
parent 12ff6147
Loading
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import os.path
from diffoscope.difference import Difference
from diffoscope.tools import python_module_missing
from diffoscope.profiling import profile
from diffoscope.tools import get_package_provider

from .utils.file import File
from .utils.archive import Archive
@@ -128,7 +129,9 @@ class FsImageFile(File):
                )
            )
        if not guestfs:
            pkg = get_package_provider("guestfs")
            infix = f" from the '{pkg}' package " if pkg else " "
            self.add_comment(
                "Installing the 'guestfs' package may produce a better output."
                f"Installing the 'guestfs' Python module{infix}may produce a better output."
            )
        return differences
+4 −2
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@ import logging
import os
import re

from diffoscope.tools import python_module_missing, tool_required
from diffoscope.tools import python_module_missing, tool_required, get_package_provider
from diffoscope.difference import Difference

from .utils.file import File
@@ -64,8 +64,10 @@ class PdfFile(File):
        xs = []

        if PyPDF2 is None:
            pkg = get_package_provider("pypdf2")
            infix = f" from the '{pkg}' package " if pkg else " "
            self.add_comment(
                "Installing the 'PyPDF2' package may produce a better output."
                f"Installing the 'PyPDF2' Python module{infix}may produce a better output."
            )
        else:
            difference = Difference.from_text(
+1 −1
Original line number Diff line number Diff line
@@ -41,7 +41,7 @@ class RequiredToolNotFound(Exception):
        x = get_package_provider(self.operation)
        if x:
            xs.append(
                "Installing the '{}' package may produce a better output.".format(
                "Installing the '{}' package may produce better output.".format(
                    x
                )
            )
+2 −0
Original line number Diff line number Diff line
@@ -81,6 +81,7 @@ EXTERNAL_TOOLS = {
        "FreeBSD": "gnupg",
        "guix": "gnupg",
    },
    "guestfs": {"debian": "python3-guestfs"},
    "gzip": {"debian": "gzip", "arch": "gzip", "guix": "gzip"},
    "h5dump": {"debian": "hdf5-tools", "arch": "hdf5", "guix": "hdf5"},
    "html2text": {"debian": "html2text"},
@@ -183,6 +184,7 @@ EXTERNAL_TOOLS = {
        "FreeBSD": "ghostscript9-base",
        "guix": "ghostscript",
    },
    "pypdf2": {"debian": "python3-pypdf2"},
    "radare2": {"debian": "radare2", "arch": "radare2", "guix": "radare2"},
    "readelf": {
        "debian": "binutils-multiarch",