[Git][reproducible-builds/diffoscope][master] Improve "[X] may produce better output" messages. Based on a patch by Helmut...

Chris Lamb (@lamby) gitlab at salsa.debian.org
Sun Jan 1 12:53:06 UTC 2023



Chris Lamb pushed to branch master at Reproducible Builds / diffoscope


Commits:
85bf76f0 by Chris Lamb at 2023-01-01T12:52:30+00:00
Improve "[X] may produce better output" messages. Based on a patch by Helmut Grohne. (Closes: Debian:#1026982)

- - - - -


4 changed files:

- diffoscope/comparators/fsimage.py
- diffoscope/comparators/pdf.py
- diffoscope/exc.py
- diffoscope/external_tools.py


Changes:

=====================================
diffoscope/comparators/fsimage.py
=====================================
@@ -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


=====================================
diffoscope/comparators/pdf.py
=====================================
@@ -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(


=====================================
diffoscope/exc.py
=====================================
@@ -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
                 )
             )


=====================================
diffoscope/external_tools.py
=====================================
@@ -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",



View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/commit/85bf76f0deb398a89512a4675cfc3be8d4511902

-- 
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/commit/85bf76f0deb398a89512a4675cfc3be8d4511902
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.reproducible-builds.org/pipermail/rb-commits/attachments/20230101/62e81928/attachment.htm>


More information about the rb-commits mailing list