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

Factor out running all of our zipinfo variants into a new method.

parent db108488
No related branches found
No related tags found
No related merge requests found
...@@ -125,6 +125,20 @@ class BsdtarVerbose(Command): ...@@ -125,6 +125,20 @@ class BsdtarVerbose(Command):
return ['bsdtar', '-tvf', self.path] return ['bsdtar', '-tvf', self.path]
def zipinfo_differences(file, other):
"""
Run all our zipinfo variants.
"""
for x in (Zipinfo, ZipinfoVerbose, BsdtarVerbose):
result = Difference.from_command(x, file.path, other.path)
# We only return the 'best' one
if result is not None:
return [result]
return []
class ZipDirectory(Directory, ArchiveMember): class ZipDirectory(Directory, ArchiveMember):
def __init__(self, archive, member_name): def __init__(self, archive, member_name):
ArchiveMember.__init__(self, archive, member_name) ArchiveMember.__init__(self, archive, member_name)
...@@ -192,20 +206,11 @@ class ZipFile(File): ...@@ -192,20 +206,11 @@ class ZipFile(File):
def compare_details(self, other, source=None): def compare_details(self, other, source=None):
differences = [] differences = []
zipinfo_difference = None
if Config().exclude_directory_metadata != 'recursive': if Config().exclude_directory_metadata != 'recursive':
for x in (Zipinfo, ZipinfoVerbose, BsdtarVerbose): differences.extend(zipinfo_differences(self, other))
zipinfo_difference = Difference.from_command( differences.append(
x, self.path, other.path Difference.from_command(Zipnote, self.path, other.path)
)
if zipinfo_difference:
break
zipnote_difference = Difference.from_command(
Zipnote, self.path, other.path
) )
for x in (zipinfo_difference, zipnote_difference):
if x is not None:
differences.append(x)
return differences return differences
......
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