Commit 6a1769c9 authored by Chris Lamb's avatar Chris Lamb 👀
Browse files

Not all versions of file(1) support detection of Jmod files yet, so perform a...

Not all versions of file(1) support detection of Jmod files yet, so perform a manual comparison instead. (re. #60)
parent 4af81ba2
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -88,8 +88,8 @@ class ComparatorManager(object):
        ('ocaml.OcamlInterfaceFile',),
        ('docx.DocxFile',),
        ('zip.MozillaZipFile',),
        ('zip.ZipFile',),
        ('zip.JmodJavaModule',),
        ('zip.ZipFile',),
        ('image.JPEGImageFile',),
        ('image.ICOImageFile',),
        ('cbfs.CbfsFile',),
+7 −1
Original line number Diff line number Diff line
@@ -250,7 +250,13 @@ class MozillaZipFile(ZipFile):

class JmodJavaModule(ZipFile):
    DESCRIPTION = 'Java .jmod modules'
    FILE_TYPE_RE = re.compile(r'^Java jmod module\b')

    FILE_TYPE_RE = re.compile(r'^(Zip archive data|Java jmod module)')
    ZIPINFO = IgnoreReturncodeZipinfo
    ZIPINFO_VERBOSE = IgnoreReturncodeZipinfoVerbose

    @classmethod
    def recognizes(cls, file):
        # Not all versions of file(1) support the detection of these
        # modules yet so we perform our own manual check for a "JM" prefix.
        return file.file_header[:2] == b'JM'