[diffoscope] 03/05: comparators.Image: Make it clearer we are running Identify on the original image, not the temporary img2txt one.

Chris Lamb chris at chris-lamb.co.uk
Sun Jan 15 12:52:37 CET 2017


This is an automated email from the git hooks/post-receive script.

lamby pushed a commit to branch master
in repository diffoscope.

commit e0c57c7431daf3aae935d8ee5e6fa8b1f5a78de5
Author: Chris Lamb <lamby at debian.org>
Date:   Sun Jan 15 22:43:16 2017 +1100

    comparators.Image: Make it clearer we are running Identify on the original image, not the temporary img2txt one.
    
    Signed-off-by: Chris Lamb <lamby at debian.org>
---
 diffoscope/comparators/image.py | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/diffoscope/comparators/image.py b/diffoscope/comparators/image.py
index 0bfe39d..6828209 100644
--- a/diffoscope/comparators/image.py
+++ b/diffoscope/comparators/image.py
@@ -103,21 +103,24 @@ class ICOImageFile(File):
         return ICOImageFile.RE_FILE_TYPE.search(file.magic_file_type)
 
     def compare_details(self, other, source=None):
+        differences = []
+
         # img2txt does not support .ico files directly so convert to .PNG.
         try:
-            xs = [ICOImageFile.convert(x) for x in (self, other)]
+            png_a, png_b = [ICOImageFile.convert(x) for x in (self, other)]
         except subprocess.CalledProcessError:
-            return []
+            pass
+        else:
+            differences.append(Difference.from_command(Img2Txt, png_a, png_b))
 
-        return [
-            Difference.from_command(Img2Txt, *xs),
-            Difference.from_command(
-                Identify,
-                self.path,
-                other.path,
-                source="Image metadata",
-            ),
-        ]
+        differences.append(Difference.from_command(
+            Identify,
+            self.path,
+            other.path,
+            source="Image metadata",
+        ))
+
+        return differences
 
     @staticmethod
     @tool_required('convert')

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/diffoscope.git


More information about the diffoscope mailing list