Skip to content
Snippets Groups Projects
Commit 55742394 authored by Chris Lamb's avatar Chris Lamb :eyes:
Browse files

Factor out generating a human-readable comment when missing a Python module.

parent 7998aa03
No related branches found
No related tags found
No related merge requests found
......@@ -24,7 +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 diffoscope.tools import get_comment_for_missing_python_module
from .utils.file import File
from .utils.archive import Archive
......@@ -129,9 +129,5 @@ class FsImageFile(File):
)
)
if not guestfs:
pkg = get_package_provider("guestfs")
infix = f" from the '{pkg}' package " if pkg else " "
self.add_comment(
f"Installing the 'guestfs' Python module{infix}may produce a better output."
)
self.add_comment(get_comment_for_missing_python_module("guestfs"))
return differences
......@@ -191,4 +191,11 @@ def python_module_missing(name):
python_module_missing.modules.add(name)
def get_comment_for_missing_python_module(name):
pkg = get_package_provider(name)
infix = f" from the '{pkg}' package " if pkg else " "
return f"Installing the '{name}' Python module{infix}may produce a better output."
python_module_missing.modules = set()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment