@@ -8380,7 +8380,7 @@ def PackArchiveFileFromSevenZipFile(infile, outfile, fmttype="auto", compression
83808380def PackArchiveFileFromInFile (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 ):
83818381 checkcompressfile = CheckCompressionSubType (infile , formatspecs , 0 , True )
83828382 if (IsNestedDict (formatspecs ) and checkcompressfile in formatspecs ):
8383- formatspecs = formatspecs [checkcompressfile ]
8383+ ckformatspecs = formatspecs [checkcompressfile ]
83848384 if (checkcompressfile == "tarfile" and TarFileCheck (infile )):
83858385 return PackArchiveFileFromTarFile (infile , outfile , fmttype , compression , compresswholefile , compressionlevel , compressionuselist , checksumtype , extradata , jsondata , formatspecs , saltkey , verbose , returnfp )
83868386 elif (checkcompressfile == "zipfile" and zipfile .is_zipfile (infile )):
@@ -8389,7 +8389,7 @@ def PackArchiveFileFromInFile(infile, outfile, fmttype="auto", compression="auto
83898389 return PackArchiveFileFromRarFile (infile , outfile , fmttype , compression , compresswholefile , compressionlevel , compressionuselist , checksumtype , extradata , jsondata , formatspecs , saltkey , verbose , returnfp )
83908390 elif (py7zr_support and checkcompressfile == "7zipfile" and py7zr .is_7zfile (infile )):
83918391 return PackArchiveFileFromSevenZipFile (infile , outfile , fmttype , compression , compresswholefile , compressionlevel , compressionuselist , checksumtype , extradata , jsondata , formatspecs , saltkey , verbose , returnfp )
8392- elif (IsSingleDict ( formatspecs ) and checkcompressfile == formatspecs ['format_magic' ]):
8392+ elif (checkcompressfile == ckformatspecs ['format_magic' ]):
83938393 return RePackArchiveFile (infile , outfile , fmttype , compression , compresswholefile , compressionlevel , False , 0 , 0 , checksumtype , False , extradata , jsondata , formatspecs , saltkey , verbose , returnfp )
83948394 else :
83958395 return PackArchiveFileFromBSDTarFile (infile , outfile , fmttype , compression , compresswholefile , compressionlevel , compressionuselist , checksumtype , extradata , jsondata , formatspecs , saltkey , verbose , returnfp )
@@ -8739,14 +8739,20 @@ def TarFileToArray(infile, seekstart=0, seekend=0, listonly=False, contentasfile
87398739 return listarrayfiles
87408740
87418741
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- if (IsNestedDict (formatspecs ) and checkcompressfile in formatspecs ):
8745- formatspecs = formatspecs [checkcompressfile ]
8746- fp = MkTempFile ()
8747- fp = PackArchiveFileFromBSDTarFile (infile , fp , "auto" , True , None , compressionlistalt , "md5" , [], formatspecs , None , False , True )
8748- listarrayfiles = ArchiveFileToArray (fp , "auto" , 0 , seekstart , seekend , listonly , contentasfile , True , skipchecksum , formatspecs , None , seektoend , returnfp )
8749- return listarrayfiles
8742+ if (not libarchive_support ):
8743+ def BSDTarFileToArray (infile , seekstart = 0 , seekend = 0 , listonly = False , contentasfile = True , skipchecksum = False , formatspecs = __file_format_dict__ , seektoend = False , returnfp = False ):
8744+ checkcompressfile = CheckCompressionSubType (infile , formatspecs , filestart , True ):
8745+ return False
8746+
8747+ if (libarchive_support ):
8748+ def BSDTarFileToArray (infile , seekstart = 0 , seekend = 0 , listonly = False , contentasfile = True , skipchecksum = False , formatspecs = __file_format_dict__ , seektoend = False , returnfp = False ):
8749+ checkcompressfile = CheckCompressionSubType (infile , formatspecs , filestart , True ):
8750+ if (IsNestedDict (formatspecs ) and checkcompressfile in formatspecs ):
8751+ formatspecs = formatspecs [checkcompressfile ]
8752+ fp = MkTempFile ()
8753+ fp = PackArchiveFileFromBSDTarFile (infile , fp , "auto" , True , None , compressionlistalt , "md5" , [], formatspecs , None , False , True )
8754+ listarrayfiles = ArchiveFileToArray (fp , "auto" , 0 , seekstart , seekend , listonly , contentasfile , True , skipchecksum , formatspecs , None , seektoend , returnfp )
8755+ return listarrayfiles
87508756
87518757
87528758def ZipFileToArray (infile , seekstart = 0 , seekend = 0 , listonly = False , contentasfile = True , skipchecksum = False , formatspecs = __file_format_dict__ , seektoend = False , returnfp = False ):
@@ -10400,7 +10406,7 @@ def SevenZipFileListFile(infile, verbose=False, returnfp=False):
1040010406def 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 ):
1040110407 checkcompressfile = CheckCompressionSubType (infile , formatspecs , filestart , True )
1040210408 if (IsNestedDict (formatspecs ) and checkcompressfile in formatspecs ):
10403- formatspecs = formatspecs [checkcompressfile ]
10409+ ckformatspecs = formatspecs [checkcompressfile ]
1040410410 if (checkcompressfile == "tarfile" and TarFileCheck (infile )):
1040510411 return TarFileListFiles (infile , formatspecs , verbose , returnfp )
1040610412 elif (checkcompressfile == "zipfile" and zipfile .is_zipfile (infile )):
@@ -10409,7 +10415,7 @@ def InFileListFiles(infile, fmttype="auto", filestart=0, seekstart=0, seekend=0,
1040910415 return RarFileListFiles (infile , verbose , returnfp )
1041010416 elif (py7zr_support and checkcompressfile == "7zipfile" and py7zr .is_7zfile (infile )):
1041110417 return SevenZipFileListFiles (infile , verbose , returnfp )
10412- elif (checkcompressfile == formatspecs ['format_magic' ]):
10418+ elif (checkcompressfile == ckformatspecs ['format_magic' ]):
1041310419 return ArchiveFileListFiles (infile , fmttype , filestart , seekstart , seekend , skipchecksum , formatspecs , saltkey , seektoend , verbose , newstyle , returnfp )
1041410420 else :
1041510421 return BSDTarFileListFiles (infile , formatspecs , verbose , returnfp )
0 commit comments