PyCatFile 0.20.8__py3-none-any.whl → 0.21.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pycatfile-0.20.8.data → pycatfile-0.21.2.data}/scripts/catfile.py +6 -6
- pycatfile-0.21.2.data/scripts/catneofile.py +130 -0
- {pycatfile-0.20.8.dist-info → pycatfile-0.21.2.dist-info}/METADATA +1 -1
- pycatfile-0.21.2.dist-info/RECORD +10 -0
- pycatfile.py +195 -177
- pycatfile-0.20.8.dist-info/RECORD +0 -9
- {pycatfile-0.20.8.data → pycatfile-0.21.2.data}/scripts/neocatfile.py +0 -0
- {pycatfile-0.20.8.dist-info → pycatfile-0.21.2.dist-info}/WHEEL +0 -0
- {pycatfile-0.20.8.dist-info → pycatfile-0.21.2.dist-info}/licenses/LICENSE +0 -0
- {pycatfile-0.20.8.dist-info → pycatfile-0.21.2.dist-info}/top_level.txt +0 -0
- {pycatfile-0.20.8.dist-info → pycatfile-0.21.2.dist-info}/zip-safe +0 -0
pycatfile.py
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
Copyright 2018-2024 Game Maker 2k - http://intdb.sourceforge.net/
|
|
15
15
|
Copyright 2018-2024 Kazuki Przyborowski - https://github.com/KazukiPrzyborowski
|
|
16
16
|
|
|
17
|
-
$FileInfo: pycatfile.py - Last Update:
|
|
17
|
+
$FileInfo: pycatfile.py - Last Update: 8/24/2025 Ver. 0.21.2 RC 1 - Author: cooldude2k $
|
|
18
18
|
'''
|
|
19
19
|
|
|
20
20
|
from __future__ import absolute_import, division, print_function, unicode_literals, generators, with_statement, nested_scopes
|
|
@@ -391,12 +391,12 @@ __file_format_extension__ = __file_format_multi_dict__[__file_format_default__][
|
|
|
391
391
|
__file_format_dict__ = __file_format_multi_dict__[__file_format_default__]
|
|
392
392
|
__project__ = __program_name__
|
|
393
393
|
__project_url__ = "https://github.com/GameMaker2k/PyCatFile"
|
|
394
|
-
__version_info__ = (0,
|
|
395
|
-
__version_date_info__ = (2025, 9,
|
|
394
|
+
__version_info__ = (0, 21, 2, "RC 1", 1)
|
|
395
|
+
__version_date_info__ = (2025, 9, 24, "RC 1", 1)
|
|
396
396
|
__version_date__ = str(__version_date_info__[0]) + "." + str(
|
|
397
397
|
__version_date_info__[1]).zfill(2) + "." + str(__version_date_info__[2]).zfill(2)
|
|
398
398
|
__revision__ = __version_info__[3]
|
|
399
|
-
__revision_id__ = "$Id:
|
|
399
|
+
__revision_id__ = "$Id: aa79a32fe42d54c127f8f31a24dc7b2be0fb1153 $"
|
|
400
400
|
if(__version_info__[4] is not None):
|
|
401
401
|
__version_date_plusrc__ = __version_date__ + \
|
|
402
402
|
"-" + str(__version_date_info__[4])
|
|
@@ -1959,15 +1959,15 @@ def ReadFileHeaderDataWithContent(fp, listonly=False, uncompress=True, skipcheck
|
|
|
1959
1959
|
HeaderOut = ReadFileHeaderDataWoSize(fp, delimiter)
|
|
1960
1960
|
if(len(HeaderOut) == 0):
|
|
1961
1961
|
return False
|
|
1962
|
-
if(re.findall("^[.|/]", HeaderOut[
|
|
1963
|
-
fname = HeaderOut[
|
|
1962
|
+
if(re.findall("^[.|/]", HeaderOut[5])):
|
|
1963
|
+
fname = HeaderOut[5]
|
|
1964
1964
|
else:
|
|
1965
|
-
fname = "./"+HeaderOut[
|
|
1965
|
+
fname = "./"+HeaderOut[5]
|
|
1966
1966
|
fcs = HeaderOut[-2].lower()
|
|
1967
1967
|
fccs = HeaderOut[-1].lower()
|
|
1968
|
-
fsize = int(HeaderOut[
|
|
1969
|
-
fcompression = HeaderOut[
|
|
1970
|
-
fcsize = int(HeaderOut[
|
|
1968
|
+
fsize = int(HeaderOut[7], 16)
|
|
1969
|
+
fcompression = HeaderOut[14]
|
|
1970
|
+
fcsize = int(HeaderOut[15], 16)
|
|
1971
1971
|
fseeknextfile = HeaderOut[26]
|
|
1972
1972
|
fjsontype = HeaderOut[27]
|
|
1973
1973
|
fjsonlen = int(HeaderOut[28], 16)
|
|
@@ -2020,6 +2020,7 @@ def ReadFileHeaderDataWithContent(fp, listonly=False, uncompress=True, skipcheck
|
|
|
2020
2020
|
fcontents.seek(0, 0)
|
|
2021
2021
|
newfccs = GetFileChecksum(
|
|
2022
2022
|
fcontents.read(), HeaderOut[-3].lower(), False, formatspecs)
|
|
2023
|
+
fcontents.seek(0, 0)
|
|
2023
2024
|
if(fccs != newfccs and not skipchecksum and not listonly):
|
|
2024
2025
|
VerbosePrintOut("File Content Checksum Error with file " +
|
|
2025
2026
|
fname + " at offset " + str(fcontentstart))
|
|
@@ -2032,7 +2033,7 @@ def ReadFileHeaderDataWithContent(fp, listonly=False, uncompress=True, skipcheck
|
|
|
2032
2033
|
if(uncompress):
|
|
2033
2034
|
cfcontents = UncompressFileAlt(fcontents, formatspecs)
|
|
2034
2035
|
cfcontents.seek(0, 0)
|
|
2035
|
-
|
|
2036
|
+
fcontents = BytesIO()
|
|
2036
2037
|
shutil.copyfileobj(cfcontents, fcontents)
|
|
2037
2038
|
cfcontents.close()
|
|
2038
2039
|
fcontents.seek(0, 0)
|
|
@@ -2124,6 +2125,7 @@ def ReadFileHeaderDataWithContentToArray(fp, listonly=False, contentasfile=True,
|
|
|
2124
2125
|
fextrafieldslist = json.loads(fextrafieldslist[0])
|
|
2125
2126
|
except (binascii.Error, json.decoder.JSONDecodeError, UnicodeDecodeError):
|
|
2126
2127
|
pass
|
|
2128
|
+
fjstart = fp.tell()
|
|
2127
2129
|
if(fjsontype=="json"):
|
|
2128
2130
|
fjsoncontent = {}
|
|
2129
2131
|
fprejsoncontent = fp.read(fjsonsize).decode("UTF-8")
|
|
@@ -2151,11 +2153,11 @@ def ReadFileHeaderDataWithContentToArray(fp, listonly=False, contentasfile=True,
|
|
|
2151
2153
|
fjsoncontent = ReadFileHeaderData(flisttmp, fjsonlen, delimiter)
|
|
2152
2154
|
flisttmp.close()
|
|
2153
2155
|
fjsonrawcontent = fjsoncontent
|
|
2154
|
-
if(
|
|
2156
|
+
if(fjsonlen==1):
|
|
2155
2157
|
try:
|
|
2156
2158
|
fjsonrawcontent = base64.b64decode(fjsoncontent[0]).decode("UTF-8")
|
|
2157
2159
|
fjsoncontent = json.loads(base64.b64decode(fjsoncontent[0]).decode("UTF-8"))
|
|
2158
|
-
|
|
2160
|
+
fjsonlen = len(fjsoncontent)
|
|
2159
2161
|
except (binascii.Error, json.decoder.JSONDecodeError, UnicodeDecodeError):
|
|
2160
2162
|
try:
|
|
2161
2163
|
fjsonrawcontent = fjsoncontent[0]
|
|
@@ -2163,6 +2165,7 @@ def ReadFileHeaderDataWithContentToArray(fp, listonly=False, contentasfile=True,
|
|
|
2163
2165
|
except (binascii.Error, json.decoder.JSONDecodeError, UnicodeDecodeError):
|
|
2164
2166
|
pass
|
|
2165
2167
|
fp.seek(len(delimiter), 1)
|
|
2168
|
+
fjend = fp.tell() - 1
|
|
2166
2169
|
jsonfcs = GetFileChecksum(fprejsoncontent, fjsonchecksumtype, True, formatspecs)
|
|
2167
2170
|
if(jsonfcs != fjsonchecksum and not skipchecksum):
|
|
2168
2171
|
VerbosePrintOut("File JSON Data Checksum Error with file " +
|
|
@@ -2197,6 +2200,7 @@ def ReadFileHeaderDataWithContentToArray(fp, listonly=False, contentasfile=True,
|
|
|
2197
2200
|
fcontents.seek(0, 0)
|
|
2198
2201
|
newfccs = GetFileChecksum(
|
|
2199
2202
|
fcontents.read(), HeaderOut[-3].lower(), False, formatspecs)
|
|
2203
|
+
fcontents.seek(0, 0)
|
|
2200
2204
|
if(fccs != newfccs and not skipchecksum and not listonly):
|
|
2201
2205
|
VerbosePrintOut("File Content Checksum Error with file " +
|
|
2202
2206
|
fname + " at offset " + str(fcontentstart))
|
|
@@ -2238,7 +2242,7 @@ def ReadFileHeaderDataWithContentToArray(fp, listonly=False, contentasfile=True,
|
|
|
2238
2242
|
if(not contentasfile):
|
|
2239
2243
|
fcontents = fcontents.read()
|
|
2240
2244
|
outlist = {'fheadersize': fheadsize, 'fhstart': fheaderstart, 'fhend': fhend, 'ftype': ftype, 'fencoding': fencoding, 'fcencoding': fcencoding, 'fname': fname, 'fbasedir': fbasedir, 'flinkname': flinkname, 'fsize': fsize, 'fatime': fatime, 'fmtime': fmtime, 'fctime': fctime, 'fbtime': fbtime, 'fmode': fmode, 'fchmode': fchmode, 'ftypemod': ftypemod, 'fwinattributes': fwinattributes, 'fcompression': fcompression, 'fcsize': fcsize, 'fuid': fuid, 'funame': funame, 'fgid': fgid, 'fgname': fgname, 'finode': finode, 'flinkcount': flinkcount,
|
|
2241
|
-
'fdev': fdev, 'fminor': fdev_minor, 'fmajor': fdev_major, 'fseeknextfile': fseeknextfile, 'fheaderchecksumtype': HeaderOut[-4], 'fjsonchecksumtype':
|
|
2245
|
+
'fdev': fdev, 'fminor': fdev_minor, 'fmajor': fdev_major, 'fseeknextfile': fseeknextfile, 'fheaderchecksumtype': HeaderOut[-4], 'fjsonchecksumtype': fjsonchecksumtype, 'fcontentchecksumtype': HeaderOut[-3], 'fnumfields': fnumfields + 2, 'frawheader': HeaderOut, 'fextrafields': fextrafields, 'fextrafieldsize': fextrasize, 'fextradata': fextrafieldslist, 'fjsontype': fjsontype, 'fjsonlen': fjsonlen, 'fjsonsize': fjsonsize, 'fjsonrawdata': fjsonrawcontent, 'fjsondata': fjsoncontent, 'fjstart': fjstart, 'fjend': fjend, 'fheaderchecksum': fcs, 'fjsonchecksum': fjsonchecksum, 'fcontentchecksum': fccs, 'fhascontents': pyhascontents, 'fcontentstart': fcontentstart, 'fcontentend': fcontentend, 'fcontentasfile': contentasfile, 'fcontents': fcontents}
|
|
2242
2246
|
return outlist
|
|
2243
2247
|
|
|
2244
2248
|
|
|
@@ -2335,11 +2339,11 @@ def ReadFileHeaderDataWithContentToList(fp, listonly=False, contentasfile=False,
|
|
|
2335
2339
|
fjsoncontent = ReadFileHeaderData(flisttmp, fjsonlen, delimiter)
|
|
2336
2340
|
flisttmp.close()
|
|
2337
2341
|
fjsonrawcontent = fjsoncontent
|
|
2338
|
-
if(
|
|
2342
|
+
if(fjsonlen==1):
|
|
2339
2343
|
try:
|
|
2340
2344
|
fjsonrawcontent = base64.b64decode(fjsoncontent[0]).decode("UTF-8")
|
|
2341
2345
|
fjsoncontent = json.loads(base64.b64decode(fjsoncontent[0]).decode("UTF-8"))
|
|
2342
|
-
|
|
2346
|
+
fjsonlen = len(fjsoncontent)
|
|
2343
2347
|
except (binascii.Error, json.decoder.JSONDecodeError, UnicodeDecodeError):
|
|
2344
2348
|
try:
|
|
2345
2349
|
fjsonrawcontent = fjsoncontent[0]
|
|
@@ -2549,11 +2553,11 @@ def ReadFileDataWithContentToArray(fp, seekstart=0, seekend=0, listonly=False, c
|
|
|
2549
2553
|
formversions = re.search('(.*?)(\\d+)', formstring).groups()
|
|
2550
2554
|
fcompresstype = ""
|
|
2551
2555
|
outlist = {'fnumfiles': fnumfiles, 'fformat': formversions[0], 'fcompression': fcompresstype, 'fencoding': fhencoding, 'fversion': formversions[1], 'fostype': fostype, 'fheadersize': fheadsize, 'fsize': CatSizeEnd, 'fnumfields': fnumfields + 2, 'fformatspecs': formatspecs, 'fchecksumtype': fprechecksumtype, 'fheaderchecksum': fprechecksum, 'frawheader': [formstring] + inheader, 'fextrafields': fnumextrafields, 'fextrafieldsize': fnumextrafieldsize, 'fextradata': fextrafieldslist, 'ffilelist': []}
|
|
2552
|
-
if(seekstart < 0
|
|
2556
|
+
if (seekstart < 0) or (seekstart > fnumfiles):
|
|
2553
2557
|
seekstart = 0
|
|
2554
|
-
if(seekend == 0 or seekend > fnumfiles
|
|
2558
|
+
if (seekend == 0) or (seekend > fnumfiles) or (seekend < seekstart):
|
|
2555
2559
|
seekend = fnumfiles
|
|
2556
|
-
elif(seekend < 0 and abs(seekend) <= fnumfiles and abs(seekend) >= seekstart):
|
|
2560
|
+
elif (seekend < 0) and (abs(seekend) <= fnumfiles) and (abs(seekend) >= seekstart):
|
|
2557
2561
|
seekend = fnumfiles - abs(seekend)
|
|
2558
2562
|
if(seekstart > 0):
|
|
2559
2563
|
il = 0
|
|
@@ -2564,14 +2568,18 @@ def ReadFileDataWithContentToArray(fp, seekstart=0, seekend=0, listonly=False, c
|
|
|
2564
2568
|
if(len(preheaderdata) == 0):
|
|
2565
2569
|
break
|
|
2566
2570
|
prefsize = int(preheaderdata[5], 16)
|
|
2571
|
+
if(re.findall("^[.|/]", preheaderdata[5])):
|
|
2572
|
+
prefname = preheaderdata[5]
|
|
2573
|
+
else:
|
|
2574
|
+
prefname = "./"+preheaderdata[5]
|
|
2567
2575
|
prefseeknextfile = preheaderdata[26]
|
|
2568
2576
|
prefjsonlen = int(preheaderdata[28], 16)
|
|
2569
2577
|
prefjsonsize = int(preheaderdata[29], 16)
|
|
2570
2578
|
prefjsonchecksumtype = preheaderdata[30]
|
|
2571
2579
|
prefjsonchecksum = preheaderdata[31]
|
|
2572
|
-
|
|
2580
|
+
prejsoncontent = fp.read(prefjsonsize).decode("UTF-8")
|
|
2573
2581
|
fp.seek(len(delimiter), 1)
|
|
2574
|
-
prejsonfcs = GetFileChecksum(
|
|
2582
|
+
prejsonfcs = GetFileChecksum(prejsoncontent, prefjsonchecksumtype, True, formatspecs)
|
|
2575
2583
|
if(prejsonfcs != prefjsonchecksum and not skipchecksum):
|
|
2576
2584
|
VerbosePrintOut("File JSON Data Checksum Error with file " +
|
|
2577
2585
|
prefname + " at offset " + str(prefhstart))
|
|
@@ -2581,7 +2589,7 @@ def ReadFileDataWithContentToArray(fp, seekstart=0, seekend=0, listonly=False, c
|
|
|
2581
2589
|
preheaderdata[:-2], preheaderdata[-4].lower(), True, formatspecs)
|
|
2582
2590
|
prefcs = preheaderdata[-2]
|
|
2583
2591
|
if(prefcs != prenewfcs and not skipchecksum):
|
|
2584
|
-
|
|
2592
|
+
VerbosePrintOut("File Header Checksum Error with file " +
|
|
2585
2593
|
prefname + " at offset " + str(prefhstart))
|
|
2586
2594
|
VerbosePrintOut("'" + prefcs + "' != " +
|
|
2587
2595
|
"'" + prenewfcs + "'")
|
|
@@ -2704,11 +2712,11 @@ def ReadFileDataWithContentToList(fp, seekstart=0, seekend=0, listonly=False, co
|
|
|
2704
2712
|
return False
|
|
2705
2713
|
formversions = re.search('(.*?)(\\d+)', formstring).groups()
|
|
2706
2714
|
outlist = []
|
|
2707
|
-
if(seekstart < 0
|
|
2715
|
+
if (seekstart < 0) or (seekstart > fnumfiles):
|
|
2708
2716
|
seekstart = 0
|
|
2709
|
-
if(seekend == 0 or seekend > fnumfiles
|
|
2717
|
+
if (seekend == 0) or (seekend > fnumfiles) or (seekend < seekstart):
|
|
2710
2718
|
seekend = fnumfiles
|
|
2711
|
-
elif(seekend < 0 and abs(seekend) <= fnumfiles and abs(seekend) >= seekstart):
|
|
2719
|
+
elif (seekend < 0) and (abs(seekend) <= fnumfiles) and (abs(seekend) >= seekstart):
|
|
2712
2720
|
seekend = fnumfiles - abs(seekend)
|
|
2713
2721
|
if(seekstart > 0):
|
|
2714
2722
|
il = 0
|
|
@@ -2723,16 +2731,20 @@ def ReadFileDataWithContentToList(fp, seekstart=0, seekend=0, listonly=False, co
|
|
|
2723
2731
|
if(len(preheaderdata) == 0):
|
|
2724
2732
|
break
|
|
2725
2733
|
prefsize = int(preheaderdata[5], 16)
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2734
|
+
if(re.findall("^[.|/]", preheaderdata[5])):
|
|
2735
|
+
prefname = preheaderdata[5]
|
|
2736
|
+
else:
|
|
2737
|
+
prefname = "./"+preheaderdata[5]
|
|
2738
|
+
prefcompression = preheaderdata[14]
|
|
2739
|
+
prefcsize = int(preheaderdata[15], 16)
|
|
2740
|
+
prefseeknextfile = preheaderdata[26]
|
|
2729
2741
|
prefjsonlen = int(preheaderdata[28], 16)
|
|
2730
2742
|
prefjsonsize = int(preheaderdata[29], 16)
|
|
2731
2743
|
prefjsonchecksumtype = preheaderdata[30]
|
|
2732
2744
|
prefjsonchecksum = preheaderdata[31]
|
|
2733
2745
|
prefprejsoncontent = fp.read(prefjsonsize).decode("UTF-8")
|
|
2734
2746
|
fp.seek(len(delimiter), 1)
|
|
2735
|
-
prejsonfcs = GetFileChecksum(
|
|
2747
|
+
prejsonfcs = GetFileChecksum(prefprejsoncontent, prefjsonchecksumtype, True, formatspecs)
|
|
2736
2748
|
if(prejsonfcs != prefjsonchecksum and not skipchecksum):
|
|
2737
2749
|
VerbosePrintOut("File JSON Data Checksum Error with file " +
|
|
2738
2750
|
prefname + " at offset " + str(prefhstart))
|
|
@@ -2819,13 +2831,13 @@ def ReadInFileWithContentToArray(infile, fmttype="auto", seekstart=0, seekend=0,
|
|
|
2819
2831
|
fp = UncompressFileAlt(fp, formatspecs)
|
|
2820
2832
|
checkcompressfile = CheckCompressionSubType(fp, formatspecs, True)
|
|
2821
2833
|
if(checkcompressfile == "tarfile" and TarFileCheck(infile)):
|
|
2822
|
-
return TarFileToArray(infile, seekstart, seekend, listonly, contentasfile, skipchecksum, formatspecs, seektoend,
|
|
2834
|
+
return TarFileToArray(infile, seekstart, seekend, listonly, contentasfile, skipchecksum, formatspecs, seektoend, True)
|
|
2823
2835
|
elif(checkcompressfile == "zipfile" and zipfile.is_zipfile(infile)):
|
|
2824
|
-
return ZipFileToArray(infile, seekstart, seekend, listonly, contentasfile, skipchecksum, formatspecs, seektoend,
|
|
2836
|
+
return ZipFileToArray(infile, seekstart, seekend, listonly, contentasfile, skipchecksum, formatspecs, seektoend, True)
|
|
2825
2837
|
elif(rarfile_support and checkcompressfile == "rarfile" and (rarfile.is_rarfile(infile) or rarfile.is_rarfile_sfx(infile))):
|
|
2826
|
-
return RarFileToArray(infile, seekstart, seekend, listonly, contentasfile, skipchecksum, formatspecs, seektoend,
|
|
2838
|
+
return RarFileToArray(infile, seekstart, seekend, listonly, contentasfile, skipchecksum, formatspecs, seektoend, True)
|
|
2827
2839
|
elif(py7zr_support and checkcompressfile == "7zipfile" and py7zr.is_7zfile(infile)):
|
|
2828
|
-
return SevenZipFileToArray(infile, seekstart, seekend, listonly, contentasfile, skipchecksum, formatspecs, seektoend,
|
|
2840
|
+
return SevenZipFileToArray(infile, seekstart, seekend, listonly, contentasfile, skipchecksum, formatspecs, seektoend, True)
|
|
2829
2841
|
elif(IsSingleDict(formatspecs) and checkcompressfile != formatspecs['format_magic']):
|
|
2830
2842
|
return False
|
|
2831
2843
|
elif(IsNestedDict(formatspecs) and checkcompressfile not in formatspecs):
|
|
@@ -2935,13 +2947,13 @@ def ReadInFileWithContentToArray(infile, fmttype="auto", seekstart=0, seekend=0,
|
|
|
2935
2947
|
if(IsNestedDict(formatspecs) and checkcompressfile in formatspecs):
|
|
2936
2948
|
formatspecs = formatspecs[checkcompressfile]
|
|
2937
2949
|
if(checkcompressfile == "tarfile" and TarFileCheck(infile)):
|
|
2938
|
-
return TarFileToArray(infile, seekstart, seekend, listonly, skipchecksum, formatspecs, seektoend,
|
|
2950
|
+
return TarFileToArray(infile, seekstart, seekend, listonly, skipchecksum, formatspecs, seektoend, True)
|
|
2939
2951
|
elif(checkcompressfile == "zipfile" and zipfile.is_zipfile(infile)):
|
|
2940
|
-
return ZipFileToArray(infile, seekstart, seekend, listonly, skipchecksum, formatspecs, seektoend,
|
|
2952
|
+
return ZipFileToArray(infile, seekstart, seekend, listonly, skipchecksum, formatspecs, seektoend, True)
|
|
2941
2953
|
elif(rarfile_support and checkcompressfile == "rarfile" and (rarfile.is_rarfile(infile) or rarfile.is_rarfile_sfx(infile))):
|
|
2942
|
-
return RarFileToArray(infile, seekstart, seekend, listonly, skipchecksum, formatspecs, seektoend,
|
|
2954
|
+
return RarFileToArray(infile, seekstart, seekend, listonly, skipchecksum, formatspecs, seektoend, True)
|
|
2943
2955
|
elif(py7zr_support and checkcompressfile == "7zipfile" and py7zr.is_7zfile(infile)):
|
|
2944
|
-
return SevenZipFileToArray(infile, seekstart, seekend, listonly, skipchecksum, formatspecs, seektoend,
|
|
2956
|
+
return SevenZipFileToArray(infile, seekstart, seekend, listonly, skipchecksum, formatspecs, seektoend, True)
|
|
2945
2957
|
elif(IsSingleDict(formatspecs) and checkcompressfile != formatspecs['format_magic']):
|
|
2946
2958
|
return False
|
|
2947
2959
|
elif(IsNestedDict(formatspecs) and checkcompressfile not in formatspecs):
|
|
@@ -2980,7 +2992,7 @@ def ReadInMultipleFileWithContentToArray(infile, fmttype="auto", seekstart=0, se
|
|
|
2980
2992
|
infile = [infile]
|
|
2981
2993
|
outretval = {}
|
|
2982
2994
|
for curfname in infile:
|
|
2983
|
-
|
|
2995
|
+
outretval[curfname] = ReadInFileWithContentToArray(curfname, fmttype, seekstart, seekend, listonly, contentasfile, uncompress, skipchecksum, formatspecs, seektoend)
|
|
2984
2996
|
return outretval
|
|
2985
2997
|
|
|
2986
2998
|
def ReadInMultipleFilesWithContentToArray(infile, fmttype="auto", seekstart=0, seekend=0, listonly=False, contentasfile=True, uncompress=True, skipchecksum=False, formatspecs=__file_format_multi_dict__, seektoend=False):
|
|
@@ -3007,13 +3019,13 @@ def ReadInFileWithContentToList(infile, fmttype="auto", seekstart=0, seekend=0,
|
|
|
3007
3019
|
fp = UncompressFileAlt(fp, formatspecs)
|
|
3008
3020
|
checkcompressfile = CheckCompressionSubType(fp, formatspecs, True)
|
|
3009
3021
|
if(checkcompressfile == "tarfile" and TarFileCheck(infile)):
|
|
3010
|
-
return TarFileToArray(infile, seekstart, seekend, listonly, contentasfile, skipchecksum, formatspecs, seektoend,
|
|
3022
|
+
return TarFileToArray(infile, seekstart, seekend, listonly, contentasfile, skipchecksum, formatspecs, seektoend, True)
|
|
3011
3023
|
elif(checkcompressfile == "zipfile" and zipfile.is_zipfile(infile)):
|
|
3012
|
-
return ZipFileToArray(infile, seekstart, seekend, listonly, contentasfile, skipchecksum, formatspecs, seektoend,
|
|
3024
|
+
return ZipFileToArray(infile, seekstart, seekend, listonly, contentasfile, skipchecksum, formatspecs, seektoend, True)
|
|
3013
3025
|
elif(rarfile_support and checkcompressfile == "rarfile" and (rarfile.is_rarfile(infile) or rarfile.is_rarfile_sfx(infile))):
|
|
3014
|
-
return RarFileToArray(infile, seekstart, seekend, listonly, contentasfile, skipchecksum, formatspecs, seektoend,
|
|
3026
|
+
return RarFileToArray(infile, seekstart, seekend, listonly, contentasfile, skipchecksum, formatspecs, seektoend, True)
|
|
3015
3027
|
elif(py7zr_support and checkcompressfile == "7zipfile" and py7zr.is_7zfile(infile)):
|
|
3016
|
-
return SevenZipFileToArray(infile, seekstart, seekend, listonly, contentasfile, skipchecksum, formatspecs, seektoend,
|
|
3028
|
+
return SevenZipFileToArray(infile, seekstart, seekend, listonly, contentasfile, skipchecksum, formatspecs, seektoend, True)
|
|
3017
3029
|
elif(IsSingleDict(formatspecs) and checkcompressfile != formatspecs['format_magic']):
|
|
3018
3030
|
return False
|
|
3019
3031
|
elif(IsNestedDict(formatspecs) and checkcompressfile not in formatspecs):
|
|
@@ -3123,13 +3135,13 @@ def ReadInFileWithContentToList(infile, fmttype="auto", seekstart=0, seekend=0,
|
|
|
3123
3135
|
if(IsNestedDict(formatspecs) and checkcompressfile in formatspecs):
|
|
3124
3136
|
formatspecs = formatspecs[checkcompressfile]
|
|
3125
3137
|
if(checkcompressfile == "tarfile" and TarFileCheck(infile)):
|
|
3126
|
-
return TarFileToArray(infile, seekstart, seekend, listonly, skipchecksum, formatspecs, seektoend,
|
|
3138
|
+
return TarFileToArray(infile, seekstart, seekend, listonly, skipchecksum, formatspecs, seektoend, True)
|
|
3127
3139
|
elif(checkcompressfile == "zipfile" and zipfile.is_zipfile(infile)):
|
|
3128
|
-
return ZipFileToArray(infile, seekstart, seekend, listonly, skipchecksum, formatspecs, seektoend,
|
|
3140
|
+
return ZipFileToArray(infile, seekstart, seekend, listonly, skipchecksum, formatspecs, seektoend, True)
|
|
3129
3141
|
elif(rarfile_support and checkcompressfile == "rarfile" and (rarfile.is_rarfile(infile) or rarfile.is_rarfile_sfx(infile))):
|
|
3130
|
-
return RarFileToArray(infile, seekstart, seekend, listonly, skipchecksum, formatspecs, seektoend,
|
|
3142
|
+
return RarFileToArray(infile, seekstart, seekend, listonly, skipchecksum, formatspecs, seektoend, True)
|
|
3131
3143
|
elif(py7zr_support and checkcompressfile == "7zipfile" and py7zr.is_7zfile(infile)):
|
|
3132
|
-
return SevenZipFileToArray(infile, seekstart, seekend, listonly, skipchecksum, formatspecs, seektoend,
|
|
3144
|
+
return SevenZipFileToArray(infile, seekstart, seekend, listonly, skipchecksum, formatspecs, seektoend, True)
|
|
3133
3145
|
elif(IsSingleDict(formatspecs) and checkcompressfile != formatspecs['format_magic']):
|
|
3134
3146
|
return False
|
|
3135
3147
|
elif(IsNestedDict(formatspecs) and checkcompressfile not in formatspecs):
|
|
@@ -3168,7 +3180,7 @@ def ReadInMultipleFileWithContentToList(infile, fmttype="auto", seekstart=0, see
|
|
|
3168
3180
|
infile = [infile]
|
|
3169
3181
|
outretval = {}
|
|
3170
3182
|
for curfname in infile:
|
|
3171
|
-
curretfile =
|
|
3183
|
+
curretfile[curfname] = ReadInFileWithContentToList(curfname, fmttype, seekstart, seekend, listonly, contentasfile, uncompress, skipchecksum, formatspecs, seektoend)
|
|
3172
3184
|
return outretval
|
|
3173
3185
|
|
|
3174
3186
|
def ReadInMultipleFilesWithContentToList(infile, fmttype="auto", seekstart=0, seekend=0, listonly=False, contentasfile=True, uncompress=True, skipchecksum=False, formatspecs=__file_format_multi_dict__, seektoend=False):
|
|
@@ -3213,7 +3225,7 @@ def AppendFileHeader(fp, numfiles, fencoding, extradata=[], checksumtype="crc32"
|
|
|
3213
3225
|
tmpoutlist = []
|
|
3214
3226
|
tmpoutlist.append(extrasizelen)
|
|
3215
3227
|
tmpoutlist.append(extrafields)
|
|
3216
|
-
fnumfiles = format(
|
|
3228
|
+
fnumfiles = format(numfiles, 'x').lower()
|
|
3217
3229
|
tmpoutlen = 3 + len(tmpoutlist) + len(extradata) + 2
|
|
3218
3230
|
tmpoutlenhex = format(tmpoutlen, 'x').lower()
|
|
3219
3231
|
fnumfilesa = AppendNullBytes(
|
|
@@ -3267,11 +3279,11 @@ def MakeEmptyFilePointer(fp, fmttype=__file_format_default__, checksumtype="crc3
|
|
|
3267
3279
|
return fp
|
|
3268
3280
|
|
|
3269
3281
|
|
|
3270
|
-
def
|
|
3282
|
+
def MakeEmptyArchiveFilePointer(fp, fmttype=__file_format_default__, checksumtype="crc32", formatspecs=__file_format_multi_dict__):
|
|
3271
3283
|
return MakeEmptyFilePointer(fp, fmttype, checksumtype, formatspecs)
|
|
3272
3284
|
|
|
3273
3285
|
|
|
3274
|
-
def MakeEmptyFile(outfile, fmttype="auto", compression="auto", compresswholefile=True, compressionlevel=None, checksumtype="crc32", formatspecs=__file_format_multi_dict__, returnfp=False):
|
|
3286
|
+
def MakeEmptyFile(outfile, fmttype="auto", compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, checksumtype="crc32", formatspecs=__file_format_multi_dict__, returnfp=False):
|
|
3275
3287
|
if(IsNestedDict(formatspecs) and fmttype=="auto" and
|
|
3276
3288
|
(outfile != "-" and outfile is not None and not hasattr(outfile, "read") and not hasattr(outfile, "write"))):
|
|
3277
3289
|
get_in_ext = os.path.splitext(outfile)
|
|
@@ -3315,7 +3327,7 @@ def MakeEmptyFile(outfile, fmttype="auto", compression="auto", compresswholefile
|
|
|
3315
3327
|
AppendFileHeader(fp, 0, "UTF-8", [], checksumtype, formatspecs)
|
|
3316
3328
|
if(outfile == "-" or outfile is None or hasattr(outfile, "read") or hasattr(outfile, "write")):
|
|
3317
3329
|
fp = CompressOpenFileAlt(
|
|
3318
|
-
fp, compression, compressionlevel, formatspecs)
|
|
3330
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
3319
3331
|
try:
|
|
3320
3332
|
fp.flush()
|
|
3321
3333
|
if(hasattr(os, "sync")):
|
|
@@ -3339,7 +3351,7 @@ def MakeEmptyFile(outfile, fmttype="auto", compression="auto", compresswholefile
|
|
|
3339
3351
|
return outvar
|
|
3340
3352
|
elif(re.findall("^(ftp|ftps|sftp):\\/\\/", outfile)):
|
|
3341
3353
|
fp = CompressOpenFileAlt(
|
|
3342
|
-
fp, compression, compressionlevel, formatspecs)
|
|
3354
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
3343
3355
|
fp.seek(0, 0)
|
|
3344
3356
|
upload_file_to_internet_file(fp, outfile)
|
|
3345
3357
|
if(returnfp):
|
|
@@ -3350,8 +3362,8 @@ def MakeEmptyFile(outfile, fmttype="auto", compression="auto", compresswholefile
|
|
|
3350
3362
|
return True
|
|
3351
3363
|
|
|
3352
3364
|
|
|
3353
|
-
def
|
|
3354
|
-
return MakeEmptyFile(outfile, compression, compresswholefile, compressionlevel, checksumtype, formatspecs, returnfp)
|
|
3365
|
+
def MakeEmptyArchiveFile(outfile, compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, checksumtype="crc32", formatspecs=__file_format_dict__, returnfp=False):
|
|
3366
|
+
return MakeEmptyFile(outfile, "auto", compression, compresswholefile, compressionlevel, compressionuselist, checksumtype, formatspecs, returnfp)
|
|
3355
3367
|
|
|
3356
3368
|
|
|
3357
3369
|
def AppendFileHeaderWithContent(fp, filevalues=[], extradata=[], jsondata={}, filecontent="", checksumtype=["crc32", "crc32", "crc32"], formatspecs=__file_format_dict__):
|
|
@@ -3450,6 +3462,7 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, filevalues=[], ext
|
|
|
3450
3462
|
if(verbose):
|
|
3451
3463
|
logging.basicConfig(format="%(message)s",
|
|
3452
3464
|
stream=sys.stdout, level=logging.DEBUG)
|
|
3465
|
+
infilelist = []
|
|
3453
3466
|
if(infiles == "-"):
|
|
3454
3467
|
for line in sys.stdin:
|
|
3455
3468
|
infilelist.append(line.strip())
|
|
@@ -3490,7 +3503,7 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, filevalues=[], ext
|
|
|
3490
3503
|
inodetoforminode = {}
|
|
3491
3504
|
numfiles = int(len(GetDirList))
|
|
3492
3505
|
fnumfiles = format(numfiles, 'x').lower()
|
|
3493
|
-
AppendFileHeader(fp,
|
|
3506
|
+
AppendFileHeader(fp, numfiles, "UTF-8", [], checksumtype[0], formatspecs)
|
|
3494
3507
|
FullSizeFilesAlt = 0
|
|
3495
3508
|
for curfname in GetDirList:
|
|
3496
3509
|
fencoding = "UTF-8"
|
|
@@ -3588,7 +3601,7 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, filevalues=[], ext
|
|
|
3588
3601
|
elif ftype in data_types:
|
|
3589
3602
|
fsize = format(int(fstatinfo.st_size), 'x').lower()
|
|
3590
3603
|
else:
|
|
3591
|
-
fsize = format(int(fstatinfo.st_size)).lower()
|
|
3604
|
+
fsize = format(int(fstatinfo.st_size), 'x').lower()
|
|
3592
3605
|
fatime = format(int(fstatinfo.st_atime), 'x').lower()
|
|
3593
3606
|
fmtime = format(int(fstatinfo.st_mtime), 'x').lower()
|
|
3594
3607
|
fctime = format(int(fstatinfo.st_ctime), 'x').lower()
|
|
@@ -3636,11 +3649,14 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, filevalues=[], ext
|
|
|
3636
3649
|
fcontents = BytesIO()
|
|
3637
3650
|
chunk_size = 1024
|
|
3638
3651
|
fcencoding = "UTF-8"
|
|
3639
|
-
|
|
3652
|
+
curcompression = "none"
|
|
3653
|
+
if not followlink and ftype in data_types:
|
|
3640
3654
|
with open(fname, "rb") as fpc:
|
|
3641
3655
|
shutil.copyfileobj(fpc, fcontents)
|
|
3656
|
+
typechecktest = CheckCompressionType(fcontents, closefp=False)
|
|
3657
|
+
fcontents.seek(0, 0)
|
|
3642
3658
|
fcencoding = GetFileEncoding(fcontents, False)
|
|
3643
|
-
if(not compresswholefile):
|
|
3659
|
+
if(typechecktest is False and not compresswholefile):
|
|
3644
3660
|
fcontents.seek(0, 2)
|
|
3645
3661
|
ucfsize = fcontents.tell()
|
|
3646
3662
|
fcontents.seek(0, 0)
|
|
@@ -3655,16 +3671,13 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, filevalues=[], ext
|
|
|
3655
3671
|
fcontents.seek(0, 0)
|
|
3656
3672
|
cfcontents.seek(0, 0)
|
|
3657
3673
|
cfcontents = CompressOpenFileAlt(
|
|
3658
|
-
cfcontents, compressionuselist[ilmin], compressionlevel, formatspecs)
|
|
3674
|
+
cfcontents, compressionuselist[ilmin], compressionlevel, compressionuselist, formatspecs)
|
|
3659
3675
|
if(cfcontents):
|
|
3660
3676
|
cfcontents.seek(0, 2)
|
|
3661
3677
|
ilcsize.append(cfcontents.tell())
|
|
3662
3678
|
cfcontents.close()
|
|
3663
3679
|
else:
|
|
3664
|
-
|
|
3665
|
-
ilcsize.append(sys.maxint)
|
|
3666
|
-
except AttributeError:
|
|
3667
|
-
ilcsize.append(sys.maxsize)
|
|
3680
|
+
ilcsize.append(float("inf"))
|
|
3668
3681
|
ilmin = ilmin + 1
|
|
3669
3682
|
ilcmin = ilcsize.index(min(ilcsize))
|
|
3670
3683
|
curcompression = compressionuselist[ilcmin]
|
|
@@ -3673,7 +3686,7 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, filevalues=[], ext
|
|
|
3673
3686
|
shutil.copyfileobj(fcontents, cfcontents)
|
|
3674
3687
|
cfcontents.seek(0, 0)
|
|
3675
3688
|
cfcontents = CompressOpenFileAlt(
|
|
3676
|
-
cfcontents, curcompression, compressionlevel, formatspecs)
|
|
3689
|
+
cfcontents, curcompression, compressionlevel, compressionuselist, formatspecs)
|
|
3677
3690
|
cfcontents.seek(0, 2)
|
|
3678
3691
|
cfsize = cfcontents.tell()
|
|
3679
3692
|
if(ucfsize > cfsize):
|
|
@@ -3681,13 +3694,16 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, filevalues=[], ext
|
|
|
3681
3694
|
fcompression = curcompression
|
|
3682
3695
|
fcontents.close()
|
|
3683
3696
|
fcontents = cfcontents
|
|
3684
|
-
|
|
3697
|
+
elif followlink and (ftype == 1 or ftype == 2):
|
|
3685
3698
|
if(not os.path.exists(flinkname)):
|
|
3686
3699
|
return False
|
|
3687
3700
|
flstatinfo = os.stat(flinkname)
|
|
3688
3701
|
with open(flinkname, "rb") as fpc:
|
|
3689
3702
|
shutil.copyfileobj(fpc, fcontents)
|
|
3690
|
-
|
|
3703
|
+
typechecktest = CheckCompressionType(fcontents, closefp=False)
|
|
3704
|
+
fcontents.seek(0, 0)
|
|
3705
|
+
fcencoding = GetFileEncoding(fcontents, False)
|
|
3706
|
+
if(typechecktest is False and not compresswholefile):
|
|
3691
3707
|
fcontents.seek(0, 2)
|
|
3692
3708
|
ucfsize = fcontents.tell()
|
|
3693
3709
|
fcontents.seek(0, 0)
|
|
@@ -3702,16 +3718,13 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, filevalues=[], ext
|
|
|
3702
3718
|
fcontents.seek(0, 0)
|
|
3703
3719
|
cfcontents.seek(0, 0)
|
|
3704
3720
|
cfcontents = CompressOpenFileAlt(
|
|
3705
|
-
cfcontents, compressionuselist[ilmin], compressionlevel, formatspecs)
|
|
3721
|
+
cfcontents, compressionuselist[ilmin], compressionlevel, compressionuselist, formatspecs)
|
|
3706
3722
|
if(cfcontents):
|
|
3707
3723
|
cfcontents.seek(0, 2)
|
|
3708
3724
|
ilcsize.append(cfcontents.tell())
|
|
3709
3725
|
cfcontents.close()
|
|
3710
3726
|
else:
|
|
3711
|
-
|
|
3712
|
-
ilcsize.append(sys.maxint)
|
|
3713
|
-
except AttributeError:
|
|
3714
|
-
ilcsize.append(sys.maxsize)
|
|
3727
|
+
ilcsize.append(float("inf"))
|
|
3715
3728
|
ilmin = ilmin + 1
|
|
3716
3729
|
ilcmin = ilcsize.index(min(ilcsize))
|
|
3717
3730
|
curcompression = compressionuselist[ilcmin]
|
|
@@ -3720,7 +3733,7 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, filevalues=[], ext
|
|
|
3720
3733
|
shutil.copyfileobj(fcontents, cfcontents)
|
|
3721
3734
|
cfcontents.seek(0, 0)
|
|
3722
3735
|
cfcontents = CompressOpenFileAlt(
|
|
3723
|
-
cfcontents, curcompression, compressionlevel, formatspecs)
|
|
3736
|
+
cfcontents, curcompression, compressionlevel, compressionuselist, formatspecs)
|
|
3724
3737
|
cfcontents.seek(0, 2)
|
|
3725
3738
|
cfsize = cfcontents.tell()
|
|
3726
3739
|
if(ucfsize > cfsize):
|
|
@@ -3762,7 +3775,7 @@ def AppendListsWithContent(inlist, fp, dirlistfromtxt=False, filevalues=[], extr
|
|
|
3762
3775
|
inodetoforminode = {}
|
|
3763
3776
|
numfiles = int(len(GetDirList))
|
|
3764
3777
|
fnumfiles = format(numfiles, 'x').lower()
|
|
3765
|
-
AppendFileHeader(fp,
|
|
3778
|
+
AppendFileHeader(fp, numfiles, "UTF-8", [], checksumtype[0], formatspecs)
|
|
3766
3779
|
for curfname in GetDirList:
|
|
3767
3780
|
ftype = format(curfname[0], 'x').lower()
|
|
3768
3781
|
fencoding = curfname[1]
|
|
@@ -3864,7 +3877,7 @@ def AppendFilesWithContentToOutFile(infiles, outfile, dirlistfromtxt=False, fmtt
|
|
|
3864
3877
|
compresswholefile, compressionlevel, compressionuselist, followlink, checksumtype, formatspecs, verbose)
|
|
3865
3878
|
if(outfile == "-" or outfile is None or hasattr(outfile, "read") or hasattr(outfile, "write")):
|
|
3866
3879
|
fp = CompressOpenFileAlt(
|
|
3867
|
-
fp, compression, compressionlevel, formatspecs)
|
|
3880
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
3868
3881
|
try:
|
|
3869
3882
|
fp.flush()
|
|
3870
3883
|
if(hasattr(os, "sync")):
|
|
@@ -3888,7 +3901,7 @@ def AppendFilesWithContentToOutFile(infiles, outfile, dirlistfromtxt=False, fmtt
|
|
|
3888
3901
|
return outvar
|
|
3889
3902
|
elif((not hasattr(outfile, "read") and not hasattr(outfile, "write")) and re.findall("^(ftp|ftps|sftp):\\/\\/", outfile)):
|
|
3890
3903
|
fp = CompressOpenFileAlt(
|
|
3891
|
-
fp, compression, compressionlevel, formatspecs)
|
|
3904
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
3892
3905
|
fp.seek(0, 0)
|
|
3893
3906
|
upload_file_to_internet_file(fp, outfile)
|
|
3894
3907
|
if(returnfp):
|
|
@@ -3944,7 +3957,7 @@ def AppendListsWithContentToOutFile(inlist, outfile, dirlistfromtxt=False, fmtty
|
|
|
3944
3957
|
compresswholefile, compressionlevel, followlink, checksumtype, formatspecs, verbose)
|
|
3945
3958
|
if(outfile == "-" or outfile is None or hasattr(outfile, "read") or hasattr(outfile, "write")):
|
|
3946
3959
|
fp = CompressOpenFileAlt(
|
|
3947
|
-
fp, compression, compressionlevel, formatspecs)
|
|
3960
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
3948
3961
|
try:
|
|
3949
3962
|
fp.flush()
|
|
3950
3963
|
if(hasattr(os, "sync")):
|
|
@@ -3968,7 +3981,7 @@ def AppendListsWithContentToOutFile(inlist, outfile, dirlistfromtxt=False, fmtty
|
|
|
3968
3981
|
return outvar
|
|
3969
3982
|
elif((not hasattr(outfile, "read") and not hasattr(outfile, "write")) and re.findall("^(ftp|ftps|sftp):\\/\\/", outfile)):
|
|
3970
3983
|
fp = CompressOpenFileAlt(
|
|
3971
|
-
fp, compression, compressionlevel, formatspecs)
|
|
3984
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
3972
3985
|
fp.seek(0, 0)
|
|
3973
3986
|
upload_file_to_internet_file(fp, outfile)
|
|
3974
3987
|
if(returnfp):
|
|
@@ -4659,13 +4672,13 @@ def UncompressBytesAltFP(fp, formatspecs=__file_format_multi_dict__):
|
|
|
4659
4672
|
return filefp
|
|
4660
4673
|
|
|
4661
4674
|
|
|
4662
|
-
def CompressOpenFileAlt(fp, compression="auto", compressionlevel=None, formatspecs=__file_format_dict__):
|
|
4675
|
+
def CompressOpenFileAlt(fp, compression="auto", compressionlevel=None, compressionuselist=compressionlistalt, formatspecs=__file_format_dict__):
|
|
4663
4676
|
if(not hasattr(fp, "read")):
|
|
4664
4677
|
return False
|
|
4665
4678
|
fp.seek(0, 0)
|
|
4666
4679
|
if(not compression or compression == formatspecs['format_magic']):
|
|
4667
4680
|
compression = "auto"
|
|
4668
|
-
if(compression not in
|
|
4681
|
+
if(compression not in compressionuselist and compression is None):
|
|
4669
4682
|
compression = "auto"
|
|
4670
4683
|
if(compression == "gzip" and compression in compressionsupport):
|
|
4671
4684
|
bytesfp = BytesIO()
|
|
@@ -4884,7 +4897,7 @@ def PackCatFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", compress
|
|
|
4884
4897
|
outfile = RemoveWindowsPath(outfile)
|
|
4885
4898
|
if(not compression or compression == formatspecs['format_magic']):
|
|
4886
4899
|
compression = "auto"
|
|
4887
|
-
if(compression not in
|
|
4900
|
+
if(compression not in compressionuselist and compression is None):
|
|
4888
4901
|
compression = "auto"
|
|
4889
4902
|
if(verbose):
|
|
4890
4903
|
logging.basicConfig(format="%(message)s",
|
|
@@ -5051,7 +5064,7 @@ def PackCatFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", compress
|
|
|
5051
5064
|
elif ftype in data_types:
|
|
5052
5065
|
fsize = format(int(fstatinfo.st_size), 'x').lower()
|
|
5053
5066
|
else:
|
|
5054
|
-
fsize = format(int(fstatinfo.st_size)).lower()
|
|
5067
|
+
fsize = format(int(fstatinfo.st_size), 'x').lower()
|
|
5055
5068
|
fatime = format(int(fstatinfo.st_atime), 'x').lower()
|
|
5056
5069
|
fmtime = format(int(fstatinfo.st_mtime), 'x').lower()
|
|
5057
5070
|
fctime = format(int(fstatinfo.st_ctime), 'x').lower()
|
|
@@ -5098,11 +5111,14 @@ def PackCatFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", compress
|
|
|
5098
5111
|
fcsize = format(int(0), 'x').lower()
|
|
5099
5112
|
fcontents = BytesIO()
|
|
5100
5113
|
fcencoding = "UTF-8"
|
|
5101
|
-
|
|
5114
|
+
curcompression = "none"
|
|
5115
|
+
if not followlink and ftype in data_types:
|
|
5102
5116
|
with open(fname, "rb") as fpc:
|
|
5103
5117
|
shutil.copyfileobj(fpc, fcontents)
|
|
5118
|
+
typechecktest = CheckCompressionType(fcontents, closefp=False)
|
|
5119
|
+
fcontents.seek(0, 0)
|
|
5104
5120
|
fcencoding = GetFileEncoding(fcontents, False)
|
|
5105
|
-
if(not compresswholefile):
|
|
5121
|
+
if(typechecktest is False and not compresswholefile):
|
|
5106
5122
|
fcontents.seek(0, 2)
|
|
5107
5123
|
ucfsize = fcontents.tell()
|
|
5108
5124
|
fcontents.seek(0, 0)
|
|
@@ -5117,16 +5133,13 @@ def PackCatFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", compress
|
|
|
5117
5133
|
fcontents.seek(0, 0)
|
|
5118
5134
|
cfcontents.seek(0, 0)
|
|
5119
5135
|
cfcontents = CompressOpenFileAlt(
|
|
5120
|
-
cfcontents, compressionuselist[ilmin], compressionlevel, formatspecs)
|
|
5136
|
+
cfcontents, compressionuselist[ilmin], compressionlevel, compressionuselist, formatspecs)
|
|
5121
5137
|
if(cfcontents):
|
|
5122
5138
|
cfcontents.seek(0, 2)
|
|
5123
5139
|
ilcsize.append(cfcontents.tell())
|
|
5124
5140
|
cfcontents.close()
|
|
5125
5141
|
else:
|
|
5126
|
-
|
|
5127
|
-
ilcsize.append(sys.maxint)
|
|
5128
|
-
except AttributeError:
|
|
5129
|
-
ilcsize.append(sys.maxsize)
|
|
5142
|
+
ilcsize.append(float("inf"))
|
|
5130
5143
|
ilmin = ilmin + 1
|
|
5131
5144
|
ilcmin = ilcsize.index(min(ilcsize))
|
|
5132
5145
|
curcompression = compressionuselist[ilcmin]
|
|
@@ -5135,7 +5148,7 @@ def PackCatFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", compress
|
|
|
5135
5148
|
shutil.copyfileobj(fcontents, cfcontents)
|
|
5136
5149
|
cfcontents.seek(0, 0)
|
|
5137
5150
|
cfcontents = CompressOpenFileAlt(
|
|
5138
|
-
cfcontents, curcompression, compressionlevel, formatspecs)
|
|
5151
|
+
cfcontents, curcompression, compressionlevel, compressionuselist, formatspecs)
|
|
5139
5152
|
cfcontents.seek(0, 2)
|
|
5140
5153
|
cfsize = cfcontents.tell()
|
|
5141
5154
|
if(ucfsize > cfsize):
|
|
@@ -5143,15 +5156,16 @@ def PackCatFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", compress
|
|
|
5143
5156
|
fcompression = curcompression
|
|
5144
5157
|
fcontents.close()
|
|
5145
5158
|
fcontents = cfcontents
|
|
5146
|
-
|
|
5147
|
-
fcompression = ""
|
|
5148
|
-
if(followlink and (ftype == 1 or ftype == 2)):
|
|
5159
|
+
elif followlink and (ftype == 1 or ftype == 2):
|
|
5149
5160
|
if(not os.path.exists(flinkname)):
|
|
5150
5161
|
return False
|
|
5151
5162
|
flstatinfo = os.stat(flinkname)
|
|
5152
5163
|
with open(flinkname, "rb") as fpc:
|
|
5153
5164
|
shutil.copyfileobj(fpc, fcontents)
|
|
5154
|
-
|
|
5165
|
+
typechecktest = CheckCompressionType(fcontents, closefp=False)
|
|
5166
|
+
fcontents.seek(0, 0)
|
|
5167
|
+
fcencoding = GetFileEncoding(fcontents, False)
|
|
5168
|
+
if(typechecktest is False and not compresswholefile):
|
|
5155
5169
|
fcontents.seek(0, 2)
|
|
5156
5170
|
ucfsize = fcontents.tell()
|
|
5157
5171
|
fcontents.seek(0, 0)
|
|
@@ -5166,16 +5180,13 @@ def PackCatFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", compress
|
|
|
5166
5180
|
fcontents.seek(0, 0)
|
|
5167
5181
|
cfcontents.seek(0, 0)
|
|
5168
5182
|
cfcontents = CompressOpenFileAlt(
|
|
5169
|
-
cfcontents, compressionuselist[ilmin], compressionlevel, formatspecs)
|
|
5183
|
+
cfcontents, compressionuselist[ilmin], compressionlevel, compressionuselist, formatspecs)
|
|
5170
5184
|
if(cfcontents):
|
|
5171
5185
|
cfcontents.seek(0, 2)
|
|
5172
5186
|
ilcsize.append(cfcontents.tell())
|
|
5173
5187
|
cfcontents.close()
|
|
5174
5188
|
else:
|
|
5175
|
-
|
|
5176
|
-
ilcsize.append(sys.maxint)
|
|
5177
|
-
except AttributeError:
|
|
5178
|
-
ilcsize.append(sys.maxsize)
|
|
5189
|
+
ilcsize.append(float("inf"))
|
|
5179
5190
|
ilmin = ilmin + 1
|
|
5180
5191
|
ilcmin = ilcsize.index(min(ilcsize))
|
|
5181
5192
|
curcompression = compressionuselist[ilcmin]
|
|
@@ -5184,7 +5195,7 @@ def PackCatFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", compress
|
|
|
5184
5195
|
shutil.copyfileobj(fcontents, cfcontents)
|
|
5185
5196
|
cfcontents.seek(0, 0)
|
|
5186
5197
|
cfcontents = CompressOpenFileAlt(
|
|
5187
|
-
cfcontents, curcompression, compressionlevel, formatspecs)
|
|
5198
|
+
cfcontents, curcompression, compressionlevel, compressionuselist, formatspecs)
|
|
5188
5199
|
cfcontents.seek(0, 2)
|
|
5189
5200
|
cfsize = cfcontents.tell()
|
|
5190
5201
|
if(ucfsize > cfsize):
|
|
@@ -5192,6 +5203,8 @@ def PackCatFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", compress
|
|
|
5192
5203
|
fcompression = curcompression
|
|
5193
5204
|
fcontents.close()
|
|
5194
5205
|
fcontents = cfcontents
|
|
5206
|
+
if(fcompression == "none"):
|
|
5207
|
+
fcompression = ""
|
|
5195
5208
|
fcontents.seek(0, 0)
|
|
5196
5209
|
ftypehex = format(ftype, 'x').lower()
|
|
5197
5210
|
tmpoutlist = [ftypehex, fencoding, fcencoding, fname, flinkname, fsize, fatime, fmtime, fctime, fbtime, fmode, fwinattributes, fcompression,
|
|
@@ -5207,7 +5220,7 @@ def PackCatFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", compress
|
|
|
5207
5220
|
return False
|
|
5208
5221
|
if(outfile == "-" or outfile is None or hasattr(outfile, "read") or hasattr(outfile, "write")):
|
|
5209
5222
|
fp = CompressOpenFileAlt(
|
|
5210
|
-
fp, compression, compressionlevel, formatspecs)
|
|
5223
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
5211
5224
|
try:
|
|
5212
5225
|
fp.flush()
|
|
5213
5226
|
if(hasattr(os, "sync")):
|
|
@@ -5231,7 +5244,7 @@ def PackCatFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", compress
|
|
|
5231
5244
|
return outvar
|
|
5232
5245
|
elif((not hasattr(outfile, "read") and not hasattr(outfile, "write")) and re.findall("^(ftp|ftps|sftp):\\/\\/", outfile)):
|
|
5233
5246
|
fp = CompressOpenFileAlt(
|
|
5234
|
-
fp, compression, compressionlevel, formatspecs)
|
|
5247
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
5235
5248
|
fp.seek(0, 0)
|
|
5236
5249
|
upload_file_to_internet_file(fp, outfile)
|
|
5237
5250
|
if(returnfp):
|
|
@@ -5269,7 +5282,7 @@ def PackCatFileFromTarFile(infile, outfile, fmttype="auto", compression="auto",
|
|
|
5269
5282
|
outfile = RemoveWindowsPath(outfile)
|
|
5270
5283
|
if(not compression or compression == formatspecs['format_magic']):
|
|
5271
5284
|
compression = "auto"
|
|
5272
|
-
if(compression not in
|
|
5285
|
+
if(compression not in compressionuselist and compression is None):
|
|
5273
5286
|
compression = "auto"
|
|
5274
5287
|
if(verbose):
|
|
5275
5288
|
logging.basicConfig(format="%(message)s", stream=sys.stdout, level=logging.DEBUG)
|
|
@@ -5344,7 +5357,7 @@ def PackCatFileFromTarFile(infile, outfile, fmttype="auto", compression="auto",
|
|
|
5344
5357
|
if 'zstandard' in sys.modules:
|
|
5345
5358
|
infile = ZstdFile(fileobj=infile, mode="rb")
|
|
5346
5359
|
elif 'pyzstd' in sys.modules:
|
|
5347
|
-
|
|
5360
|
+
infile = pyzstd.zstdfile.ZstdFile(fileobj=infile, mode="rb")
|
|
5348
5361
|
tarfp = tarfile.open(fileobj=infile, mode="r")
|
|
5349
5362
|
else:
|
|
5350
5363
|
tarfp = tarfile.open(fileobj=infile, mode="r")
|
|
@@ -5356,7 +5369,7 @@ def PackCatFileFromTarFile(infile, outfile, fmttype="auto", compression="auto",
|
|
|
5356
5369
|
if 'zstandard' in sys.modules:
|
|
5357
5370
|
infile = ZstdFile(fileobj=infile, mode="rb")
|
|
5358
5371
|
elif 'pyzstd' in sys.modules:
|
|
5359
|
-
|
|
5372
|
+
infile = pyzstd.zstdfile.ZstdFile(fileobj=infile, mode="rb")
|
|
5360
5373
|
tarfp = tarfile.open(fileobj=infile, mode="r")
|
|
5361
5374
|
else:
|
|
5362
5375
|
tarfp = tarfile.open(infile, "r")
|
|
@@ -5445,11 +5458,15 @@ def PackCatFileFromTarFile(infile, outfile, fmttype="auto", compression="auto",
|
|
|
5445
5458
|
fcsize = format(int(0), 'x').lower()
|
|
5446
5459
|
fcontents = BytesIO()
|
|
5447
5460
|
fcencoding = "UTF-8"
|
|
5461
|
+
curcompression = "none"
|
|
5448
5462
|
if ftype in data_types:
|
|
5449
5463
|
fpc = tarfp.extractfile(member)
|
|
5464
|
+
fpc.close()
|
|
5450
5465
|
shutil.copyfileobj(fpc, fcontents)
|
|
5466
|
+
typechecktest = CheckCompressionType(fcontents, closefp=False)
|
|
5467
|
+
fcontents.seek(0, 0)
|
|
5451
5468
|
fcencoding = GetFileEncoding(fcontents, False)
|
|
5452
|
-
if(not compresswholefile):
|
|
5469
|
+
if(typechecktest is False and not compresswholefile):
|
|
5453
5470
|
fcontents.seek(0, 2)
|
|
5454
5471
|
ucfsize = fcontents.tell()
|
|
5455
5472
|
fcontents.seek(0, 0)
|
|
@@ -5464,16 +5481,13 @@ def PackCatFileFromTarFile(infile, outfile, fmttype="auto", compression="auto",
|
|
|
5464
5481
|
fcontents.seek(0, 0)
|
|
5465
5482
|
cfcontents.seek(0, 0)
|
|
5466
5483
|
cfcontents = CompressOpenFileAlt(
|
|
5467
|
-
cfcontents, compressionuselist[ilmin], compressionlevel, formatspecs)
|
|
5484
|
+
cfcontents, compressionuselist[ilmin], compressionlevel, compressionuselist, formatspecs)
|
|
5468
5485
|
if(cfcontents):
|
|
5469
5486
|
cfcontents.seek(0, 2)
|
|
5470
5487
|
ilcsize.append(cfcontents.tell())
|
|
5471
5488
|
cfcontents.close()
|
|
5472
5489
|
else:
|
|
5473
|
-
|
|
5474
|
-
ilcsize.append(sys.maxint)
|
|
5475
|
-
except AttributeError:
|
|
5476
|
-
ilcsize.append(sys.maxsize)
|
|
5490
|
+
ilcsize.append(float("inf"))
|
|
5477
5491
|
ilmin = ilmin + 1
|
|
5478
5492
|
ilcmin = ilcsize.index(min(ilcsize))
|
|
5479
5493
|
curcompression = compressionuselist[ilcmin]
|
|
@@ -5482,7 +5496,7 @@ def PackCatFileFromTarFile(infile, outfile, fmttype="auto", compression="auto",
|
|
|
5482
5496
|
shutil.copyfileobj(fcontents, cfcontents)
|
|
5483
5497
|
cfcontents.seek(0, 0)
|
|
5484
5498
|
cfcontents = CompressOpenFileAlt(
|
|
5485
|
-
cfcontents, curcompression, compressionlevel, formatspecs)
|
|
5499
|
+
cfcontents, curcompression, compressionlevel, compressionuselist, formatspecs)
|
|
5486
5500
|
cfcontents.seek(0, 2)
|
|
5487
5501
|
cfsize = cfcontents.tell()
|
|
5488
5502
|
if(ucfsize > cfsize):
|
|
@@ -5507,7 +5521,7 @@ def PackCatFileFromTarFile(infile, outfile, fmttype="auto", compression="auto",
|
|
|
5507
5521
|
return False
|
|
5508
5522
|
if(outfile == "-" or outfile is None or hasattr(outfile, "read") or hasattr(outfile, "write")):
|
|
5509
5523
|
fp = CompressOpenFileAlt(
|
|
5510
|
-
fp, compression, compressionlevel, formatspecs)
|
|
5524
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
5511
5525
|
try:
|
|
5512
5526
|
fp.flush()
|
|
5513
5527
|
if(hasattr(os, "sync")):
|
|
@@ -5531,7 +5545,7 @@ def PackCatFileFromTarFile(infile, outfile, fmttype="auto", compression="auto",
|
|
|
5531
5545
|
return outvar
|
|
5532
5546
|
elif((not hasattr(outfile, "read") and not hasattr(outfile, "write")) and re.findall("^(ftp|ftps|sftp):\\/\\/", outfile)):
|
|
5533
5547
|
fp = CompressOpenFileAlt(
|
|
5534
|
-
fp, compression, compressionlevel, formatspecs)
|
|
5548
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
5535
5549
|
fp.seek(0, 0)
|
|
5536
5550
|
upload_file_to_internet_file(fp, outfile)
|
|
5537
5551
|
if(returnfp):
|
|
@@ -5565,7 +5579,7 @@ def PackCatFileFromZipFile(infile, outfile, fmttype="auto", compression="auto",
|
|
|
5565
5579
|
outfile = RemoveWindowsPath(outfile)
|
|
5566
5580
|
if(not compression or compression == formatspecs['format_magic']):
|
|
5567
5581
|
compression = "auto"
|
|
5568
|
-
if(compression not in
|
|
5582
|
+
if(compression not in compressionuselist and compression is None):
|
|
5569
5583
|
compression = "auto"
|
|
5570
5584
|
if(verbose):
|
|
5571
5585
|
logging.basicConfig(format="%(message)s", stream=sys.stdout, level=logging.DEBUG)
|
|
@@ -5743,10 +5757,13 @@ def PackCatFileFromZipFile(infile, outfile, fmttype="auto", compression="auto",
|
|
|
5743
5757
|
fgname = ""
|
|
5744
5758
|
fcontents = BytesIO()
|
|
5745
5759
|
fcencoding = "UTF-8"
|
|
5746
|
-
|
|
5760
|
+
curcompression = "none"
|
|
5761
|
+
if ftype == 0:
|
|
5747
5762
|
fcontents.write(zipfp.read(member.filename))
|
|
5763
|
+
typechecktest = CheckCompressionType(fcontents, closefp=False)
|
|
5764
|
+
fcontents.seek(0, 0)
|
|
5748
5765
|
fcencoding = GetFileEncoding(fcontents, False)
|
|
5749
|
-
if(not compresswholefile):
|
|
5766
|
+
if(typechecktest is False and not compresswholefile):
|
|
5750
5767
|
fcontents.seek(0, 2)
|
|
5751
5768
|
ucfsize = fcontents.tell()
|
|
5752
5769
|
fcontents.seek(0, 0)
|
|
@@ -5761,7 +5778,7 @@ def PackCatFileFromZipFile(infile, outfile, fmttype="auto", compression="auto",
|
|
|
5761
5778
|
fcontents.seek(0, 0)
|
|
5762
5779
|
cfcontents.seek(0, 0)
|
|
5763
5780
|
cfcontents = CompressOpenFileAlt(
|
|
5764
|
-
cfcontents, compressionuselist[ilmin], compressionlevel, formatspecs)
|
|
5781
|
+
cfcontents, compressionuselist[ilmin], compressionlevel, compressionuselist, formatspecs)
|
|
5765
5782
|
cfcontents.seek(0, 2)
|
|
5766
5783
|
ilcsize.append(cfcontents.tell())
|
|
5767
5784
|
cfcontents.close()
|
|
@@ -5773,7 +5790,7 @@ def PackCatFileFromZipFile(infile, outfile, fmttype="auto", compression="auto",
|
|
|
5773
5790
|
shutil.copyfileobj(fcontents, cfcontents)
|
|
5774
5791
|
cfcontents.seek(0, 0)
|
|
5775
5792
|
cfcontents = CompressOpenFileAlt(
|
|
5776
|
-
cfcontents, curcompression, compressionlevel, formatspecs)
|
|
5793
|
+
cfcontents, curcompression, compressionlevel, compressionuselist, formatspecs)
|
|
5777
5794
|
cfcontents.seek(0, 2)
|
|
5778
5795
|
cfsize = cfcontents.tell()
|
|
5779
5796
|
if(ucfsize > cfsize):
|
|
@@ -5798,7 +5815,7 @@ def PackCatFileFromZipFile(infile, outfile, fmttype="auto", compression="auto",
|
|
|
5798
5815
|
return False
|
|
5799
5816
|
if(outfile == "-" or outfile is None or hasattr(outfile, "read") or hasattr(outfile, "write")):
|
|
5800
5817
|
fp = CompressOpenFileAlt(
|
|
5801
|
-
fp, compression, compressionlevel, formatspecs)
|
|
5818
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
5802
5819
|
try:
|
|
5803
5820
|
fp.flush()
|
|
5804
5821
|
if(hasattr(os, "sync")):
|
|
@@ -5822,7 +5839,7 @@ def PackCatFileFromZipFile(infile, outfile, fmttype="auto", compression="auto",
|
|
|
5822
5839
|
return outvar
|
|
5823
5840
|
elif((not hasattr(outfile, "read") and not hasattr(outfile, "write")) and re.findall("^(ftp|ftps|sftp):\\/\\/", outfile)):
|
|
5824
5841
|
fp = CompressOpenFileAlt(
|
|
5825
|
-
fp, compression, compressionlevel, formatspecs)
|
|
5842
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
5826
5843
|
fp.seek(0, 0)
|
|
5827
5844
|
upload_file_to_internet_file(fp, outfile)
|
|
5828
5845
|
if(returnfp):
|
|
@@ -5861,7 +5878,7 @@ if(rarfile_support):
|
|
|
5861
5878
|
outfile = RemoveWindowsPath(outfile)
|
|
5862
5879
|
if(not compression or compression == formatspecs['format_magic']):
|
|
5863
5880
|
compression = "auto"
|
|
5864
|
-
if(compression not in
|
|
5881
|
+
if(compression not in compressionuselist and compression is None):
|
|
5865
5882
|
compression = "auto"
|
|
5866
5883
|
if(verbose):
|
|
5867
5884
|
logging.basicConfig(format="%(message)s", stream=sys.stdout, level=logging.DEBUG)
|
|
@@ -6057,10 +6074,13 @@ if(rarfile_support):
|
|
|
6057
6074
|
fgname = ""
|
|
6058
6075
|
fcontents = BytesIO()
|
|
6059
6076
|
fcencoding = "UTF-8"
|
|
6060
|
-
|
|
6077
|
+
curcompression = "none"
|
|
6078
|
+
if ftype == 0:
|
|
6061
6079
|
fcontents.write(rarfp.read(member.filename))
|
|
6080
|
+
typechecktest = CheckCompressionType(fcontents, closefp=False)
|
|
6081
|
+
fcontents.seek(0, 0)
|
|
6062
6082
|
fcencoding = GetFileEncoding(fcontents, False)
|
|
6063
|
-
if(not compresswholefile):
|
|
6083
|
+
if(typechecktest is False and not compresswholefile):
|
|
6064
6084
|
fcontents.seek(0, 2)
|
|
6065
6085
|
ucfsize = fcontents.tell()
|
|
6066
6086
|
fcontents.seek(0, 0)
|
|
@@ -6075,16 +6095,13 @@ if(rarfile_support):
|
|
|
6075
6095
|
fcontents.seek(0, 0)
|
|
6076
6096
|
cfcontents.seek(0, 0)
|
|
6077
6097
|
cfcontents = CompressOpenFileAlt(
|
|
6078
|
-
cfcontents, compressionuselist[ilmin], compressionlevel, formatspecs)
|
|
6098
|
+
cfcontents, compressionuselist[ilmin], compressionlevel, compressionuselist, formatspecs)
|
|
6079
6099
|
if(cfcontents):
|
|
6080
6100
|
cfcontents.seek(0, 2)
|
|
6081
6101
|
ilcsize.append(cfcontents.tell())
|
|
6082
6102
|
cfcontents.close()
|
|
6083
6103
|
else:
|
|
6084
|
-
|
|
6085
|
-
ilcsize.append(sys.maxint)
|
|
6086
|
-
except AttributeError:
|
|
6087
|
-
ilcsize.append(sys.maxsize)
|
|
6104
|
+
ilcsize.append(float("inf"))
|
|
6088
6105
|
ilmin = ilmin + 1
|
|
6089
6106
|
ilcmin = ilcsize.index(min(ilcsize))
|
|
6090
6107
|
curcompression = compressionuselist[ilcmin]
|
|
@@ -6093,12 +6110,12 @@ if(rarfile_support):
|
|
|
6093
6110
|
shutil.copyfileobj(fcontents, cfcontents)
|
|
6094
6111
|
cfcontents.seek(0, 0)
|
|
6095
6112
|
cfcontents = CompressOpenFileAlt(
|
|
6096
|
-
cfcontents, curcompression, compressionlevel, formatspecs)
|
|
6113
|
+
cfcontents, curcompression, compressionlevel, compressionuselist, formatspecs)
|
|
6097
6114
|
cfcontents.seek(0, 2)
|
|
6098
6115
|
cfsize = cfcontents.tell()
|
|
6099
6116
|
if(ucfsize > cfsize):
|
|
6100
6117
|
fcsize = format(int(cfsize), 'x').lower()
|
|
6101
|
-
fcompression =
|
|
6118
|
+
fcompression = curcompression
|
|
6102
6119
|
fcontents.close()
|
|
6103
6120
|
fcontents = cfcontents
|
|
6104
6121
|
if(fcompression == "none"):
|
|
@@ -6118,7 +6135,7 @@ if(rarfile_support):
|
|
|
6118
6135
|
return False
|
|
6119
6136
|
if(outfile == "-" or outfile is None or hasattr(outfile, "read") or hasattr(outfile, "write")):
|
|
6120
6137
|
fp = CompressOpenFileAlt(
|
|
6121
|
-
fp, compression, compressionlevel, formatspecs)
|
|
6138
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
6122
6139
|
try:
|
|
6123
6140
|
fp.flush()
|
|
6124
6141
|
if(hasattr(os, "sync")):
|
|
@@ -6142,7 +6159,7 @@ if(rarfile_support):
|
|
|
6142
6159
|
return outvar
|
|
6143
6160
|
elif((not hasattr(outfile, "read") and not hasattr(outfile, "write")) and re.findall("^(ftp|ftps|sftp):\\/\\/", outfile)):
|
|
6144
6161
|
fp = CompressOpenFileAlt(
|
|
6145
|
-
fp, compression, compressionlevel, formatspecs)
|
|
6162
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
6146
6163
|
fp.seek(0, 0)
|
|
6147
6164
|
upload_file_to_internet_file(fp, outfile)
|
|
6148
6165
|
if(returnfp):
|
|
@@ -6181,7 +6198,7 @@ if(py7zr_support):
|
|
|
6181
6198
|
outfile = RemoveWindowsPath(outfile)
|
|
6182
6199
|
if(not compression or compression == formatspecs['format_magic']):
|
|
6183
6200
|
compression = "auto"
|
|
6184
|
-
if(compression not in
|
|
6201
|
+
if(compression not in compressionuselist and compression is None):
|
|
6185
6202
|
compression = "auto"
|
|
6186
6203
|
if(verbose):
|
|
6187
6204
|
logging.basicConfig(format="%(message)s", stream=sys.stdout, level=logging.DEBUG)
|
|
@@ -6308,12 +6325,16 @@ if(py7zr_support):
|
|
|
6308
6325
|
fgname = ""
|
|
6309
6326
|
fcontents = BytesIO()
|
|
6310
6327
|
fcencoding = "UTF-8"
|
|
6311
|
-
|
|
6328
|
+
curcompression = "none"
|
|
6329
|
+
if ftype == 0:
|
|
6312
6330
|
fcontents.write(file_content[member.filename].read())
|
|
6313
|
-
fcencoding = GetFileEncoding(fcontents, False)
|
|
6314
6331
|
fsize = format(fcontents.tell(), 'x').lower()
|
|
6332
|
+
fcontents.seek(0, 0)
|
|
6333
|
+
typechecktest = CheckCompressionType(fcontents, closefp=False)
|
|
6334
|
+
fcontents.seek(0, 0)
|
|
6335
|
+
fcencoding = GetFileEncoding(fcontents, False)
|
|
6315
6336
|
file_content[member.filename].close()
|
|
6316
|
-
if(not compresswholefile):
|
|
6337
|
+
if(typechecktest is False and not compresswholefile):
|
|
6317
6338
|
fcontents.seek(0, 2)
|
|
6318
6339
|
ucfsize = fcontents.tell()
|
|
6319
6340
|
fcontents.seek(0, 0)
|
|
@@ -6328,16 +6349,13 @@ if(py7zr_support):
|
|
|
6328
6349
|
fcontents.seek(0, 0)
|
|
6329
6350
|
cfcontents.seek(0, 0)
|
|
6330
6351
|
cfcontents = CompressOpenFileAlt(
|
|
6331
|
-
cfcontents, compressionuselist[ilmin], compressionlevel, formatspecs)
|
|
6352
|
+
cfcontents, compressionuselist[ilmin], compressionlevel, compressionuselist, formatspecs)
|
|
6332
6353
|
if(cfcontents):
|
|
6333
6354
|
cfcontents.seek(0, 2)
|
|
6334
6355
|
ilcsize.append(cfcontents.tell())
|
|
6335
6356
|
cfcontents.close()
|
|
6336
6357
|
else:
|
|
6337
|
-
|
|
6338
|
-
ilcsize.append(sys.maxint)
|
|
6339
|
-
except AttributeError:
|
|
6340
|
-
ilcsize.append(sys.maxsize)
|
|
6358
|
+
ilcsize.append(float("inf"))
|
|
6341
6359
|
ilmin = ilmin + 1
|
|
6342
6360
|
ilcmin = ilcsize.index(min(ilcsize))
|
|
6343
6361
|
curcompression = compressionuselist[ilcmin]
|
|
@@ -6346,7 +6364,7 @@ if(py7zr_support):
|
|
|
6346
6364
|
shutil.copyfileobj(fcontents, cfcontents)
|
|
6347
6365
|
cfcontents.seek(0, 0)
|
|
6348
6366
|
cfcontents = CompressOpenFileAlt(
|
|
6349
|
-
cfcontents, curcompression, compressionlevel, formatspecs)
|
|
6367
|
+
cfcontents, curcompression, compressionlevel, compressionuselist, formatspecs)
|
|
6350
6368
|
cfcontents.seek(0, 2)
|
|
6351
6369
|
cfsize = cfcontents.tell()
|
|
6352
6370
|
if(ucfsize > cfsize):
|
|
@@ -6371,7 +6389,7 @@ if(py7zr_support):
|
|
|
6371
6389
|
return False
|
|
6372
6390
|
if(outfile == "-" or outfile is None or hasattr(outfile, "read") or hasattr(outfile, "write")):
|
|
6373
6391
|
fp = CompressOpenFileAlt(
|
|
6374
|
-
fp, compression, compressionlevel, formatspecs)
|
|
6392
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
6375
6393
|
try:
|
|
6376
6394
|
fp.flush()
|
|
6377
6395
|
if(hasattr(os, "sync")):
|
|
@@ -6395,7 +6413,7 @@ if(py7zr_support):
|
|
|
6395
6413
|
return outvar
|
|
6396
6414
|
elif((not hasattr(outfile, "read") and not hasattr(outfile, "write")) and re.findall("^(ftp|ftps|sftp):\\/\\/", outfile)):
|
|
6397
6415
|
fp = CompressOpenFileAlt(
|
|
6398
|
-
fp, compression, compressionlevel, formatspecs)
|
|
6416
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
6399
6417
|
fp.seek(0, 0)
|
|
6400
6418
|
upload_file_to_internet_file(fp, outfile)
|
|
6401
6419
|
if(returnfp):
|
|
@@ -7592,11 +7610,11 @@ def CatFileToArray(infile, fmttype="auto", seekstart=0, seekend=0, listonly=Fals
|
|
|
7592
7610
|
if(fcompresstype==formatspecs['format_magic']):
|
|
7593
7611
|
fcompresstype = ""
|
|
7594
7612
|
outlist = {'fnumfiles': fnumfiles, 'fformat': formversions[0], 'fcompression': fcompresstype, 'fencoding': fhencoding, 'fversion': formversions[1], 'fostype': fostype, 'fheadersize': fheadsize, 'fsize': CatSizeEnd, 'fnumfields': fnumfields + 2, 'fformatspecs': formatspecs, 'fchecksumtype': fprechecksumtype, 'fheaderchecksum': fprechecksum, 'frawheader': [formstring] + inheader, 'fextrafields': fnumextrafields, 'fextrafieldsize': fnumextrafieldsize, 'fextradata': fextrafieldslist, 'ffilelist': []}
|
|
7595
|
-
if(seekstart < 0
|
|
7613
|
+
if (seekstart < 0) or (seekstart > fnumfiles):
|
|
7596
7614
|
seekstart = 0
|
|
7597
|
-
if(seekend == 0 or seekend > fnumfiles
|
|
7615
|
+
if (seekend == 0) or (seekend > fnumfiles) or (seekend < seekstart):
|
|
7598
7616
|
seekend = fnumfiles
|
|
7599
|
-
elif(seekend < 0 and abs(seekend) <= fnumfiles and abs(seekend) >= seekstart):
|
|
7617
|
+
elif (seekend < 0) and (abs(seekend) <= fnumfiles) and (abs(seekend) >= seekstart):
|
|
7600
7618
|
seekend = fnumfiles - abs(seekend)
|
|
7601
7619
|
if(seekstart > 0):
|
|
7602
7620
|
il = 0
|
|
@@ -7887,7 +7905,7 @@ def MultipleCatFileToArray(infile, fmttype="auto", seekstart=0, seekend=0, listo
|
|
|
7887
7905
|
infile = [infile]
|
|
7888
7906
|
outretval = {}
|
|
7889
7907
|
for curfname in infile:
|
|
7890
|
-
curretfile =
|
|
7908
|
+
curretfile[curfname] = ArchiveFileToArray(curfname, fmttype, seekstart, seekend, listonly, contentasfile, uncompress, skipchecksum, formatspecs, seektoend, returnfp)
|
|
7891
7909
|
return outretval
|
|
7892
7910
|
|
|
7893
7911
|
def MultipleCatFilesToArray(infile, fmttype="auto", seekstart=0, seekend=0, listonly=False, contentasfile=True, uncompress=True, skipchecksum=False, formatspecs=__file_format_multi_dict__, seektoend=False, returnfp=False):
|
|
@@ -8071,7 +8089,7 @@ def RePackCatFile(infile, outfile, fmttype="auto", compression="auto", compressw
|
|
|
8071
8089
|
outfile = RemoveWindowsPath(outfile)
|
|
8072
8090
|
if(not compression or compression == formatspecs['format_magic']):
|
|
8073
8091
|
compression = "auto"
|
|
8074
|
-
if(compression not in
|
|
8092
|
+
if(compression not in compressionuselist and compression is None):
|
|
8075
8093
|
compression = "auto"
|
|
8076
8094
|
if(verbose):
|
|
8077
8095
|
logging.basicConfig(format="%(message)s", stream=sys.stdout, level=logging.DEBUG)
|
|
@@ -8178,10 +8196,13 @@ def RePackCatFile(infile, outfile, fmttype="auto", compression="auto", compressw
|
|
|
8178
8196
|
fcontents = listarchivefiles['ffilelist'][reallcfi]['fcontents']
|
|
8179
8197
|
if(not listarchivefiles['ffilelist'][reallcfi]['fcontentasfile']):
|
|
8180
8198
|
fcontents = BytesIO(fcontents)
|
|
8199
|
+
typechecktest = CheckCompressionType(fcontents, closefp=False)
|
|
8200
|
+
fcontents.seek(0, 0)
|
|
8181
8201
|
fcencoding = GetFileEncoding(fcontents, False)
|
|
8182
8202
|
fcompression = ""
|
|
8183
8203
|
fcsize = format(int(0), 'x').lower()
|
|
8184
|
-
|
|
8204
|
+
curcompression = "none"
|
|
8205
|
+
if typechecktest is False and not compresswholefile:
|
|
8185
8206
|
fcontents.seek(0, 2)
|
|
8186
8207
|
ucfsize = fcontents.tell()
|
|
8187
8208
|
fcontents.seek(0, 0)
|
|
@@ -8196,16 +8217,13 @@ def RePackCatFile(infile, outfile, fmttype="auto", compression="auto", compressw
|
|
|
8196
8217
|
fcontents.seek(0, 0)
|
|
8197
8218
|
cfcontents.seek(0, 0)
|
|
8198
8219
|
cfcontents = CompressOpenFileAlt(
|
|
8199
|
-
cfcontents, compressionuselist[ilmin], compressionlevel, formatspecs)
|
|
8220
|
+
cfcontents, compressionuselist[ilmin], compressionlevel, compressionuselist, formatspecs)
|
|
8200
8221
|
if(cfcontents):
|
|
8201
8222
|
cfcontents.seek(0, 2)
|
|
8202
8223
|
ilcsize.append(cfcontents.tell())
|
|
8203
8224
|
cfcontents.close()
|
|
8204
8225
|
else:
|
|
8205
|
-
|
|
8206
|
-
ilcsize.append(sys.maxint)
|
|
8207
|
-
except AttributeError:
|
|
8208
|
-
ilcsize.append(sys.maxsize)
|
|
8226
|
+
ilcsize.append(float("inf"))
|
|
8209
8227
|
ilmin = ilmin + 1
|
|
8210
8228
|
ilcmin = ilcsize.index(min(ilcsize))
|
|
8211
8229
|
curcompression = compressionuselist[ilcmin]
|
|
@@ -8214,7 +8232,7 @@ def RePackCatFile(infile, outfile, fmttype="auto", compression="auto", compressw
|
|
|
8214
8232
|
shutil.copyfileobj(fcontents, cfcontents)
|
|
8215
8233
|
cfcontents.seek(0, 0)
|
|
8216
8234
|
cfcontents = CompressOpenFileAlt(
|
|
8217
|
-
cfcontents, curcompression, compressionlevel, formatspecs)
|
|
8235
|
+
cfcontents, curcompression, compressionlevel, compressionuselist, formatspecs)
|
|
8218
8236
|
cfcontents.seek(0, 2)
|
|
8219
8237
|
cfsize = cfcontents.tell()
|
|
8220
8238
|
if(ucfsize > cfsize):
|
|
@@ -8222,7 +8240,7 @@ def RePackCatFile(infile, outfile, fmttype="auto", compression="auto", compressw
|
|
|
8222
8240
|
fcompression = curcompression
|
|
8223
8241
|
fcontents.close()
|
|
8224
8242
|
fcontents = cfcontents
|
|
8225
|
-
if
|
|
8243
|
+
if followlink:
|
|
8226
8244
|
if(listarchivefiles['ffilelist'][reallcfi]['ftype'] == 1 or listarchivefiles['ffilelist'][reallcfi]['ftype'] == 2):
|
|
8227
8245
|
getflinkpath = listarchivefiles['ffilelist'][reallcfi]['flinkname']
|
|
8228
8246
|
flinkid = prelistarchivefiles['filetoid'][getflinkpath]
|
|
@@ -8294,7 +8312,7 @@ def RePackCatFile(infile, outfile, fmttype="auto", compression="auto", compressw
|
|
|
8294
8312
|
return False
|
|
8295
8313
|
if(outfile == "-" or outfile is None or hasattr(outfile, "read") or hasattr(outfile, "write")):
|
|
8296
8314
|
fp = CompressOpenFileAlt(
|
|
8297
|
-
fp, compression, compressionlevel, formatspecs)
|
|
8315
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
8298
8316
|
try:
|
|
8299
8317
|
fp.flush()
|
|
8300
8318
|
if(hasattr(os, "sync")):
|
|
@@ -8318,7 +8336,7 @@ def RePackCatFile(infile, outfile, fmttype="auto", compression="auto", compressw
|
|
|
8318
8336
|
return outvar
|
|
8319
8337
|
elif((not hasattr(outfile, "read") and not hasattr(outfile, "write")) and re.findall("^(ftp|ftps|sftp):\\/\\/", outfile)):
|
|
8320
8338
|
fp = CompressOpenFileAlt(
|
|
8321
|
-
fp, compression, compressionlevel, formatspecs)
|
|
8339
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
8322
8340
|
fp.seek(0, 0)
|
|
8323
8341
|
upload_file_to_internet_file(fp, outfile)
|
|
8324
8342
|
if(returnfp):
|
|
@@ -8631,7 +8649,7 @@ def CatFileListFiles(infile, fmttype="auto", seekstart=0, seekend=0, skipchecksu
|
|
|
8631
8649
|
else:
|
|
8632
8650
|
if(infile != "-" and not hasattr(infile, "read") and not hasattr(infile, "write") and not (sys.version_info[0] >= 3 and isinstance(infile, bytes))):
|
|
8633
8651
|
infile = RemoveWindowsPath(infile)
|
|
8634
|
-
listarchivefiles =
|
|
8652
|
+
listarchivefiles = CatFileToArray(infile, fmttype, seekstart, seekend, True, False, False, skipchecksum, formatspecs, seektoend, returnfp)
|
|
8635
8653
|
if(not listarchivefiles):
|
|
8636
8654
|
return False
|
|
8637
8655
|
lenlist = len(listarchivefiles['ffilelist'])
|
|
@@ -8727,7 +8745,7 @@ def TarFileListFiles(infile, verbose=False, returnfp=False):
|
|
|
8727
8745
|
if 'zstandard' in sys.modules:
|
|
8728
8746
|
infile = ZstdFile(fileobj=infile, mode="rb")
|
|
8729
8747
|
elif 'pyzstd' in sys.modules:
|
|
8730
|
-
|
|
8748
|
+
infile = pyzstd.zstdfile.ZstdFile(fileobj=infile, mode="rb")
|
|
8731
8749
|
tarfp = tarfile.open(fileobj=infile, mode="r")
|
|
8732
8750
|
else:
|
|
8733
8751
|
tarfp = tarfile.open(fileobj=infile, mode="r")
|
|
@@ -8739,7 +8757,7 @@ def TarFileListFiles(infile, verbose=False, returnfp=False):
|
|
|
8739
8757
|
if 'zstandard' in sys.modules:
|
|
8740
8758
|
infile = ZstdFile(fileobj=infile, mode="rb")
|
|
8741
8759
|
elif 'pyzstd' in sys.modules:
|
|
8742
|
-
|
|
8760
|
+
infile = pyzstd.zstdfile.ZstdFile(fileobj=infile, mode="rb")
|
|
8743
8761
|
tarfp = tarfile.open(fileobj=infile, mode="r")
|
|
8744
8762
|
else:
|
|
8745
8763
|
tarfp = tarfile.open(infile, "r")
|
|
@@ -9219,37 +9237,37 @@ def ListDirListFiles(infiles, dirlistfromtxt=False, compression="auto", compress
|
|
|
9219
9237
|
PyNeoFile compatibility layer
|
|
9220
9238
|
"""
|
|
9221
9239
|
|
|
9222
|
-
def make_empty_file_pointer_neo(fp, fmttype=None, checksumtype='crc32', formatspecs=
|
|
9240
|
+
def make_empty_file_pointer_neo(fp, fmttype=None, checksumtype='crc32', formatspecs=__file_format_multi_dict__, encoding='UTF-8'):
|
|
9223
9241
|
return MakeEmptyFilePointer(fp, fmttype, checksumtype, formatspecs)
|
|
9224
9242
|
|
|
9225
|
-
def make_empty_archive_file_pointer_neo(fp, fmttype=None, checksumtype='crc32', formatspecs=
|
|
9243
|
+
def make_empty_archive_file_pointer_neo(fp, fmttype=None, checksumtype='crc32', formatspecs=__file_format_multi_dict__, encoding='UTF-8'):
|
|
9226
9244
|
return make_empty_file_pointer_neo(fp, fmttype, checksumtype, formatspecs, encoding)
|
|
9227
9245
|
|
|
9228
|
-
def make_empty_file_neo(outfile=None, fmttype=None, checksumtype='crc32', formatspecs=
|
|
9246
|
+
def make_empty_file_neo(outfile=None, fmttype=None, checksumtype='crc32', formatspecs=__file_format_multi_dict__, encoding='UTF-8', returnfp=False):
|
|
9229
9247
|
return MakeEmptyFile(outfile, fmttype, "auto", False, None, checksumtype, formatspecs, returnfp)
|
|
9230
9248
|
|
|
9231
|
-
def make_empty_archive_file_neo(outfile=None, fmttype=None, checksumtype='crc32', formatspecs=
|
|
9249
|
+
def make_empty_archive_file_neo(outfile=None, fmttype=None, checksumtype='crc32', formatspecs=__file_format_multi_dict__, encoding='UTF-8', returnfp=False):
|
|
9232
9250
|
return make_empty_file_neo(outfile, fmttype, checksumtype, formatspecs, encoding, returnfp)
|
|
9233
9251
|
|
|
9234
|
-
def pack_neo(infiles, outfile=None, formatspecs=
|
|
9252
|
+
def pack_neo(infiles, outfile=None, formatspecs=__file_format_multi_dict__, checksumtypes=["crc32", "crc32", "crc32", "crc32"], encoding="UTF-8", compression="auto", compression_level=None, returnfp=False):
|
|
9235
9253
|
return PackCatFile(infiles, outfile, False, "auto", compression, False, compression_level, compressionlistalt, False, checksumtypes, [], {}, formatspecs, False, returnfp)
|
|
9236
9254
|
|
|
9237
|
-
def archive_to_array_neo(infile, formatspecs=
|
|
9255
|
+
def archive_to_array_neo(infile, formatspecs=__file_format_multi_dict__, listonly=False, skipchecksum=False, uncompress=True, returnfp=False):
|
|
9238
9256
|
return CatFileToArray(infile, "auto", 0, 0, listonly, True, uncompress, skipchecksum, formatspecs, False, returnfp)
|
|
9239
9257
|
|
|
9240
|
-
def unpack_neo(infile, outdir='.', formatspecs=
|
|
9258
|
+
def unpack_neo(infile, outdir='.', formatspecs=__file_format_multi_dict__, skipchecksum=False, uncompress=True, returnfp=False):
|
|
9241
9259
|
return UnPackCatFile(infile, outdir, False, 0, 0, skipchecksum, formatspecs, True, True, False, False, returnfp)
|
|
9242
9260
|
|
|
9243
|
-
def repack_neo(infile, outfile=None, formatspecs=
|
|
9261
|
+
def repack_neo(infile, outfile=None, formatspecs=__file_format_dict__, checksumtypes=["crc32", "crc32", "crc32", "crc32"], compression="auto", compression_level=None, returnfp=False):
|
|
9244
9262
|
return RePackCatFile(infile, outfile, "auto", compression, False, compression_level, compressionlistalt, False, 0, 0, checksumtypes, False, [], {}, formatspecs, False, False, returnfp)
|
|
9245
9263
|
|
|
9246
|
-
def archivefilevalidate_neo(infile, formatspecs=
|
|
9264
|
+
def archivefilevalidate_neo(infile, formatspecs=__file_format_multi_dict__, verbose=False, return_details=False, returnfp=False):
|
|
9247
9265
|
return CatFileValidate(infile, "auto", formatspecs, False, verbose, returnfp)
|
|
9248
9266
|
|
|
9249
|
-
def archivefilelistfiles_neo(infile, formatspecs=
|
|
9267
|
+
def archivefilelistfiles_neo(infile, formatspecs=__file_format_multi_dict__, advanced=False, include_dirs=True, returnfp=False):
|
|
9250
9268
|
return CatFileListFiles(infile, "auto", 0, 0, False, formatspecs, False, True, advanced, returnfp)
|
|
9251
9269
|
|
|
9252
|
-
def convert_foreign_to_neo(infile, outfile=None, formatspecs=
|
|
9270
|
+
def convert_foreign_to_neo(infile, outfile=None, formatspecs=__file_format_multi_dict__, checksumtypes=["crc32", "crc32", "crc32", "crc32"], compression="auto", compression_level=None, returnfp=False):
|
|
9253
9271
|
intmp = InFileToArray(infile, 0, 0, False, True, False, formatspecs, False, False)
|
|
9254
9272
|
return RePackCatFile(intmp, outfile, "auto", compression, False, compression_level, compressionlistalt, False, 0, 0, checksumtypes, False, [], {}, formatspecs, False, False, returnfp)
|
|
9255
9273
|
|
|
@@ -9773,9 +9791,9 @@ def upload_file_to_internet_file(ifp, url):
|
|
|
9773
9791
|
return False
|
|
9774
9792
|
|
|
9775
9793
|
|
|
9776
|
-
def upload_file_to_internet_compress_file(ifp, url, compression="auto", compressionlevel=None, formatspecs=__file_format_dict__):
|
|
9794
|
+
def upload_file_to_internet_compress_file(ifp, url, compression="auto", compressionlevel=None, compressionuselist=compressionlistalt, formatspecs=__file_format_dict__):
|
|
9777
9795
|
fp = CompressOpenFileAlt(
|
|
9778
|
-
fp, compression, compressionlevel, formatspecs)
|
|
9796
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
9779
9797
|
if(not archivefileout):
|
|
9780
9798
|
return False
|
|
9781
9799
|
fp.seek(0, 0)
|
|
@@ -9799,9 +9817,9 @@ def upload_file_to_internet_string(ifp, url):
|
|
|
9799
9817
|
return False
|
|
9800
9818
|
|
|
9801
9819
|
|
|
9802
|
-
def upload_file_to_internet_compress_string(ifp, url, compression="auto", compressionlevel=None, formatspecs=__file_format_dict__):
|
|
9820
|
+
def upload_file_to_internet_compress_string(ifp, url, compression="auto", compressionlevel=None, compressionuselist=compressionlistalt, formatspecs=__file_format_dict__):
|
|
9803
9821
|
fp = CompressOpenFileAlt(
|
|
9804
|
-
BytesIO(ifp), compression, compressionlevel, formatspecs)
|
|
9822
|
+
BytesIO(ifp), compression, compressionlevel, compressionuselist, formatspecs)
|
|
9805
9823
|
if(not archivefileout):
|
|
9806
9824
|
return False
|
|
9807
9825
|
fp.seek(0, 0)
|