Skip to content

Commit 5269828

Browse files
committed
Small update
1 parent 134ed60 commit 5269828

1 file changed

Lines changed: 19 additions & 13 deletions

File tree

pyneofile/pyneofile.py

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8379,7 +8379,7 @@ def PackNeoFileFromSevenZipFile(infile, outfile, fmttype="auto", compression="au
83798379
def PackNeoFileFromInFile(infile, outfile, fmttype="auto", compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, checksumtype=["md5", "md5", "md5", "md5", "md5"], extradata=[], jsondata={}, formatspecs=__file_format_dict__, saltkey=None, verbose=False, returnfp=False):
83808380
checkcompressfile = CheckCompressionSubType(infile, formatspecs, 0, True)
83818381
if(IsNestedDict(formatspecs) and checkcompressfile in formatspecs):
8382-
formatspecs = formatspecs[checkcompressfile]
8382+
ckformatspecs = formatspecs[checkcompressfile]
83838383
if(checkcompressfile == "tarfile" and TarFileCheck(infile)):
83848384
return PackNeoFileFromTarFile(infile, outfile, fmttype, compression, compresswholefile, compressionlevel, compressionuselist, checksumtype, extradata, jsondata, formatspecs, saltkey, verbose, returnfp)
83858385
elif(checkcompressfile == "zipfile" and zipfile.is_zipfile(infile)):
@@ -8388,7 +8388,7 @@ def PackNeoFileFromInFile(infile, outfile, fmttype="auto", compression="auto", c
83888388
return PackNeoFileFromRarFile(infile, outfile, fmttype, compression, compresswholefile, compressionlevel, compressionuselist, checksumtype, extradata, jsondata, formatspecs, saltkey, verbose, returnfp)
83898389
elif(py7zr_support and checkcompressfile == "7zipfile" and py7zr.is_7zfile(infile)):
83908390
return PackNeoFileFromSevenZipFile(infile, outfile, fmttype, compression, compresswholefile, compressionlevel, compressionuselist, checksumtype, extradata, jsondata, formatspecs, saltkey, verbose, returnfp)
8391-
elif(IsSingleDict(formatspecs) and checkcompressfile == formatspecs['format_magic']):
8391+
elif(checkcompressfile == ckformatspecs['format_magic']):
83928392
return RePackNeoFile(infile, outfile, fmttype, compression, compresswholefile, compressionlevel, False, 0, 0, checksumtype, False, extradata, jsondata, formatspecs, saltkey, verbose, returnfp)
83938393
else:
83948394
return PackNeoFileFromBSDTarFile(infile, outfile, fmttype, compression, compresswholefile, compressionlevel, compressionuselist, checksumtype, extradata, jsondata, formatspecs, saltkey, verbose, returnfp)
@@ -8738,14 +8738,20 @@ def TarFileToArray(infile, seekstart=0, seekend=0, listonly=False, contentasfile
87388738
return listarrayfiles
87398739

87408740

8741-
def BSDTarFileToArray(infile, seekstart=0, seekend=0, listonly=False, contentasfile=True, skipchecksum=False, formatspecs=__file_format_dict__, seektoend=False, returnfp=False):
8742-
checkcompressfile = CheckCompressionSubType(infile, formatspecs, filestart, True)
8743-
if(IsNestedDict(formatspecs) and checkcompressfile in formatspecs):
8744-
formatspecs = formatspecs[checkcompressfile]
8745-
fp = MkTempFile()
8746-
fp = PackArchiveFileFromBSDTarFile(infile, fp, "auto", True, None, compressionlistalt, "md5", [], formatspecs, None, False, True)
8747-
listarrayfiles = ArchiveFileToArray(fp, "auto", 0, seekstart, seekend, listonly, contentasfile, True, skipchecksum, formatspecs, None, seektoend, returnfp)
8748-
return listarrayfiles
8741+
if(not libarchive_support):
8742+
def BSDTarFileToArray(infile, seekstart=0, seekend=0, listonly=False, contentasfile=True, skipchecksum=False, formatspecs=__file_format_dict__, seektoend=False, returnfp=False):
8743+
checkcompressfile = CheckCompressionSubType(infile, formatspecs, filestart, True):
8744+
return False
8745+
8746+
if(libarchive_support):
8747+
def BSDTarFileToArray(infile, seekstart=0, seekend=0, listonly=False, contentasfile=True, skipchecksum=False, formatspecs=__file_format_dict__, seektoend=False, returnfp=False):
8748+
checkcompressfile = CheckCompressionSubType(infile, formatspecs, filestart, True):
8749+
if(IsNestedDict(formatspecs) and checkcompressfile in formatspecs):
8750+
formatspecs = formatspecs[checkcompressfile]
8751+
fp = MkTempFile()
8752+
fp = PackArchiveFileFromBSDTarFile(infile, fp, "auto", True, None, compressionlistalt, "md5", [], formatspecs, None, False, True)
8753+
listarrayfiles = ArchiveFileToArray(fp, "auto", 0, seekstart, seekend, listonly, contentasfile, True, skipchecksum, formatspecs, None, seektoend, returnfp)
8754+
return listarrayfiles
87498755

87508756

87518757
def ZipFileToArray(infile, seekstart=0, seekend=0, listonly=False, contentasfile=True, skipchecksum=False, formatspecs=__file_format_dict__, seektoend=False, returnfp=False):
@@ -10399,7 +10405,7 @@ def SevenZipFileListFile(infile, verbose=False, returnfp=False):
1039910405
def InFileListFiles(infile, fmttype="auto", filestart=0, seekstart=0, seekend=0, skipchecksum=False, formatspecs=__file_format_multi_dict__, saltkey=None, seektoend=False, verbose=False, newstyle=False, returnfp=False):
1040010406
checkcompressfile = CheckCompressionSubType(infile, formatspecs, filestart, True)
1040110407
if(IsNestedDict(formatspecs) and checkcompressfile in formatspecs):
10402-
formatspecs = formatspecs[checkcompressfile]
10408+
ckformatspecs = formatspecs[checkcompressfile]
1040310409
if(checkcompressfile == "tarfile" and TarFileCheck(infile)):
1040410410
return TarFileListFiles(infile, formatspecs, verbose, returnfp)
1040510411
elif(checkcompressfile == "zipfile" and zipfile.is_zipfile(infile)):
@@ -10408,8 +10414,8 @@ def InFileListFiles(infile, fmttype="auto", filestart=0, seekstart=0, seekend=0,
1040810414
return RarFileListFiles(infile, verbose, returnfp)
1040910415
elif(py7zr_support and checkcompressfile == "7zipfile" and py7zr.is_7zfile(infile)):
1041010416
return SevenZipFileListFiles(infile, verbose, returnfp)
10411-
elif(checkcompressfile == formatspecs['format_magic']):
10412-
return NeoFileListFiles(infile, fmttype, filestart, seekstart, seekend, skipchecksum, formatspecs, saltkey, seektoend, verbose, newstyle, returnfp)
10417+
elif(checkcompressfile == ckformatspecs['format_magic']):
10418+
return ArchiveFileListFiles(infile, fmttype, filestart, seekstart, seekend, skipchecksum, formatspecs, saltkey, seektoend, verbose, newstyle, returnfp)
1041310419
else:
1041410420
return BSDTarFileListFiles(infile, formatspecs, verbose, returnfp)
1041510421
return False

0 commit comments

Comments
 (0)