[Reproducible-commits] [diffoscope] 06/15: XXX

Jérémy Bobbio lunar at moszumanska.debian.org
Thu Dec 3 11:07:59 UTC 2015


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

lunar pushed a commit to branch pu/parallel2
in repository diffoscope.

commit 18cea4827fbe68e77a20dafd0111169a3f2e46de
Author: Jérémy Bobbio <lunar at debian.org>
Date:   Fri Oct 9 12:21:41 2015 +0000

    XXX
---
 diffoscope/comparators/binary.py   | 11 +++++------
 diffoscope/comparators/cpio.py     |  2 +-
 diffoscope/comparators/deb.py      |  2 +-
 diffoscope/comparators/debian.py   | 12 +++++++-----
 diffoscope/comparators/elf.py      | 14 ++++++++------
 diffoscope/comparators/fonts.py    |  2 +-
 diffoscope/comparators/gettext.py  |  2 +-
 diffoscope/comparators/gzip.py     |  2 +-
 diffoscope/comparators/haskell.py  |  2 +-
 diffoscope/comparators/iso9660.py  |  8 +++++---
 diffoscope/comparators/java.py     |  2 +-
 diffoscope/comparators/mono.py     |  2 +-
 diffoscope/comparators/pdf.py      |  4 ++--
 diffoscope/comparators/png.py      |  2 +-
 diffoscope/comparators/rpm.py      |  2 +-
 diffoscope/comparators/sqlite.py   |  2 +-
 diffoscope/comparators/squashfs.py |  4 ++--
 diffoscope/comparators/tar.py      |  2 +-
 diffoscope/comparators/zip.py      |  2 +-
 19 files changed, 42 insertions(+), 37 deletions(-)

diff --git a/diffoscope/comparators/binary.py b/diffoscope/comparators/binary.py
index 0bdb26c..6af63e4 100644
--- a/diffoscope/comparators/binary.py
+++ b/diffoscope/comparators/binary.py
@@ -173,14 +173,13 @@ class File(object, metaclass=ABCMeta):
     def compare_bytes(self, other, source=None):
         return compare_binary_files(self, other, source)
 
-    def _details_generators(self, other, source):
+    def _compare_using_details(self, other, source):
+        details = []
         if hasattr(self, 'compare_details'):
-            yield self.compare_details(other, source)
+            details.extend(self.compare_details(other, source))
         if self.as_container:
-            yield self.as_container.compare(other.as_container)
-
-    def _compare_using_details(self, other, source):
-        details = list(filter(None, itertools.chain.from_iterable(self._details_generators(other, source))))
+            details.extend(self.as_container.compare(other.as_container))
+        details = list(filter(None, details))
         if len(details) == 0:
             return None
         return Difference.from_details(self.name, other.name, details, source=source)
diff --git a/diffoscope/comparators/cpio.py b/diffoscope/comparators/cpio.py
index e79d88e..9c235b3 100644
--- a/diffoscope/comparators/cpio.py
+++ b/diffoscope/comparators/cpio.py
@@ -41,4 +41,4 @@ class CpioFile(File):
         return CpioFile.RE_FILE_TYPE.search(file.magic_file_type)
 
     def compare_details(self, other, source=None):
-        yield Difference.from_command(CpioContent, self.path, other.path, source="file list")
+        return [Difference.from_command(CpioContent, self.path, other.path, source="file list")]
diff --git a/diffoscope/comparators/deb.py b/diffoscope/comparators/deb.py
index 632337e..399b187 100644
--- a/diffoscope/comparators/deb.py
+++ b/diffoscope/comparators/deb.py
@@ -123,4 +123,4 @@ class DebDataTarFile(File):
                isinstance(file.container.source.container.source, DebFile)
 
     def compare_details(self, other, source=None):
-        yield Difference.from_command(TarListing, self.path, other.path)
+        return [Difference.from_command(TarListing, self.path, other.path)]
diff --git a/diffoscope/comparators/debian.py b/diffoscope/comparators/debian.py
index 1ff2a50..2fc8c83 100644
--- a/diffoscope/comparators/debian.py
+++ b/diffoscope/comparators/debian.py
@@ -104,6 +104,7 @@ class DebControlFile(File):
         return self._deb822
 
     def compare_details(self, other, source=None):
+        differences = []
         for field in sorted(set(self.deb822.keys()).union(set(other.deb822.keys()))):
             if field.startswith('Checksums-') or field == 'Files':
                 continue
@@ -113,12 +114,13 @@ class DebControlFile(File):
             other_value = ''
             if field in other.deb822:
                 other_value = other.deb822.get_as_string(field).lstrip()
-            yield Difference.from_text(my_value, other_value,
-                                       self.path, other.path, source=field)
+            differences.append(Difference.from_text(my_value, other_value,
+                                                    self.path, other.path, source=field))
         # compare Files as string
-        yield Difference.from_text(self.deb822.get_as_string('Files'),
-                                   other.deb822.get_as_string('Files'),
-                                   self.path, other.path, source='Files')
+        differences.append(Difference.from_text(self.deb822.get_as_string('Files'),
+                                                other.deb822.get_as_string('Files'),
+                                                self.path, other.path, source='Files'))
+        return differences
 
 class DotChangesFile(DebControlFile):
     RE_FILE_EXTENSION = re.compile(r'\.changes$')
diff --git a/diffoscope/comparators/elf.py b/diffoscope/comparators/elf.py
index 59c63e8..d21b08e 100644
--- a/diffoscope/comparators/elf.py
+++ b/diffoscope/comparators/elf.py
@@ -77,9 +77,9 @@ class ObjdumpDisassemble(Command):
             return line
 
 def _compare_elf_data(path1, path2):
-    yield Difference.from_command(ReadelfAll, path1, path2)
-    yield Difference.from_command(ReadelfDebugDump, path1, path2)
-    yield Difference.from_command(ObjdumpDisassemble, path1, path2)
+    return [Difference.from_command(ReadelfAll, path1, path2),
+            Difference.from_command(ReadelfDebugDump, path1, path2),
+            Difference.from_command(ObjdumpDisassemble, path1, path2)]
 
 class ElfFile(File):
     RE_FILE_TYE = re.compile(r'^ELF ')
@@ -89,7 +89,7 @@ class ElfFile(File):
         return ElfFile.RE_FILE_TYE.match(file.magic_file_type)
 
     def compare_details(self, other, source=None):
-        yield from _compare_elf_data(self.path, other.path)
+        return _compare_elf_data(self.path, other.path)
 
 class StaticLibFile(File):
     RE_FILE_TYPE = re.compile(r'\bar archive\b')
@@ -100,7 +100,9 @@ class StaticLibFile(File):
         return StaticLibFile.RE_FILE_TYPE.search(file.magic_file_type) and StaticLibFile.RE_FILE_EXTENSION.search(file.name)
 
     def compare_details(self, other, source=None):
+        differences = []
         content1 = get_ar_content(self.path)
         content2 = get_ar_content(other.path)
-        yield Difference.from_text(content1, content2, self.path, other.path, source="metadata")
-        yield from _compare_elf_data(self.path, other.path)
+        differences.append(Difference.from_text(content1, content2, self.path, other.path, source="metadata"))
+        differences.extend(_compare_elf_data(self.path, other.path))
+        return differences
diff --git a/diffoscope/comparators/fonts.py b/diffoscope/comparators/fonts.py
index fd4ae93..187655a 100644
--- a/diffoscope/comparators/fonts.py
+++ b/diffoscope/comparators/fonts.py
@@ -41,4 +41,4 @@ class TtfFile(File):
         return TtfFile.RE_FILE_TYPE.match(file.magic_file_type)
 
     def compare_details(self, other, source=None):
-        yield Difference.from_command(Showttf, self.path, other.path)
+        return [Difference.from_command(Showttf, self.path, other.path)]
diff --git a/diffoscope/comparators/gettext.py b/diffoscope/comparators/gettext.py
index 29252fa..b739900 100644
--- a/diffoscope/comparators/gettext.py
+++ b/diffoscope/comparators/gettext.py
@@ -64,4 +64,4 @@ class MoFile(File):
         return MoFile.RE_FILE_TYPE.match(file.magic_file_type)
 
     def compare_details(self, other, source=None):
-        yield Difference.from_command(Msgunfmt, self.path, other.path)
+        return [Difference.from_command(Msgunfmt, self.path, other.path)]
diff --git a/diffoscope/comparators/gzip.py b/diffoscope/comparators/gzip.py
index 6d1dac5..a8b19c8 100644
--- a/diffoscope/comparators/gzip.py
+++ b/diffoscope/comparators/gzip.py
@@ -59,4 +59,4 @@ class GzipFile(object):
         return GzipFile.RE_FILE_TYPE.match(file.magic_file_type)
 
     def compare_details(self, other, source=None):
-        yield Difference.from_text(self.magic_file_type, other.magic_file_type, self, other, source='metadata')
+        return [Difference.from_text(self.magic_file_type, other.magic_file_type, self, other, source='metadata')]
diff --git a/diffoscope/comparators/haskell.py b/diffoscope/comparators/haskell.py
index f7b0e5c..7bd4025 100644
--- a/diffoscope/comparators/haskell.py
+++ b/diffoscope/comparators/haskell.py
@@ -83,4 +83,4 @@ class HiFile(File):
             return True
 
     def compare_details(self, other, source=None):
-        yield Difference.from_command(ShowIface, self.path, other.path)
+        return [Difference.from_command(ShowIface, self.path, other.path)]
diff --git a/diffoscope/comparators/iso9660.py b/diffoscope/comparators/iso9660.py
index 235a18b..c59b741 100644
--- a/diffoscope/comparators/iso9660.py
+++ b/diffoscope/comparators/iso9660.py
@@ -70,7 +70,9 @@ class Iso9660File(File):
         return Iso9660File.RE_FILE_TYPE.search(file.magic_file_type)
 
     def compare_details(self, other, source=None):
-        yield Difference.from_command(ISO9660PVD, self.path, other.path)
-        yield Difference.from_command(ISO9660Listing, self.path, other.path)
+        differences = []
+        differences.append(Difference.from_command(ISO9660PVD, self.path, other.path))
+        differences.append(Difference.from_command(ISO9660Listing, self.path, other.path))
         for extension in ('joliet', 'rockridge'):
-            yield Difference.from_command(ISO9660Listing, self.path, other.path, command_args=(extension,), suppress_errors=(subprocess.CalledProcessError,))
+            differences.append(Difference.from_command(ISO9660Listing, self.path, other.path, command_args=(extension,), suppress_errors=(subprocess.CalledProcessError,)))
+        return differences
diff --git a/diffoscope/comparators/java.py b/diffoscope/comparators/java.py
index edea2f2..f8b6b5e 100644
--- a/diffoscope/comparators/java.py
+++ b/diffoscope/comparators/java.py
@@ -49,4 +49,4 @@ class ClassFile(File):
         return ClassFile.RE_FILE_TYPE.match(file.magic_file_type)
 
     def compare_details(self, other, source=None):
-        yield Difference.from_command(Javap, self.path, other.path)
+        return [Difference.from_command(Javap, self.path, other.path)]
diff --git a/diffoscope/comparators/mono.py b/diffoscope/comparators/mono.py
index a9281ee..cfbf87d 100644
--- a/diffoscope/comparators/mono.py
+++ b/diffoscope/comparators/mono.py
@@ -39,4 +39,4 @@ class MonoExeFile(File):
         return MonoExeFile.RE_FILE_TYPE.search(file.magic_file_type)
 
     def compare_details(self, other, source=None):
-        yield Difference.from_command(Pedump, self.path, other.path)
+        return [Difference.from_command(Pedump, self.path, other.path)]
diff --git a/diffoscope/comparators/pdf.py b/diffoscope/comparators/pdf.py
index d247ca8..7df3ff0 100644
--- a/diffoscope/comparators/pdf.py
+++ b/diffoscope/comparators/pdf.py
@@ -47,5 +47,5 @@ class PdfFile(File):
         return PdfFile.RE_FILE_TYPE.match(file.magic_file_type)
 
     def compare_details(self, other, source=None):
-        yield Difference.from_command(Pdftotext, self.path, other.path)
-        yield Difference.from_command(Pdftk, self.path, other.path)
+        return [Difference.from_command(Pdftotext, self.path, other.path),
+                Difference.from_command(Pdftk, self.path, other.path)]
diff --git a/diffoscope/comparators/png.py b/diffoscope/comparators/png.py
index dee6d8c..0328e33 100644
--- a/diffoscope/comparators/png.py
+++ b/diffoscope/comparators/png.py
@@ -44,4 +44,4 @@ class PngFile(File):
         return PngFile.RE_FILE_TYPE.match(file.magic_file_type)
 
     def compare_details(self, other, source=None):
-        yield Difference.from_command(Sng, self.path, other.path, source='sng')
+        return [Difference.from_command(Sng, self.path, other.path, source='sng')]
diff --git a/diffoscope/comparators/rpm.py b/diffoscope/comparators/rpm.py
index fdd9220..6c74207 100644
--- a/diffoscope/comparators/rpm.py
+++ b/diffoscope/comparators/rpm.py
@@ -101,4 +101,4 @@ class RpmFile(AbstractRpmFile):
     CONTAINER_CLASS = RpmContainer
 
     def compare_details(self, other, source=None):
-        yield compare_rpm_headers(self.path, other.path)
+        return [compare_rpm_headers(self.path, other.path)]
diff --git a/diffoscope/comparators/sqlite.py b/diffoscope/comparators/sqlite.py
index 384b250..e361dea 100644
--- a/diffoscope/comparators/sqlite.py
+++ b/diffoscope/comparators/sqlite.py
@@ -35,5 +35,5 @@ class Sqlite3Database(File):
         return file.magic_file_type == 'SQLite 3.x database'
 
     def compare_details(self, other, source=None):
-        yield Difference.from_command(Sqlite3Dump, self.path, other.path)
+        return [Difference.from_command(Sqlite3Dump, self.path, other.path)]
 
diff --git a/diffoscope/comparators/squashfs.py b/diffoscope/comparators/squashfs.py
index 0e06daa..e3293c1 100644
--- a/diffoscope/comparators/squashfs.py
+++ b/diffoscope/comparators/squashfs.py
@@ -196,5 +196,5 @@ class SquashfsFile(File):
         return SquashfsFile.RE_FILE_TYPE.match(file.magic_file_type)
 
     def compare_details(self, other, source=None):
-        yield Difference.from_command(SquashfsSuperblock, self.path, other.path)
-        yield Difference.from_command(SquashfsListing, self.path, other.path)
+        return [Difference.from_command(SquashfsSuperblock, self.path, other.path),
+                Difference.from_command(SquashfsListing, self.path, other.path)]
diff --git a/diffoscope/comparators/tar.py b/diffoscope/comparators/tar.py
index c376532..33e05b2 100644
--- a/diffoscope/comparators/tar.py
+++ b/diffoscope/comparators/tar.py
@@ -139,4 +139,4 @@ class TarFile(File):
         return TarFile.RE_FILE_TYPE.search(file.magic_file_type)
 
     def compare_details(self, other, source=None):
-        yield Difference.from_command(TarListing, self.path, other.path)
+        return [Difference.from_command(TarListing, self.path, other.path)]
diff --git a/diffoscope/comparators/zip.py b/diffoscope/comparators/zip.py
index 4a51502..efd0976 100644
--- a/diffoscope/comparators/zip.py
+++ b/diffoscope/comparators/zip.py
@@ -110,4 +110,4 @@ class ZipFile(File):
     def compare_details(self, other, source=None):
         zipinfo_difference = Difference.from_command(Zipinfo, self.path, other.path) or \
                              Difference.from_command(ZipinfoVerbose, self.path, other.path)
-        yield zipinfo_difference
+        return [zipinfo_difference]

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



More information about the Reproducible-commits mailing list