@@ -4535,7 +4535,7 @@ def PackArchiveFileFromTarFile(infile, outfile, compression="auto", compresswhol
45354535 infile = download_file_from_internet_file (infile )
45364536 infile .seek (0 , 0 )
45374537 if (not infile ):
4538- return False
4538+ print ( "1" ); return False
45394539 infile .seek (0 , 0 )
45404540 elif (not os .path .exists (infile ) or not os .path .isfile (infile )):
45414541 return False
@@ -4548,9 +4548,25 @@ def PackArchiveFileFromTarFile(infile, outfile, compression="auto", compresswhol
45484548 return False
45494549 try :
45504550 if (hasattr (infile , "read" ) or hasattr (infile , "write" )):
4551- tarfp = tarfile .open (fileobj = infile , mode = "r" )
4551+ compresscheck = CheckCompressionType (infile , formatspecs , False )
4552+ if (compresscheck == "zstd" ):
4553+ if 'zstandard' in sys .modules :
4554+ infile = ZstdFile (fileobj = infile , mode = "rb" )
4555+ elif 'pyzstd' in sys .modules :
4556+ catfp = pyzstd .zstdfile .ZstdFile (fileobj = infile , mode = "rb" )
4557+ tarfp = tarfile .open (fileobj = infile , mode = "r" )
4558+ else :
4559+ tarfp = tarfile .open (fileobj = infile , mode = "r" )
45524560 else :
4553- tarfp = tarfile .open (infile , "r" )
4561+ compresscheck = CheckCompressionType (infile , formatspecs , True )
4562+ if (compresscheck == "zstd" ):
4563+ if 'zstandard' in sys .modules :
4564+ infile = ZstdFile (fileobj = infile , mode = "rb" )
4565+ elif 'pyzstd' in sys .modules :
4566+ catfp = pyzstd .zstdfile .ZstdFile (fileobj = infile , mode = "rb" )
4567+ tarfp = tarfile .open (fileobj = infile , mode = "r" )
4568+ else :
4569+ tarfp = tarfile .open (infile , "r" )
45544570 except FileNotFoundError :
45554571 return False
45564572 numfiles = int (len (tarfp .getmembers ()))
@@ -7276,9 +7292,25 @@ def TarFileToArrayAlt(infile, listonly=False, contentasfile=True, checksumtype="
72767292 return False
72777293 try :
72787294 if (hasattr (infile , "read" ) or hasattr (infile , "write" )):
7279- tarfp = tarfile .open (fileobj = infile , mode = "r" )
7295+ compresscheck = CheckCompressionType (infile , formatspecs , False )
7296+ if (compresscheck == "zstd" ):
7297+ if 'zstandard' in sys .modules :
7298+ infile = ZstdFile (fileobj = infile , mode = "rb" )
7299+ elif 'pyzstd' in sys .modules :
7300+ catfp = pyzstd .zstdfile .ZstdFile (fileobj = infile , mode = "rb" )
7301+ tarfp = tarfile .open (fileobj = infile , mode = "r" )
7302+ else :
7303+ tarfp = tarfile .open (fileobj = infile , mode = "r" )
72807304 else :
7281- tarfp = tarfile .open (infile , "r" )
7305+ compresscheck = CheckCompressionType (infile , formatspecs , True )
7306+ if (compresscheck == "zstd" ):
7307+ if 'zstandard' in sys .modules :
7308+ infile = ZstdFile (fileobj = infile , mode = "rb" )
7309+ elif 'pyzstd' in sys .modules :
7310+ catfp = pyzstd .zstdfile .ZstdFile (fileobj = infile , mode = "rb" )
7311+ tarfp = tarfile .open (fileobj = infile , mode = "r" )
7312+ else :
7313+ tarfp = tarfile .open (infile , "r" )
72827314 except FileNotFoundError :
72837315 return False
72847316 fnumfiles = int (len (tarfp .getmembers ()))
@@ -8911,9 +8943,25 @@ def TarFileListFiles(infile, verbose=False, returnfp=False):
89118943 return False
89128944 try :
89138945 if (hasattr (infile , "read" ) or hasattr (infile , "write" )):
8914- tarfp = tarfile .open (fileobj = infile , mode = "r" )
8946+ compresscheck = CheckCompressionType (infile , formatspecs , False )
8947+ if (compresscheck == "zstd" ):
8948+ if 'zstandard' in sys .modules :
8949+ infile = ZstdFile (fileobj = infile , mode = "rb" )
8950+ elif 'pyzstd' in sys .modules :
8951+ catfp = pyzstd .zstdfile .ZstdFile (fileobj = infile , mode = "rb" )
8952+ tarfp = tarfile .open (fileobj = infile , mode = "r" )
8953+ else :
8954+ tarfp = tarfile .open (fileobj = infile , mode = "r" )
89158955 else :
8916- tarfp = tarfile .open (infile , "r" )
8956+ compresscheck = CheckCompressionType (infile , formatspecs , True )
8957+ if (compresscheck == "zstd" ):
8958+ if 'zstandard' in sys .modules :
8959+ infile = ZstdFile (fileobj = infile , mode = "rb" )
8960+ elif 'pyzstd' in sys .modules :
8961+ catfp = pyzstd .zstdfile .ZstdFile (fileobj = infile , mode = "rb" )
8962+ tarfp = tarfile .open (fileobj = infile , mode = "r" )
8963+ else :
8964+ tarfp = tarfile .open (infile , "r" )
89178965 except FileNotFoundError :
89188966 return False
89198967 lcfi = 0
0 commit comments