[diffoscope] 01/02: comparators: ImageFile only supports JPEG images not .ico files so (temporarily) drop support for the latter and rename class.

Chris Lamb chris at chris-lamb.co.uk
Tue Jan 10 22:56:46 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 a74952154b85f86a321aef791cfc4748874705d4
Author: Chris Lamb <lamby at debian.org>
Date:   Tue Jan 10 21:54:25 2017 +0000

    comparators: ImageFile only supports JPEG images not .ico files so (temporarily) drop support for the latter and rename class.
    
    Signed-off-by: Chris Lamb <lamby at debian.org>
---
 diffoscope/comparators/__init__.py | 2 +-
 diffoscope/comparators/image.py    | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/diffoscope/comparators/__init__.py b/diffoscope/comparators/__init__.py
index 692f762..3807630 100644
--- a/diffoscope/comparators/__init__.py
+++ b/diffoscope/comparators/__init__.py
@@ -64,7 +64,7 @@ COMPARATORS = (
     ('apk.ApkFile',),
     ('zip.ZipFile',),
     ('zip.MozillaZipFile',),
-    ('image.ImageFile',),
+    ('image.JPEGImageFile',),
     ('cbfs.CbfsFile',),
     ('git.GitIndexFile',),
     ('openssh.PublicKeyFile',),
diff --git a/diffoscope/comparators/image.py b/diffoscope/comparators/image.py
index bf5e745..91091ec 100644
--- a/diffoscope/comparators/image.py
+++ b/diffoscope/comparators/image.py
@@ -42,12 +42,12 @@ class Img2Txt(Command):
         # Strip ANSI escapes
         return re_ansi_escapes.sub('', line.decode('utf-8')).encode('utf-8')
 
-class ImageFile(File):
-    RE_FILE_TYPE = re.compile(r'\bMS Windows icon resource|JPEG image data\b')
+class JPEGImageFile(File):
+    RE_FILE_TYPE = re.compile(r'\bJPEG image data\b')
 
     @staticmethod
     def recognizes(file):
-        return ImageFile.RE_FILE_TYPE.search(file.magic_file_type)
+        return JPEGImageFile.RE_FILE_TYPE.search(file.magic_file_type)
 
     def compare_details(self, other, source=None):
         return [Difference.from_command(Img2Txt, self.path, other.path)]

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


More information about the diffoscope mailing list