[diffoscope] 01/03: Adjust get_compressed_content_name to take the archive as its parameter.

Chris Lamb chris at chris-lamb.co.uk
Sun Mar 19 23:57:56 CET 2017


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

lamby pushed a commit to branch experimental
in repository diffoscope.

commit e856081030873ffc14546a098ab5df34e537ffd7
Author: Chris Lamb <lamby at debian.org>
Date:   Sun Mar 19 22:36:46 2017 +0000

    Adjust get_compressed_content_name to take the archive as its parameter.
    
    Signed-off-by: Chris Lamb <lamby at debian.org>
---
 diffoscope/comparators/bzip2.py           | 2 +-
 diffoscope/comparators/dex.py             | 2 +-
 diffoscope/comparators/gzip.py            | 2 +-
 diffoscope/comparators/rust.py            | 2 +-
 diffoscope/comparators/utils/filenames.py | 4 ++--
 diffoscope/comparators/xz.py              | 2 +-
 6 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/diffoscope/comparators/bzip2.py b/diffoscope/comparators/bzip2.py
index e54b28b..d76a29d 100644
--- a/diffoscope/comparators/bzip2.py
+++ b/diffoscope/comparators/bzip2.py
@@ -43,7 +43,7 @@ class Bzip2Container(Archive):
         return collections.OrderedDict({'bzip2-content': self.get_member(self.get_member_names()[0])})
 
     def get_member_names(self):
-        return [get_compressed_content_name(self.source.path, '.bz2')]
+        return [get_compressed_content_name(self, '.bz2')]
 
     @tool_required('bzip2')
     def extract(self, member_name, dest_dir):
diff --git a/diffoscope/comparators/dex.py b/diffoscope/comparators/dex.py
index 3232c06..165fe98 100644
--- a/diffoscope/comparators/dex.py
+++ b/diffoscope/comparators/dex.py
@@ -47,7 +47,7 @@ class DexContainer(Archive):
         return collections.OrderedDict({'dex-content': self.get_member(self.get_member_names()[0])})
 
     def get_member_names(self):
-        return [get_compressed_content_name(self.source.path, '.dex') + '.jar']
+        return [get_compressed_content_name(self, '.dex') + '.jar']
 
     @tool_required('enjarify')
     def extract(self, member_name, dest_dir):
diff --git a/diffoscope/comparators/gzip.py b/diffoscope/comparators/gzip.py
index f81bac5..1111a9c 100644
--- a/diffoscope/comparators/gzip.py
+++ b/diffoscope/comparators/gzip.py
@@ -45,7 +45,7 @@ class GzipContainer(Archive):
         return collections.OrderedDict({'gzip-content': self.get_member(self.get_member_names()[0])})
 
     def get_member_names(self):
-        return [get_compressed_content_name(self.source.path, '.gz')]
+        return [get_compressed_content_name(self, '.gz')]
 
     @tool_required('gzip')
     def extract(self, member_name, dest_dir):
diff --git a/diffoscope/comparators/rust.py b/diffoscope/comparators/rust.py
index 67a5d40..1b8ac9b 100644
--- a/diffoscope/comparators/rust.py
+++ b/diffoscope/comparators/rust.py
@@ -46,7 +46,7 @@ class RustObjectContainer(Archive):
         return collections.OrderedDict({'deflate-content': self.get_member(self.get_member_names()[0])})
 
     def get_member_names(self):
-        return [get_compressed_content_name(self.source.path, '.deflate')]
+        return [get_compressed_content_name(self, '.deflate')]
 
     def extract(self, member_name, dest_dir):
         dest_path = os.path.join(dest_dir, member_name)
diff --git a/diffoscope/comparators/utils/filenames.py b/diffoscope/comparators/utils/filenames.py
index 83e534f..3f173e2 100644
--- a/diffoscope/comparators/utils/filenames.py
+++ b/diffoscope/comparators/utils/filenames.py
@@ -20,8 +20,8 @@
 import os
 
 
-def get_compressed_content_name(path, expected_extension):
-    basename = os.path.basename(path)
+def get_compressed_content_name(archive, expected_extension):
+    basename = os.path.basename(archive.source.path)
 
     if not basename.endswith(expected_extension):
         return "%s-content" % basename
diff --git a/diffoscope/comparators/xz.py b/diffoscope/comparators/xz.py
index d75853a..edb496d 100644
--- a/diffoscope/comparators/xz.py
+++ b/diffoscope/comparators/xz.py
@@ -43,7 +43,7 @@ class XzContainer(Archive):
         return collections.OrderedDict({'xz-content': self.get_member(self.get_member_names()[0])})
 
     def get_member_names(self):
-        return [get_compressed_content_name(self.source.path, '.xz')]
+        return [get_compressed_content_name(self, '.xz')]
 
     @tool_required('xz')
     def extract(self, member_name, dest_dir):

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


More information about the diffoscope mailing list