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

Abstract out the duplicated parts of the diffoscope/comparators/debian_fallback.py class.

parent 8b33709a
No related branches found
No related tags found
No related merge requests found
Pipeline #137168 passed
......@@ -21,10 +21,7 @@
from .text import TextFile
class DotChangesFile(TextFile):
DESCRIPTION = "Debian .changes files"
FILE_EXTENSION_SUFFIX = '.changes'
class AbstractDebianFallbackFile(TextFile):
def compare(self, other, *args, **kwargs):
difference = super().compare(other, *args, **kwargs)
if not difference:
......@@ -35,29 +32,16 @@ class DotChangesFile(TextFile):
return difference
class DotDscFile(TextFile):
DESCRIPTION = "Debian .dsc files"
FILE_EXTENSION_SUFFIX = '.dsc'
class DotChangesFile(AbstractDebianFallbackFile):
DESCRIPTION = "Debian .changes files"
FILE_EXTENSION_SUFFIX = '.changes'
def compare(self, other, *args, **kwargs):
difference = super().compare(other, *args, **kwargs)
if not difference:
return None
difference.add_comment(
'Unable to find the "debian" Python module. Falling back to text comparison.'
)
return difference
class DotDscFile(AbstractDebianFallbackFile):
DESCRIPTION = "Debian source packages (.dsc)"
FILE_EXTENSION_SUFFIX = '.dsc'
class DotBuildinfoFile(TextFile):
class DotBuildinfoFile(AbstractDebianFallbackFile):
DESCRIPTION = "Debian .buildinfo files"
FILE_EXTENSION_SUFFIX = '.buildinfo'
def compare(self, other, *args, **kwargs):
difference = super().compare(other, *args, **kwargs)
if not difference:
return None
difference.add_comment(
'Unable to find the "debian" Python module. Falling back to text comparison.'
)
return difference
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