PyCatFile 0.21.0__tar.gz → 0.21.2__tar.gz
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.21.0 → pycatfile-0.21.2}/PKG-INFO +1 -1
- {pycatfile-0.21.0 → pycatfile-0.21.2}/PyCatFile.egg-info/PKG-INFO +1 -1
- {pycatfile-0.21.0 → pycatfile-0.21.2}/catfile.py +6 -6
- {pycatfile-0.21.0 → pycatfile-0.21.2}/pycatfile.py +129 -114
- {pycatfile-0.21.0 → pycatfile-0.21.2}/pyproject.toml +1 -1
- {pycatfile-0.21.0 → pycatfile-0.21.2}/setup.py +1 -1
- {pycatfile-0.21.0 → pycatfile-0.21.2}/LICENSE +0 -0
- {pycatfile-0.21.0 → pycatfile-0.21.2}/PyCatFile.egg-info/SOURCES.txt +0 -0
- {pycatfile-0.21.0 → pycatfile-0.21.2}/PyCatFile.egg-info/dependency_links.txt +0 -0
- {pycatfile-0.21.0 → pycatfile-0.21.2}/PyCatFile.egg-info/top_level.txt +0 -0
- {pycatfile-0.21.0 → pycatfile-0.21.2}/PyCatFile.egg-info/zip-safe +0 -0
- {pycatfile-0.21.0 → pycatfile-0.21.2}/README.md +0 -0
- {pycatfile-0.21.0 → pycatfile-0.21.2}/catneofile.py +0 -0
- {pycatfile-0.21.0 → pycatfile-0.21.2}/neocatfile.py +0 -0
- {pycatfile-0.21.0 → pycatfile-0.21.2}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: PyCatFile
|
|
3
|
-
Version: 0.21.
|
|
3
|
+
Version: 0.21.2
|
|
4
4
|
Summary: A tar like file format name catfile after unix cat command (concatenate files) .
|
|
5
5
|
Home-page: https://github.com/GameMaker2k/PyCatFile
|
|
6
6
|
Download-URL: https://github.com/GameMaker2k/PyCatFile/archive/master.tar.gz
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: PyCatFile
|
|
3
|
-
Version: 0.21.
|
|
3
|
+
Version: 0.21.2
|
|
4
4
|
Summary: A tar like file format name catfile after unix cat command (concatenate files) .
|
|
5
5
|
Home-page: https://github.com/GameMaker2k/PyCatFile
|
|
6
6
|
Download-URL: https://github.com/GameMaker2k/PyCatFile/archive/master.tar.gz
|
|
@@ -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: catfile.py - Last Update: 8/
|
|
17
|
+
$FileInfo: catfile.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
|
|
@@ -172,7 +172,7 @@ if active_action:
|
|
|
172
172
|
if getargs.convert:
|
|
173
173
|
checkcompressfile = pycatfile.CheckCompressionSubType(
|
|
174
174
|
input_file, fnamedict, True)
|
|
175
|
-
if((IsNestedDict(fnamedict) and checkcompressfile in fnamedict) or (IsSingleDict(fnamedict) and checkcompressfile==fnamedict['format_magic'])):
|
|
175
|
+
if((pycatfile.IsNestedDict(fnamedict) and checkcompressfile in fnamedict) or (pycatfile.IsSingleDict(fnamedict) and checkcompressfile==fnamedict['format_magic'])):
|
|
176
176
|
tmpout = pycatfile.RePackCatFile(input_file, getargs.output, getargs.compression, getargs.wholefile, getargs.level, pycatfile.compressionlistalt, False, 0, 0, [getargs.checksum, getargs.checksum, getargs.checksum, getargs.checksum], getargs.skipchecksum, [], {}, fnamedict, getargs.verbose, False)
|
|
177
177
|
else:
|
|
178
178
|
tmpout = pycatfile.PackCatFileFromInFile(
|
|
@@ -185,7 +185,7 @@ if active_action:
|
|
|
185
185
|
if getargs.convert:
|
|
186
186
|
checkcompressfile = pycatfile.CheckCompressionSubType(
|
|
187
187
|
input_file, fnamedict, True)
|
|
188
|
-
if((IsNestedDict(fnamedict) and checkcompressfile in fnamedict) or (IsSingleDict(fnamedict) and checkcompressfile==fnamedict['format_magic'])):
|
|
188
|
+
if((pycatfile.IsNestedDict(fnamedict) and checkcompressfile in fnamedict) or (pycatfile.IsSingleDict(fnamedict) and checkcompressfile==fnamedict['format_magic'])):
|
|
189
189
|
pycatfile.RePackCatFile(input_file, getargs.output, getargs.compression, getargs.wholefile, getargs.level, pycatfile.compressionlistalt,
|
|
190
190
|
False, 0, 0, [getargs.checksum, getargs.checksum, getargs.checksum, getargs.checksum], getargs.skipchecksum, [], {}, fnamedict, getargs.verbose, False)
|
|
191
191
|
else:
|
|
@@ -200,7 +200,7 @@ if active_action:
|
|
|
200
200
|
checkcompressfile = pycatfile.CheckCompressionSubType(
|
|
201
201
|
input_file, fnamedict, True)
|
|
202
202
|
tempout = BytesIO()
|
|
203
|
-
if((IsNestedDict(fnamedict) and checkcompressfile in fnamedict) or (IsSingleDict(fnamedict) and checkcompressfile==fnamedict['format_magic'])):
|
|
203
|
+
if((pycatfile.IsNestedDict(fnamedict) and checkcompressfile in fnamedict) or (pycatfile.IsSingleDict(fnamedict) and checkcompressfile==fnamedict['format_magic'])):
|
|
204
204
|
tmpout = pycatfile.RePackCatFile(input_file, tempout, getargs.compression, getargs.wholefile, getargs.level, pycatfile.compressionlistalt, False, 0, 0, [getargs.checksum, getargs.checksum, getargs.checksum, getargs.checksum], getargs.skipchecksum, [], {}, fnamedict, False, False)
|
|
205
205
|
else:
|
|
206
206
|
tmpout = pycatfile.PackCatFileFromInFile(
|
|
@@ -214,7 +214,7 @@ if active_action:
|
|
|
214
214
|
if getargs.convert:
|
|
215
215
|
checkcompressfile = pycatfile.CheckCompressionSubType(
|
|
216
216
|
input_file, fnamedict, True)
|
|
217
|
-
if((IsNestedDict(fnamedict) and checkcompressfile in fnamedict) or (IsSingleDict(fnamedict) and checkcompressfile==fnamedict['format_magic'])):
|
|
217
|
+
if((pycatfile.IsNestedDict(fnamedict) and checkcompressfile in fnamedict) or (pycatfile.IsSingleDict(fnamedict) and checkcompressfile==fnamedict['format_magic'])):
|
|
218
218
|
tmpout = pycatfile.CatFileListFiles(input_file, "auto", 0, 0, getargs.skipchecksum, fnamedict, False, getargs.verbose, False, False)
|
|
219
219
|
else:
|
|
220
220
|
tmpout = pycatfile.InFileListFiles(input_file, getargs.verbose, fnamedict, False, False, False)
|
|
@@ -227,7 +227,7 @@ if active_action:
|
|
|
227
227
|
checkcompressfile = pycatfile.CheckCompressionSubType(
|
|
228
228
|
input_file, fnamedict, True)
|
|
229
229
|
tempout = BytesIO()
|
|
230
|
-
if((IsNestedDict(fnamedict) and checkcompressfile in fnamedict) or (IsSingleDict(fnamedict) and checkcompressfile==fnamedict['format_magic'])):
|
|
230
|
+
if((pycatfile.IsNestedDict(fnamedict) and checkcompressfile in fnamedict) or (pycatfile.IsSingleDict(fnamedict) and checkcompressfile==fnamedict['format_magic'])):
|
|
231
231
|
tmpout = pycatfile.RePackCatFile(input_file, tempout, getargs.compression, getargs.wholefile, getargs.level, pycatfile.compressionlistalt, False, 0, 0, [getargs.checksum, getargs.checksum, getargs.checksum, getargs.checksum], getargs.skipchecksum, [], {}, fnamedict, False, False, False)
|
|
232
232
|
else:
|
|
233
233
|
tmpout = pycatfile.PackCatFileFromInFile(
|
|
@@ -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, 21,
|
|
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()
|
|
@@ -3658,7 +3671,7 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, filevalues=[], ext
|
|
|
3658
3671
|
fcontents.seek(0, 0)
|
|
3659
3672
|
cfcontents.seek(0, 0)
|
|
3660
3673
|
cfcontents = CompressOpenFileAlt(
|
|
3661
|
-
cfcontents, compressionuselist[ilmin], compressionlevel, formatspecs)
|
|
3674
|
+
cfcontents, compressionuselist[ilmin], compressionlevel, compressionuselist, formatspecs)
|
|
3662
3675
|
if(cfcontents):
|
|
3663
3676
|
cfcontents.seek(0, 2)
|
|
3664
3677
|
ilcsize.append(cfcontents.tell())
|
|
@@ -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):
|
|
@@ -3705,7 +3718,7 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, filevalues=[], ext
|
|
|
3705
3718
|
fcontents.seek(0, 0)
|
|
3706
3719
|
cfcontents.seek(0, 0)
|
|
3707
3720
|
cfcontents = CompressOpenFileAlt(
|
|
3708
|
-
cfcontents, compressionuselist[ilmin], compressionlevel, formatspecs)
|
|
3721
|
+
cfcontents, compressionuselist[ilmin], compressionlevel, compressionuselist, formatspecs)
|
|
3709
3722
|
if(cfcontents):
|
|
3710
3723
|
cfcontents.seek(0, 2)
|
|
3711
3724
|
ilcsize.append(cfcontents.tell())
|
|
@@ -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()
|
|
@@ -5120,7 +5133,7 @@ def PackCatFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", compress
|
|
|
5120
5133
|
fcontents.seek(0, 0)
|
|
5121
5134
|
cfcontents.seek(0, 0)
|
|
5122
5135
|
cfcontents = CompressOpenFileAlt(
|
|
5123
|
-
cfcontents, compressionuselist[ilmin], compressionlevel, formatspecs)
|
|
5136
|
+
cfcontents, compressionuselist[ilmin], compressionlevel, compressionuselist, formatspecs)
|
|
5124
5137
|
if(cfcontents):
|
|
5125
5138
|
cfcontents.seek(0, 2)
|
|
5126
5139
|
ilcsize.append(cfcontents.tell())
|
|
@@ -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):
|
|
@@ -5167,7 +5180,7 @@ def PackCatFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", compress
|
|
|
5167
5180
|
fcontents.seek(0, 0)
|
|
5168
5181
|
cfcontents.seek(0, 0)
|
|
5169
5182
|
cfcontents = CompressOpenFileAlt(
|
|
5170
|
-
cfcontents, compressionuselist[ilmin], compressionlevel, formatspecs)
|
|
5183
|
+
cfcontents, compressionuselist[ilmin], compressionlevel, compressionuselist, formatspecs)
|
|
5171
5184
|
if(cfcontents):
|
|
5172
5185
|
cfcontents.seek(0, 2)
|
|
5173
5186
|
ilcsize.append(cfcontents.tell())
|
|
@@ -5182,7 +5195,7 @@ def PackCatFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", compress
|
|
|
5182
5195
|
shutil.copyfileobj(fcontents, cfcontents)
|
|
5183
5196
|
cfcontents.seek(0, 0)
|
|
5184
5197
|
cfcontents = CompressOpenFileAlt(
|
|
5185
|
-
cfcontents, curcompression, compressionlevel, formatspecs)
|
|
5198
|
+
cfcontents, curcompression, compressionlevel, compressionuselist, formatspecs)
|
|
5186
5199
|
cfcontents.seek(0, 2)
|
|
5187
5200
|
cfsize = cfcontents.tell()
|
|
5188
5201
|
if(ucfsize > cfsize):
|
|
@@ -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")
|
|
@@ -5448,6 +5461,7 @@ def PackCatFileFromTarFile(infile, outfile, fmttype="auto", compression="auto",
|
|
|
5448
5461
|
curcompression = "none"
|
|
5449
5462
|
if ftype in data_types:
|
|
5450
5463
|
fpc = tarfp.extractfile(member)
|
|
5464
|
+
fpc.close()
|
|
5451
5465
|
shutil.copyfileobj(fpc, fcontents)
|
|
5452
5466
|
typechecktest = CheckCompressionType(fcontents, closefp=False)
|
|
5453
5467
|
fcontents.seek(0, 0)
|
|
@@ -5467,7 +5481,7 @@ def PackCatFileFromTarFile(infile, outfile, fmttype="auto", compression="auto",
|
|
|
5467
5481
|
fcontents.seek(0, 0)
|
|
5468
5482
|
cfcontents.seek(0, 0)
|
|
5469
5483
|
cfcontents = CompressOpenFileAlt(
|
|
5470
|
-
cfcontents, compressionuselist[ilmin], compressionlevel, formatspecs)
|
|
5484
|
+
cfcontents, compressionuselist[ilmin], compressionlevel, compressionuselist, formatspecs)
|
|
5471
5485
|
if(cfcontents):
|
|
5472
5486
|
cfcontents.seek(0, 2)
|
|
5473
5487
|
ilcsize.append(cfcontents.tell())
|
|
@@ -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)
|
|
@@ -5764,7 +5778,7 @@ def PackCatFileFromZipFile(infile, outfile, fmttype="auto", compression="auto",
|
|
|
5764
5778
|
fcontents.seek(0, 0)
|
|
5765
5779
|
cfcontents.seek(0, 0)
|
|
5766
5780
|
cfcontents = CompressOpenFileAlt(
|
|
5767
|
-
cfcontents, compressionuselist[ilmin], compressionlevel, formatspecs)
|
|
5781
|
+
cfcontents, compressionuselist[ilmin], compressionlevel, compressionuselist, formatspecs)
|
|
5768
5782
|
cfcontents.seek(0, 2)
|
|
5769
5783
|
ilcsize.append(cfcontents.tell())
|
|
5770
5784
|
cfcontents.close()
|
|
@@ -5776,7 +5790,7 @@ def PackCatFileFromZipFile(infile, outfile, fmttype="auto", compression="auto",
|
|
|
5776
5790
|
shutil.copyfileobj(fcontents, cfcontents)
|
|
5777
5791
|
cfcontents.seek(0, 0)
|
|
5778
5792
|
cfcontents = CompressOpenFileAlt(
|
|
5779
|
-
cfcontents, curcompression, compressionlevel, formatspecs)
|
|
5793
|
+
cfcontents, curcompression, compressionlevel, compressionuselist, formatspecs)
|
|
5780
5794
|
cfcontents.seek(0, 2)
|
|
5781
5795
|
cfsize = cfcontents.tell()
|
|
5782
5796
|
if(ucfsize > cfsize):
|
|
@@ -5801,7 +5815,7 @@ def PackCatFileFromZipFile(infile, outfile, fmttype="auto", compression="auto",
|
|
|
5801
5815
|
return False
|
|
5802
5816
|
if(outfile == "-" or outfile is None or hasattr(outfile, "read") or hasattr(outfile, "write")):
|
|
5803
5817
|
fp = CompressOpenFileAlt(
|
|
5804
|
-
fp, compression, compressionlevel, formatspecs)
|
|
5818
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
5805
5819
|
try:
|
|
5806
5820
|
fp.flush()
|
|
5807
5821
|
if(hasattr(os, "sync")):
|
|
@@ -5825,7 +5839,7 @@ def PackCatFileFromZipFile(infile, outfile, fmttype="auto", compression="auto",
|
|
|
5825
5839
|
return outvar
|
|
5826
5840
|
elif((not hasattr(outfile, "read") and not hasattr(outfile, "write")) and re.findall("^(ftp|ftps|sftp):\\/\\/", outfile)):
|
|
5827
5841
|
fp = CompressOpenFileAlt(
|
|
5828
|
-
fp, compression, compressionlevel, formatspecs)
|
|
5842
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
5829
5843
|
fp.seek(0, 0)
|
|
5830
5844
|
upload_file_to_internet_file(fp, outfile)
|
|
5831
5845
|
if(returnfp):
|
|
@@ -5864,7 +5878,7 @@ if(rarfile_support):
|
|
|
5864
5878
|
outfile = RemoveWindowsPath(outfile)
|
|
5865
5879
|
if(not compression or compression == formatspecs['format_magic']):
|
|
5866
5880
|
compression = "auto"
|
|
5867
|
-
if(compression not in
|
|
5881
|
+
if(compression not in compressionuselist and compression is None):
|
|
5868
5882
|
compression = "auto"
|
|
5869
5883
|
if(verbose):
|
|
5870
5884
|
logging.basicConfig(format="%(message)s", stream=sys.stdout, level=logging.DEBUG)
|
|
@@ -6081,7 +6095,7 @@ if(rarfile_support):
|
|
|
6081
6095
|
fcontents.seek(0, 0)
|
|
6082
6096
|
cfcontents.seek(0, 0)
|
|
6083
6097
|
cfcontents = CompressOpenFileAlt(
|
|
6084
|
-
cfcontents, compressionuselist[ilmin], compressionlevel, formatspecs)
|
|
6098
|
+
cfcontents, compressionuselist[ilmin], compressionlevel, compressionuselist, formatspecs)
|
|
6085
6099
|
if(cfcontents):
|
|
6086
6100
|
cfcontents.seek(0, 2)
|
|
6087
6101
|
ilcsize.append(cfcontents.tell())
|
|
@@ -6096,12 +6110,12 @@ if(rarfile_support):
|
|
|
6096
6110
|
shutil.copyfileobj(fcontents, cfcontents)
|
|
6097
6111
|
cfcontents.seek(0, 0)
|
|
6098
6112
|
cfcontents = CompressOpenFileAlt(
|
|
6099
|
-
cfcontents, curcompression, compressionlevel, formatspecs)
|
|
6113
|
+
cfcontents, curcompression, compressionlevel, compressionuselist, formatspecs)
|
|
6100
6114
|
cfcontents.seek(0, 2)
|
|
6101
6115
|
cfsize = cfcontents.tell()
|
|
6102
6116
|
if(ucfsize > cfsize):
|
|
6103
6117
|
fcsize = format(int(cfsize), 'x').lower()
|
|
6104
|
-
fcompression =
|
|
6118
|
+
fcompression = curcompression
|
|
6105
6119
|
fcontents.close()
|
|
6106
6120
|
fcontents = cfcontents
|
|
6107
6121
|
if(fcompression == "none"):
|
|
@@ -6121,7 +6135,7 @@ if(rarfile_support):
|
|
|
6121
6135
|
return False
|
|
6122
6136
|
if(outfile == "-" or outfile is None or hasattr(outfile, "read") or hasattr(outfile, "write")):
|
|
6123
6137
|
fp = CompressOpenFileAlt(
|
|
6124
|
-
fp, compression, compressionlevel, formatspecs)
|
|
6138
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
6125
6139
|
try:
|
|
6126
6140
|
fp.flush()
|
|
6127
6141
|
if(hasattr(os, "sync")):
|
|
@@ -6145,7 +6159,7 @@ if(rarfile_support):
|
|
|
6145
6159
|
return outvar
|
|
6146
6160
|
elif((not hasattr(outfile, "read") and not hasattr(outfile, "write")) and re.findall("^(ftp|ftps|sftp):\\/\\/", outfile)):
|
|
6147
6161
|
fp = CompressOpenFileAlt(
|
|
6148
|
-
fp, compression, compressionlevel, formatspecs)
|
|
6162
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
6149
6163
|
fp.seek(0, 0)
|
|
6150
6164
|
upload_file_to_internet_file(fp, outfile)
|
|
6151
6165
|
if(returnfp):
|
|
@@ -6184,7 +6198,7 @@ if(py7zr_support):
|
|
|
6184
6198
|
outfile = RemoveWindowsPath(outfile)
|
|
6185
6199
|
if(not compression or compression == formatspecs['format_magic']):
|
|
6186
6200
|
compression = "auto"
|
|
6187
|
-
if(compression not in
|
|
6201
|
+
if(compression not in compressionuselist and compression is None):
|
|
6188
6202
|
compression = "auto"
|
|
6189
6203
|
if(verbose):
|
|
6190
6204
|
logging.basicConfig(format="%(message)s", stream=sys.stdout, level=logging.DEBUG)
|
|
@@ -6314,10 +6328,11 @@ if(py7zr_support):
|
|
|
6314
6328
|
curcompression = "none"
|
|
6315
6329
|
if ftype == 0:
|
|
6316
6330
|
fcontents.write(file_content[member.filename].read())
|
|
6331
|
+
fsize = format(fcontents.tell(), 'x').lower()
|
|
6332
|
+
fcontents.seek(0, 0)
|
|
6317
6333
|
typechecktest = CheckCompressionType(fcontents, closefp=False)
|
|
6318
6334
|
fcontents.seek(0, 0)
|
|
6319
6335
|
fcencoding = GetFileEncoding(fcontents, False)
|
|
6320
|
-
fsize = format(fcontents.tell(), 'x').lower()
|
|
6321
6336
|
file_content[member.filename].close()
|
|
6322
6337
|
if(typechecktest is False and not compresswholefile):
|
|
6323
6338
|
fcontents.seek(0, 2)
|
|
@@ -6334,7 +6349,7 @@ if(py7zr_support):
|
|
|
6334
6349
|
fcontents.seek(0, 0)
|
|
6335
6350
|
cfcontents.seek(0, 0)
|
|
6336
6351
|
cfcontents = CompressOpenFileAlt(
|
|
6337
|
-
cfcontents, compressionuselist[ilmin], compressionlevel, formatspecs)
|
|
6352
|
+
cfcontents, compressionuselist[ilmin], compressionlevel, compressionuselist, formatspecs)
|
|
6338
6353
|
if(cfcontents):
|
|
6339
6354
|
cfcontents.seek(0, 2)
|
|
6340
6355
|
ilcsize.append(cfcontents.tell())
|
|
@@ -6349,7 +6364,7 @@ if(py7zr_support):
|
|
|
6349
6364
|
shutil.copyfileobj(fcontents, cfcontents)
|
|
6350
6365
|
cfcontents.seek(0, 0)
|
|
6351
6366
|
cfcontents = CompressOpenFileAlt(
|
|
6352
|
-
cfcontents, curcompression, compressionlevel, formatspecs)
|
|
6367
|
+
cfcontents, curcompression, compressionlevel, compressionuselist, formatspecs)
|
|
6353
6368
|
cfcontents.seek(0, 2)
|
|
6354
6369
|
cfsize = cfcontents.tell()
|
|
6355
6370
|
if(ucfsize > cfsize):
|
|
@@ -6374,7 +6389,7 @@ if(py7zr_support):
|
|
|
6374
6389
|
return False
|
|
6375
6390
|
if(outfile == "-" or outfile is None or hasattr(outfile, "read") or hasattr(outfile, "write")):
|
|
6376
6391
|
fp = CompressOpenFileAlt(
|
|
6377
|
-
fp, compression, compressionlevel, formatspecs)
|
|
6392
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
6378
6393
|
try:
|
|
6379
6394
|
fp.flush()
|
|
6380
6395
|
if(hasattr(os, "sync")):
|
|
@@ -6398,7 +6413,7 @@ if(py7zr_support):
|
|
|
6398
6413
|
return outvar
|
|
6399
6414
|
elif((not hasattr(outfile, "read") and not hasattr(outfile, "write")) and re.findall("^(ftp|ftps|sftp):\\/\\/", outfile)):
|
|
6400
6415
|
fp = CompressOpenFileAlt(
|
|
6401
|
-
fp, compression, compressionlevel, formatspecs)
|
|
6416
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
6402
6417
|
fp.seek(0, 0)
|
|
6403
6418
|
upload_file_to_internet_file(fp, outfile)
|
|
6404
6419
|
if(returnfp):
|
|
@@ -7595,11 +7610,11 @@ def CatFileToArray(infile, fmttype="auto", seekstart=0, seekend=0, listonly=Fals
|
|
|
7595
7610
|
if(fcompresstype==formatspecs['format_magic']):
|
|
7596
7611
|
fcompresstype = ""
|
|
7597
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': []}
|
|
7598
|
-
if(seekstart < 0
|
|
7613
|
+
if (seekstart < 0) or (seekstart > fnumfiles):
|
|
7599
7614
|
seekstart = 0
|
|
7600
|
-
if(seekend == 0 or seekend > fnumfiles
|
|
7615
|
+
if (seekend == 0) or (seekend > fnumfiles) or (seekend < seekstart):
|
|
7601
7616
|
seekend = fnumfiles
|
|
7602
|
-
elif(seekend < 0 and abs(seekend) <= fnumfiles and abs(seekend) >= seekstart):
|
|
7617
|
+
elif (seekend < 0) and (abs(seekend) <= fnumfiles) and (abs(seekend) >= seekstart):
|
|
7603
7618
|
seekend = fnumfiles - abs(seekend)
|
|
7604
7619
|
if(seekstart > 0):
|
|
7605
7620
|
il = 0
|
|
@@ -7890,7 +7905,7 @@ def MultipleCatFileToArray(infile, fmttype="auto", seekstart=0, seekend=0, listo
|
|
|
7890
7905
|
infile = [infile]
|
|
7891
7906
|
outretval = {}
|
|
7892
7907
|
for curfname in infile:
|
|
7893
|
-
curretfile =
|
|
7908
|
+
curretfile[curfname] = ArchiveFileToArray(curfname, fmttype, seekstart, seekend, listonly, contentasfile, uncompress, skipchecksum, formatspecs, seektoend, returnfp)
|
|
7894
7909
|
return outretval
|
|
7895
7910
|
|
|
7896
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):
|
|
@@ -8074,7 +8089,7 @@ def RePackCatFile(infile, outfile, fmttype="auto", compression="auto", compressw
|
|
|
8074
8089
|
outfile = RemoveWindowsPath(outfile)
|
|
8075
8090
|
if(not compression or compression == formatspecs['format_magic']):
|
|
8076
8091
|
compression = "auto"
|
|
8077
|
-
if(compression not in
|
|
8092
|
+
if(compression not in compressionuselist and compression is None):
|
|
8078
8093
|
compression = "auto"
|
|
8079
8094
|
if(verbose):
|
|
8080
8095
|
logging.basicConfig(format="%(message)s", stream=sys.stdout, level=logging.DEBUG)
|
|
@@ -8202,7 +8217,7 @@ def RePackCatFile(infile, outfile, fmttype="auto", compression="auto", compressw
|
|
|
8202
8217
|
fcontents.seek(0, 0)
|
|
8203
8218
|
cfcontents.seek(0, 0)
|
|
8204
8219
|
cfcontents = CompressOpenFileAlt(
|
|
8205
|
-
cfcontents, compressionuselist[ilmin], compressionlevel, formatspecs)
|
|
8220
|
+
cfcontents, compressionuselist[ilmin], compressionlevel, compressionuselist, formatspecs)
|
|
8206
8221
|
if(cfcontents):
|
|
8207
8222
|
cfcontents.seek(0, 2)
|
|
8208
8223
|
ilcsize.append(cfcontents.tell())
|
|
@@ -8217,7 +8232,7 @@ def RePackCatFile(infile, outfile, fmttype="auto", compression="auto", compressw
|
|
|
8217
8232
|
shutil.copyfileobj(fcontents, cfcontents)
|
|
8218
8233
|
cfcontents.seek(0, 0)
|
|
8219
8234
|
cfcontents = CompressOpenFileAlt(
|
|
8220
|
-
cfcontents, curcompression, compressionlevel, formatspecs)
|
|
8235
|
+
cfcontents, curcompression, compressionlevel, compressionuselist, formatspecs)
|
|
8221
8236
|
cfcontents.seek(0, 2)
|
|
8222
8237
|
cfsize = cfcontents.tell()
|
|
8223
8238
|
if(ucfsize > cfsize):
|
|
@@ -8297,7 +8312,7 @@ def RePackCatFile(infile, outfile, fmttype="auto", compression="auto", compressw
|
|
|
8297
8312
|
return False
|
|
8298
8313
|
if(outfile == "-" or outfile is None or hasattr(outfile, "read") or hasattr(outfile, "write")):
|
|
8299
8314
|
fp = CompressOpenFileAlt(
|
|
8300
|
-
fp, compression, compressionlevel, formatspecs)
|
|
8315
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
8301
8316
|
try:
|
|
8302
8317
|
fp.flush()
|
|
8303
8318
|
if(hasattr(os, "sync")):
|
|
@@ -8321,7 +8336,7 @@ def RePackCatFile(infile, outfile, fmttype="auto", compression="auto", compressw
|
|
|
8321
8336
|
return outvar
|
|
8322
8337
|
elif((not hasattr(outfile, "read") and not hasattr(outfile, "write")) and re.findall("^(ftp|ftps|sftp):\\/\\/", outfile)):
|
|
8323
8338
|
fp = CompressOpenFileAlt(
|
|
8324
|
-
fp, compression, compressionlevel, formatspecs)
|
|
8339
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
8325
8340
|
fp.seek(0, 0)
|
|
8326
8341
|
upload_file_to_internet_file(fp, outfile)
|
|
8327
8342
|
if(returnfp):
|
|
@@ -8730,7 +8745,7 @@ def TarFileListFiles(infile, verbose=False, returnfp=False):
|
|
|
8730
8745
|
if 'zstandard' in sys.modules:
|
|
8731
8746
|
infile = ZstdFile(fileobj=infile, mode="rb")
|
|
8732
8747
|
elif 'pyzstd' in sys.modules:
|
|
8733
|
-
|
|
8748
|
+
infile = pyzstd.zstdfile.ZstdFile(fileobj=infile, mode="rb")
|
|
8734
8749
|
tarfp = tarfile.open(fileobj=infile, mode="r")
|
|
8735
8750
|
else:
|
|
8736
8751
|
tarfp = tarfile.open(fileobj=infile, mode="r")
|
|
@@ -8742,7 +8757,7 @@ def TarFileListFiles(infile, verbose=False, returnfp=False):
|
|
|
8742
8757
|
if 'zstandard' in sys.modules:
|
|
8743
8758
|
infile = ZstdFile(fileobj=infile, mode="rb")
|
|
8744
8759
|
elif 'pyzstd' in sys.modules:
|
|
8745
|
-
|
|
8760
|
+
infile = pyzstd.zstdfile.ZstdFile(fileobj=infile, mode="rb")
|
|
8746
8761
|
tarfp = tarfile.open(fileobj=infile, mode="r")
|
|
8747
8762
|
else:
|
|
8748
8763
|
tarfp = tarfile.open(infile, "r")
|
|
@@ -9776,9 +9791,9 @@ def upload_file_to_internet_file(ifp, url):
|
|
|
9776
9791
|
return False
|
|
9777
9792
|
|
|
9778
9793
|
|
|
9779
|
-
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__):
|
|
9780
9795
|
fp = CompressOpenFileAlt(
|
|
9781
|
-
fp, compression, compressionlevel, formatspecs)
|
|
9796
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
9782
9797
|
if(not archivefileout):
|
|
9783
9798
|
return False
|
|
9784
9799
|
fp.seek(0, 0)
|
|
@@ -9802,9 +9817,9 @@ def upload_file_to_internet_string(ifp, url):
|
|
|
9802
9817
|
return False
|
|
9803
9818
|
|
|
9804
9819
|
|
|
9805
|
-
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__):
|
|
9806
9821
|
fp = CompressOpenFileAlt(
|
|
9807
|
-
BytesIO(ifp), compression, compressionlevel, formatspecs)
|
|
9822
|
+
BytesIO(ifp), compression, compressionlevel, compressionuselist, formatspecs)
|
|
9808
9823
|
if(not archivefileout):
|
|
9809
9824
|
return False
|
|
9810
9825
|
fp.seek(0, 0)
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
Copyright 2016-2024 Game Maker 2k - http://intdb.sourceforge.net/
|
|
14
14
|
Copyright 2016-2024 Kazuki Przyborowski - https://github.com/KazukiPrzyborowski
|
|
15
15
|
|
|
16
|
-
$FileInfo: setup.py - Last Update:
|
|
16
|
+
$FileInfo: setup.py - Last Update: 8/24/2025 Ver. 0.21.2 RC 1 - Author: cooldude2k $
|
|
17
17
|
'''
|
|
18
18
|
|
|
19
19
|
import os
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|