PyFoxFile 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.
- {pyfoxfile-0.21.0 → pyfoxfile-0.21.2}/PKG-INFO +1 -1
- {pyfoxfile-0.21.0 → pyfoxfile-0.21.2}/PyFoxFile.egg-info/PKG-INFO +1 -1
- {pyfoxfile-0.21.0 → pyfoxfile-0.21.2}/foxfile.py +6 -6
- {pyfoxfile-0.21.0 → pyfoxfile-0.21.2}/pyfoxfile.py +130 -115
- {pyfoxfile-0.21.0 → pyfoxfile-0.21.2}/pyproject.toml +1 -1
- {pyfoxfile-0.21.0 → pyfoxfile-0.21.2}/setup.py +1 -1
- {pyfoxfile-0.21.0 → pyfoxfile-0.21.2}/LICENSE +0 -0
- {pyfoxfile-0.21.0 → pyfoxfile-0.21.2}/PyFoxFile.egg-info/SOURCES.txt +0 -0
- {pyfoxfile-0.21.0 → pyfoxfile-0.21.2}/PyFoxFile.egg-info/dependency_links.txt +0 -0
- {pyfoxfile-0.21.0 → pyfoxfile-0.21.2}/PyFoxFile.egg-info/top_level.txt +0 -0
- {pyfoxfile-0.21.0 → pyfoxfile-0.21.2}/PyFoxFile.egg-info/zip-safe +0 -0
- {pyfoxfile-0.21.0 → pyfoxfile-0.21.2}/README.md +0 -0
- {pyfoxfile-0.21.0 → pyfoxfile-0.21.2}/foxneofile.py +0 -0
- {pyfoxfile-0.21.0 → pyfoxfile-0.21.2}/neofoxfile.py +0 -0
- {pyfoxfile-0.21.0 → pyfoxfile-0.21.2}/setup.cfg +0 -0
|
@@ -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: foxfile.py - Last Update: 8/
|
|
17
|
+
$FileInfo: foxfile.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 = pyfoxfile.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((pyfoxfile.IsNestedDict(fnamedict) and checkcompressfile in fnamedict) or (pyfoxfile.IsSingleDict(fnamedict) and checkcompressfile==fnamedict['format_magic'])):
|
|
176
176
|
tmpout = pyfoxfile.RePackFoxFile(input_file, getargs.output, getargs.compression, getargs.wholefile, getargs.level, pyfoxfile.compressionlistalt, False, 0, 0, [getargs.checksum, getargs.checksum, getargs.checksum, getargs.checksum], getargs.skipchecksum, [], {}, fnamedict, getargs.verbose, False)
|
|
177
177
|
else:
|
|
178
178
|
tmpout = pyfoxfile.PackFoxFileFromInFile(
|
|
@@ -185,7 +185,7 @@ if active_action:
|
|
|
185
185
|
if getargs.convert:
|
|
186
186
|
checkcompressfile = pyfoxfile.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((pyfoxfile.IsNestedDict(fnamedict) and checkcompressfile in fnamedict) or (pyfoxfile.IsSingleDict(fnamedict) and checkcompressfile==fnamedict['format_magic'])):
|
|
189
189
|
pyfoxfile.RePackFoxFile(input_file, getargs.output, getargs.compression, getargs.wholefile, getargs.level, pyfoxfile.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 = pyfoxfile.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((pyfoxfile.IsNestedDict(fnamedict) and checkcompressfile in fnamedict) or (pyfoxfile.IsSingleDict(fnamedict) and checkcompressfile==fnamedict['format_magic'])):
|
|
204
204
|
tmpout = pyfoxfile.RePackFoxFile(input_file, tempout, getargs.compression, getargs.wholefile, getargs.level, pyfoxfile.compressionlistalt, False, 0, 0, [getargs.checksum, getargs.checksum, getargs.checksum, getargs.checksum], getargs.skipchecksum, [], {}, fnamedict, False, False)
|
|
205
205
|
else:
|
|
206
206
|
tmpout = pyfoxfile.PackFoxFileFromInFile(
|
|
@@ -214,7 +214,7 @@ if active_action:
|
|
|
214
214
|
if getargs.convert:
|
|
215
215
|
checkcompressfile = pyfoxfile.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((pyfoxfile.IsNestedDict(fnamedict) and checkcompressfile in fnamedict) or (pyfoxfile.IsSingleDict(fnamedict) and checkcompressfile==fnamedict['format_magic'])):
|
|
218
218
|
tmpout = pyfoxfile.FoxFileListFiles(input_file, "auto", 0, 0, getargs.skipchecksum, fnamedict, False, getargs.verbose, False, False)
|
|
219
219
|
else:
|
|
220
220
|
tmpout = pyfoxfile.InFileListFiles(input_file, getargs.verbose, fnamedict, False, False, False)
|
|
@@ -227,7 +227,7 @@ if active_action:
|
|
|
227
227
|
checkcompressfile = pyfoxfile.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((pyfoxfile.IsNestedDict(fnamedict) and checkcompressfile in fnamedict) or (pyfoxfile.IsSingleDict(fnamedict) and checkcompressfile==fnamedict['format_magic'])):
|
|
231
231
|
tmpout = pyfoxfile.RePackFoxFile(input_file, tempout, getargs.compression, getargs.wholefile, getargs.level, pyfoxfile.compressionlistalt, False, 0, 0, [getargs.checksum, getargs.checksum, getargs.checksum, getargs.checksum], getargs.skipchecksum, [], {}, fnamedict, False, False, False)
|
|
232
232
|
else:
|
|
233
233
|
tmpout = pyfoxfile.PackFoxFileFromInFile(
|
|
@@ -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: pyfoxfile.py - Last Update:
|
|
17
|
+
$FileInfo: pyfoxfile.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
|
|
@@ -389,12 +389,12 @@ __file_format_extension__ = __file_format_multi_dict__[__file_format_default__][
|
|
|
389
389
|
__file_format_dict__ = __file_format_multi_dict__[__file_format_default__]
|
|
390
390
|
__project__ = __program_name__
|
|
391
391
|
__project_url__ = "https://github.com/GameMaker2k/PyFoxFile"
|
|
392
|
-
__version_info__ = (0, 21,
|
|
393
|
-
__version_date_info__ = (2025, 9,
|
|
392
|
+
__version_info__ = (0, 21, 2, "RC 1", 1)
|
|
393
|
+
__version_date_info__ = (2025, 9, 24, "RC 1", 1)
|
|
394
394
|
__version_date__ = str(__version_date_info__[0]) + "." + str(
|
|
395
395
|
__version_date_info__[1]).zfill(2) + "." + str(__version_date_info__[2]).zfill(2)
|
|
396
396
|
__revision__ = __version_info__[3]
|
|
397
|
-
__revision_id__ = "$Id:
|
|
397
|
+
__revision_id__ = "$Id: c85d5aa829f172404f285788e6b35f73a35767c2 $"
|
|
398
398
|
if(__version_info__[4] is not None):
|
|
399
399
|
__version_date_plusrc__ = __version_date__ + \
|
|
400
400
|
"-" + str(__version_date_info__[4])
|
|
@@ -1957,15 +1957,15 @@ def ReadFileHeaderDataWithContent(fp, listonly=False, uncompress=True, skipcheck
|
|
|
1957
1957
|
HeaderOut = ReadFileHeaderDataWoSize(fp, delimiter)
|
|
1958
1958
|
if(len(HeaderOut) == 0):
|
|
1959
1959
|
return False
|
|
1960
|
-
if(re.findall("^[.|/]", HeaderOut[
|
|
1961
|
-
fname = HeaderOut[
|
|
1960
|
+
if(re.findall("^[.|/]", HeaderOut[5])):
|
|
1961
|
+
fname = HeaderOut[5]
|
|
1962
1962
|
else:
|
|
1963
|
-
fname = "./"+HeaderOut[
|
|
1963
|
+
fname = "./"+HeaderOut[5]
|
|
1964
1964
|
fcs = HeaderOut[-2].lower()
|
|
1965
1965
|
fccs = HeaderOut[-1].lower()
|
|
1966
|
-
fsize = int(HeaderOut[
|
|
1967
|
-
fcompression = HeaderOut[
|
|
1968
|
-
fcsize = int(HeaderOut[
|
|
1966
|
+
fsize = int(HeaderOut[7], 16)
|
|
1967
|
+
fcompression = HeaderOut[14]
|
|
1968
|
+
fcsize = int(HeaderOut[15], 16)
|
|
1969
1969
|
fseeknextfile = HeaderOut[26]
|
|
1970
1970
|
fjsontype = HeaderOut[27]
|
|
1971
1971
|
fjsonlen = int(HeaderOut[28], 16)
|
|
@@ -2018,6 +2018,7 @@ def ReadFileHeaderDataWithContent(fp, listonly=False, uncompress=True, skipcheck
|
|
|
2018
2018
|
fcontents.seek(0, 0)
|
|
2019
2019
|
newfccs = GetFileChecksum(
|
|
2020
2020
|
fcontents.read(), HeaderOut[-3].lower(), False, formatspecs)
|
|
2021
|
+
fcontents.seek(0, 0)
|
|
2021
2022
|
if(fccs != newfccs and not skipchecksum and not listonly):
|
|
2022
2023
|
VerbosePrintOut("File Content Checksum Error with file " +
|
|
2023
2024
|
fname + " at offset " + str(fcontentstart))
|
|
@@ -2030,7 +2031,7 @@ def ReadFileHeaderDataWithContent(fp, listonly=False, uncompress=True, skipcheck
|
|
|
2030
2031
|
if(uncompress):
|
|
2031
2032
|
cfcontents = UncompressFileAlt(fcontents, formatspecs)
|
|
2032
2033
|
cfcontents.seek(0, 0)
|
|
2033
|
-
|
|
2034
|
+
fcontents = BytesIO()
|
|
2034
2035
|
shutil.copyfileobj(cfcontents, fcontents)
|
|
2035
2036
|
cfcontents.close()
|
|
2036
2037
|
fcontents.seek(0, 0)
|
|
@@ -2122,6 +2123,7 @@ def ReadFileHeaderDataWithContentToArray(fp, listonly=False, contentasfile=True,
|
|
|
2122
2123
|
fextrafieldslist = json.loads(fextrafieldslist[0])
|
|
2123
2124
|
except (binascii.Error, json.decoder.JSONDecodeError, UnicodeDecodeError):
|
|
2124
2125
|
pass
|
|
2126
|
+
fjstart = fp.tell()
|
|
2125
2127
|
if(fjsontype=="json"):
|
|
2126
2128
|
fjsoncontent = {}
|
|
2127
2129
|
fprejsoncontent = fp.read(fjsonsize).decode("UTF-8")
|
|
@@ -2149,11 +2151,11 @@ def ReadFileHeaderDataWithContentToArray(fp, listonly=False, contentasfile=True,
|
|
|
2149
2151
|
fjsoncontent = ReadFileHeaderData(flisttmp, fjsonlen, delimiter)
|
|
2150
2152
|
flisttmp.close()
|
|
2151
2153
|
fjsonrawcontent = fjsoncontent
|
|
2152
|
-
if(
|
|
2154
|
+
if(fjsonlen==1):
|
|
2153
2155
|
try:
|
|
2154
2156
|
fjsonrawcontent = base64.b64decode(fjsoncontent[0]).decode("UTF-8")
|
|
2155
2157
|
fjsoncontent = json.loads(base64.b64decode(fjsoncontent[0]).decode("UTF-8"))
|
|
2156
|
-
|
|
2158
|
+
fjsonlen = len(fjsoncontent)
|
|
2157
2159
|
except (binascii.Error, json.decoder.JSONDecodeError, UnicodeDecodeError):
|
|
2158
2160
|
try:
|
|
2159
2161
|
fjsonrawcontent = fjsoncontent[0]
|
|
@@ -2161,6 +2163,7 @@ def ReadFileHeaderDataWithContentToArray(fp, listonly=False, contentasfile=True,
|
|
|
2161
2163
|
except (binascii.Error, json.decoder.JSONDecodeError, UnicodeDecodeError):
|
|
2162
2164
|
pass
|
|
2163
2165
|
fp.seek(len(delimiter), 1)
|
|
2166
|
+
fjend = fp.tell() - 1
|
|
2164
2167
|
jsonfcs = GetFileChecksum(fprejsoncontent, fjsonchecksumtype, True, formatspecs)
|
|
2165
2168
|
if(jsonfcs != fjsonchecksum and not skipchecksum):
|
|
2166
2169
|
VerbosePrintOut("File JSON Data Checksum Error with file " +
|
|
@@ -2195,6 +2198,7 @@ def ReadFileHeaderDataWithContentToArray(fp, listonly=False, contentasfile=True,
|
|
|
2195
2198
|
fcontents.seek(0, 0)
|
|
2196
2199
|
newfccs = GetFileChecksum(
|
|
2197
2200
|
fcontents.read(), HeaderOut[-3].lower(), False, formatspecs)
|
|
2201
|
+
fcontents.seek(0, 0)
|
|
2198
2202
|
if(fccs != newfccs and not skipchecksum and not listonly):
|
|
2199
2203
|
VerbosePrintOut("File Content Checksum Error with file " +
|
|
2200
2204
|
fname + " at offset " + str(fcontentstart))
|
|
@@ -2236,7 +2240,7 @@ def ReadFileHeaderDataWithContentToArray(fp, listonly=False, contentasfile=True,
|
|
|
2236
2240
|
if(not contentasfile):
|
|
2237
2241
|
fcontents = fcontents.read()
|
|
2238
2242
|
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,
|
|
2239
|
-
'fdev': fdev, 'fminor': fdev_minor, 'fmajor': fdev_major, 'fseeknextfile': fseeknextfile, 'fheaderchecksumtype': HeaderOut[-4], 'fjsonchecksumtype':
|
|
2243
|
+
'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}
|
|
2240
2244
|
return outlist
|
|
2241
2245
|
|
|
2242
2246
|
|
|
@@ -2333,11 +2337,11 @@ def ReadFileHeaderDataWithContentToList(fp, listonly=False, contentasfile=False,
|
|
|
2333
2337
|
fjsoncontent = ReadFileHeaderData(flisttmp, fjsonlen, delimiter)
|
|
2334
2338
|
flisttmp.close()
|
|
2335
2339
|
fjsonrawcontent = fjsoncontent
|
|
2336
|
-
if(
|
|
2340
|
+
if(fjsonlen==1):
|
|
2337
2341
|
try:
|
|
2338
2342
|
fjsonrawcontent = base64.b64decode(fjsoncontent[0]).decode("UTF-8")
|
|
2339
2343
|
fjsoncontent = json.loads(base64.b64decode(fjsoncontent[0]).decode("UTF-8"))
|
|
2340
|
-
|
|
2344
|
+
fjsonlen = len(fjsoncontent)
|
|
2341
2345
|
except (binascii.Error, json.decoder.JSONDecodeError, UnicodeDecodeError):
|
|
2342
2346
|
try:
|
|
2343
2347
|
fjsonrawcontent = fjsoncontent[0]
|
|
@@ -2547,11 +2551,11 @@ def ReadFileDataWithContentToArray(fp, seekstart=0, seekend=0, listonly=False, c
|
|
|
2547
2551
|
formversions = re.search('(.*?)(\\d+)', formstring).groups()
|
|
2548
2552
|
fcompresstype = ""
|
|
2549
2553
|
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': []}
|
|
2550
|
-
if(seekstart < 0
|
|
2554
|
+
if (seekstart < 0) or (seekstart > fnumfiles):
|
|
2551
2555
|
seekstart = 0
|
|
2552
|
-
if(seekend == 0 or seekend > fnumfiles
|
|
2556
|
+
if (seekend == 0) or (seekend > fnumfiles) or (seekend < seekstart):
|
|
2553
2557
|
seekend = fnumfiles
|
|
2554
|
-
elif(seekend < 0 and abs(seekend) <= fnumfiles and abs(seekend) >= seekstart):
|
|
2558
|
+
elif (seekend < 0) and (abs(seekend) <= fnumfiles) and (abs(seekend) >= seekstart):
|
|
2555
2559
|
seekend = fnumfiles - abs(seekend)
|
|
2556
2560
|
if(seekstart > 0):
|
|
2557
2561
|
il = 0
|
|
@@ -2562,14 +2566,18 @@ def ReadFileDataWithContentToArray(fp, seekstart=0, seekend=0, listonly=False, c
|
|
|
2562
2566
|
if(len(preheaderdata) == 0):
|
|
2563
2567
|
break
|
|
2564
2568
|
prefsize = int(preheaderdata[5], 16)
|
|
2569
|
+
if(re.findall("^[.|/]", preheaderdata[5])):
|
|
2570
|
+
prefname = preheaderdata[5]
|
|
2571
|
+
else:
|
|
2572
|
+
prefname = "./"+preheaderdata[5]
|
|
2565
2573
|
prefseeknextfile = preheaderdata[26]
|
|
2566
2574
|
prefjsonlen = int(preheaderdata[28], 16)
|
|
2567
2575
|
prefjsonsize = int(preheaderdata[29], 16)
|
|
2568
2576
|
prefjsonchecksumtype = preheaderdata[30]
|
|
2569
2577
|
prefjsonchecksum = preheaderdata[31]
|
|
2570
|
-
|
|
2578
|
+
prejsoncontent = fp.read(prefjsonsize).decode("UTF-8")
|
|
2571
2579
|
fp.seek(len(delimiter), 1)
|
|
2572
|
-
prejsonfcs = GetFileChecksum(
|
|
2580
|
+
prejsonfcs = GetFileChecksum(prejsoncontent, prefjsonchecksumtype, True, formatspecs)
|
|
2573
2581
|
if(prejsonfcs != prefjsonchecksum and not skipchecksum):
|
|
2574
2582
|
VerbosePrintOut("File JSON Data Checksum Error with file " +
|
|
2575
2583
|
prefname + " at offset " + str(prefhstart))
|
|
@@ -2579,7 +2587,7 @@ def ReadFileDataWithContentToArray(fp, seekstart=0, seekend=0, listonly=False, c
|
|
|
2579
2587
|
preheaderdata[:-2], preheaderdata[-4].lower(), True, formatspecs)
|
|
2580
2588
|
prefcs = preheaderdata[-2]
|
|
2581
2589
|
if(prefcs != prenewfcs and not skipchecksum):
|
|
2582
|
-
|
|
2590
|
+
VerbosePrintOut("File Header Checksum Error with file " +
|
|
2583
2591
|
prefname + " at offset " + str(prefhstart))
|
|
2584
2592
|
VerbosePrintOut("'" + prefcs + "' != " +
|
|
2585
2593
|
"'" + prenewfcs + "'")
|
|
@@ -2702,11 +2710,11 @@ def ReadFileDataWithContentToList(fp, seekstart=0, seekend=0, listonly=False, co
|
|
|
2702
2710
|
return False
|
|
2703
2711
|
formversions = re.search('(.*?)(\\d+)', formstring).groups()
|
|
2704
2712
|
outlist = []
|
|
2705
|
-
if(seekstart < 0
|
|
2713
|
+
if (seekstart < 0) or (seekstart > fnumfiles):
|
|
2706
2714
|
seekstart = 0
|
|
2707
|
-
if(seekend == 0 or seekend > fnumfiles
|
|
2715
|
+
if (seekend == 0) or (seekend > fnumfiles) or (seekend < seekstart):
|
|
2708
2716
|
seekend = fnumfiles
|
|
2709
|
-
elif(seekend < 0 and abs(seekend) <= fnumfiles and abs(seekend) >= seekstart):
|
|
2717
|
+
elif (seekend < 0) and (abs(seekend) <= fnumfiles) and (abs(seekend) >= seekstart):
|
|
2710
2718
|
seekend = fnumfiles - abs(seekend)
|
|
2711
2719
|
if(seekstart > 0):
|
|
2712
2720
|
il = 0
|
|
@@ -2721,16 +2729,20 @@ def ReadFileDataWithContentToList(fp, seekstart=0, seekend=0, listonly=False, co
|
|
|
2721
2729
|
if(len(preheaderdata) == 0):
|
|
2722
2730
|
break
|
|
2723
2731
|
prefsize = int(preheaderdata[5], 16)
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2732
|
+
if(re.findall("^[.|/]", preheaderdata[5])):
|
|
2733
|
+
prefname = preheaderdata[5]
|
|
2734
|
+
else:
|
|
2735
|
+
prefname = "./"+preheaderdata[5]
|
|
2736
|
+
prefcompression = preheaderdata[14]
|
|
2737
|
+
prefcsize = int(preheaderdata[15], 16)
|
|
2738
|
+
prefseeknextfile = preheaderdata[26]
|
|
2727
2739
|
prefjsonlen = int(preheaderdata[28], 16)
|
|
2728
2740
|
prefjsonsize = int(preheaderdata[29], 16)
|
|
2729
2741
|
prefjsonchecksumtype = preheaderdata[30]
|
|
2730
2742
|
prefjsonchecksum = preheaderdata[31]
|
|
2731
2743
|
prefprejsoncontent = fp.read(prefjsonsize).decode("UTF-8")
|
|
2732
2744
|
fp.seek(len(delimiter), 1)
|
|
2733
|
-
prejsonfcs = GetFileChecksum(
|
|
2745
|
+
prejsonfcs = GetFileChecksum(prefprejsoncontent, prefjsonchecksumtype, True, formatspecs)
|
|
2734
2746
|
if(prejsonfcs != prefjsonchecksum and not skipchecksum):
|
|
2735
2747
|
VerbosePrintOut("File JSON Data Checksum Error with file " +
|
|
2736
2748
|
prefname + " at offset " + str(prefhstart))
|
|
@@ -2817,13 +2829,13 @@ def ReadInFileWithContentToArray(infile, fmttype="auto", seekstart=0, seekend=0,
|
|
|
2817
2829
|
fp = UncompressFileAlt(fp, formatspecs)
|
|
2818
2830
|
checkcompressfile = CheckCompressionSubType(fp, formatspecs, True)
|
|
2819
2831
|
if(checkcompressfile == "tarfile" and TarFileCheck(infile)):
|
|
2820
|
-
return TarFileToArray(infile, seekstart, seekend, listonly, contentasfile, skipchecksum, formatspecs, seektoend,
|
|
2832
|
+
return TarFileToArray(infile, seekstart, seekend, listonly, contentasfile, skipchecksum, formatspecs, seektoend, True)
|
|
2821
2833
|
elif(checkcompressfile == "zipfile" and zipfile.is_zipfile(infile)):
|
|
2822
|
-
return ZipFileToArray(infile, seekstart, seekend, listonly, contentasfile, skipchecksum, formatspecs, seektoend,
|
|
2834
|
+
return ZipFileToArray(infile, seekstart, seekend, listonly, contentasfile, skipchecksum, formatspecs, seektoend, True)
|
|
2823
2835
|
elif(rarfile_support and checkcompressfile == "rarfile" and (rarfile.is_rarfile(infile) or rarfile.is_rarfile_sfx(infile))):
|
|
2824
|
-
return RarFileToArray(infile, seekstart, seekend, listonly, contentasfile, skipchecksum, formatspecs, seektoend,
|
|
2836
|
+
return RarFileToArray(infile, seekstart, seekend, listonly, contentasfile, skipchecksum, formatspecs, seektoend, True)
|
|
2825
2837
|
elif(py7zr_support and checkcompressfile == "7zipfile" and py7zr.is_7zfile(infile)):
|
|
2826
|
-
return SevenZipFileToArray(infile, seekstart, seekend, listonly, contentasfile, skipchecksum, formatspecs, seektoend,
|
|
2838
|
+
return SevenZipFileToArray(infile, seekstart, seekend, listonly, contentasfile, skipchecksum, formatspecs, seektoend, True)
|
|
2827
2839
|
elif(IsSingleDict(formatspecs) and checkcompressfile != formatspecs['format_magic']):
|
|
2828
2840
|
return False
|
|
2829
2841
|
elif(IsNestedDict(formatspecs) and checkcompressfile not in formatspecs):
|
|
@@ -2933,13 +2945,13 @@ def ReadInFileWithContentToArray(infile, fmttype="auto", seekstart=0, seekend=0,
|
|
|
2933
2945
|
if(IsNestedDict(formatspecs) and checkcompressfile in formatspecs):
|
|
2934
2946
|
formatspecs = formatspecs[checkcompressfile]
|
|
2935
2947
|
if(checkcompressfile == "tarfile" and TarFileCheck(infile)):
|
|
2936
|
-
return TarFileToArray(infile, seekstart, seekend, listonly, skipchecksum, formatspecs, seektoend,
|
|
2948
|
+
return TarFileToArray(infile, seekstart, seekend, listonly, skipchecksum, formatspecs, seektoend, True)
|
|
2937
2949
|
elif(checkcompressfile == "zipfile" and zipfile.is_zipfile(infile)):
|
|
2938
|
-
return ZipFileToArray(infile, seekstart, seekend, listonly, skipchecksum, formatspecs, seektoend,
|
|
2950
|
+
return ZipFileToArray(infile, seekstart, seekend, listonly, skipchecksum, formatspecs, seektoend, True)
|
|
2939
2951
|
elif(rarfile_support and checkcompressfile == "rarfile" and (rarfile.is_rarfile(infile) or rarfile.is_rarfile_sfx(infile))):
|
|
2940
|
-
return RarFileToArray(infile, seekstart, seekend, listonly, skipchecksum, formatspecs, seektoend,
|
|
2952
|
+
return RarFileToArray(infile, seekstart, seekend, listonly, skipchecksum, formatspecs, seektoend, True)
|
|
2941
2953
|
elif(py7zr_support and checkcompressfile == "7zipfile" and py7zr.is_7zfile(infile)):
|
|
2942
|
-
return SevenZipFileToArray(infile, seekstart, seekend, listonly, skipchecksum, formatspecs, seektoend,
|
|
2954
|
+
return SevenZipFileToArray(infile, seekstart, seekend, listonly, skipchecksum, formatspecs, seektoend, True)
|
|
2943
2955
|
elif(IsSingleDict(formatspecs) and checkcompressfile != formatspecs['format_magic']):
|
|
2944
2956
|
return False
|
|
2945
2957
|
elif(IsNestedDict(formatspecs) and checkcompressfile not in formatspecs):
|
|
@@ -2978,7 +2990,7 @@ def ReadInMultipleFileWithContentToArray(infile, fmttype="auto", seekstart=0, se
|
|
|
2978
2990
|
infile = [infile]
|
|
2979
2991
|
outretval = {}
|
|
2980
2992
|
for curfname in infile:
|
|
2981
|
-
|
|
2993
|
+
outretval[curfname] = ReadInFileWithContentToArray(curfname, fmttype, seekstart, seekend, listonly, contentasfile, uncompress, skipchecksum, formatspecs, seektoend)
|
|
2982
2994
|
return outretval
|
|
2983
2995
|
|
|
2984
2996
|
def ReadInMultipleFilesWithContentToArray(infile, fmttype="auto", seekstart=0, seekend=0, listonly=False, contentasfile=True, uncompress=True, skipchecksum=False, formatspecs=__file_format_multi_dict__, seektoend=False):
|
|
@@ -3005,13 +3017,13 @@ def ReadInFileWithContentToList(infile, fmttype="auto", seekstart=0, seekend=0,
|
|
|
3005
3017
|
fp = UncompressFileAlt(fp, formatspecs)
|
|
3006
3018
|
checkcompressfile = CheckCompressionSubType(fp, formatspecs, True)
|
|
3007
3019
|
if(checkcompressfile == "tarfile" and TarFileCheck(infile)):
|
|
3008
|
-
return TarFileToArray(infile, seekstart, seekend, listonly, contentasfile, skipchecksum, formatspecs, seektoend,
|
|
3020
|
+
return TarFileToArray(infile, seekstart, seekend, listonly, contentasfile, skipchecksum, formatspecs, seektoend, True)
|
|
3009
3021
|
elif(checkcompressfile == "zipfile" and zipfile.is_zipfile(infile)):
|
|
3010
|
-
return ZipFileToArray(infile, seekstart, seekend, listonly, contentasfile, skipchecksum, formatspecs, seektoend,
|
|
3022
|
+
return ZipFileToArray(infile, seekstart, seekend, listonly, contentasfile, skipchecksum, formatspecs, seektoend, True)
|
|
3011
3023
|
elif(rarfile_support and checkcompressfile == "rarfile" and (rarfile.is_rarfile(infile) or rarfile.is_rarfile_sfx(infile))):
|
|
3012
|
-
return RarFileToArray(infile, seekstart, seekend, listonly, contentasfile, skipchecksum, formatspecs, seektoend,
|
|
3024
|
+
return RarFileToArray(infile, seekstart, seekend, listonly, contentasfile, skipchecksum, formatspecs, seektoend, True)
|
|
3013
3025
|
elif(py7zr_support and checkcompressfile == "7zipfile" and py7zr.is_7zfile(infile)):
|
|
3014
|
-
return SevenZipFileToArray(infile, seekstart, seekend, listonly, contentasfile, skipchecksum, formatspecs, seektoend,
|
|
3026
|
+
return SevenZipFileToArray(infile, seekstart, seekend, listonly, contentasfile, skipchecksum, formatspecs, seektoend, True)
|
|
3015
3027
|
elif(IsSingleDict(formatspecs) and checkcompressfile != formatspecs['format_magic']):
|
|
3016
3028
|
return False
|
|
3017
3029
|
elif(IsNestedDict(formatspecs) and checkcompressfile not in formatspecs):
|
|
@@ -3121,13 +3133,13 @@ def ReadInFileWithContentToList(infile, fmttype="auto", seekstart=0, seekend=0,
|
|
|
3121
3133
|
if(IsNestedDict(formatspecs) and checkcompressfile in formatspecs):
|
|
3122
3134
|
formatspecs = formatspecs[checkcompressfile]
|
|
3123
3135
|
if(checkcompressfile == "tarfile" and TarFileCheck(infile)):
|
|
3124
|
-
return TarFileToArray(infile, seekstart, seekend, listonly, skipchecksum, formatspecs, seektoend,
|
|
3136
|
+
return TarFileToArray(infile, seekstart, seekend, listonly, skipchecksum, formatspecs, seektoend, True)
|
|
3125
3137
|
elif(checkcompressfile == "zipfile" and zipfile.is_zipfile(infile)):
|
|
3126
|
-
return ZipFileToArray(infile, seekstart, seekend, listonly, skipchecksum, formatspecs, seektoend,
|
|
3138
|
+
return ZipFileToArray(infile, seekstart, seekend, listonly, skipchecksum, formatspecs, seektoend, True)
|
|
3127
3139
|
elif(rarfile_support and checkcompressfile == "rarfile" and (rarfile.is_rarfile(infile) or rarfile.is_rarfile_sfx(infile))):
|
|
3128
|
-
return RarFileToArray(infile, seekstart, seekend, listonly, skipchecksum, formatspecs, seektoend,
|
|
3140
|
+
return RarFileToArray(infile, seekstart, seekend, listonly, skipchecksum, formatspecs, seektoend, True)
|
|
3129
3141
|
elif(py7zr_support and checkcompressfile == "7zipfile" and py7zr.is_7zfile(infile)):
|
|
3130
|
-
return SevenZipFileToArray(infile, seekstart, seekend, listonly, skipchecksum, formatspecs, seektoend,
|
|
3142
|
+
return SevenZipFileToArray(infile, seekstart, seekend, listonly, skipchecksum, formatspecs, seektoend, True)
|
|
3131
3143
|
elif(IsSingleDict(formatspecs) and checkcompressfile != formatspecs['format_magic']):
|
|
3132
3144
|
return False
|
|
3133
3145
|
elif(IsNestedDict(formatspecs) and checkcompressfile not in formatspecs):
|
|
@@ -3166,7 +3178,7 @@ def ReadInMultipleFileWithContentToList(infile, fmttype="auto", seekstart=0, see
|
|
|
3166
3178
|
infile = [infile]
|
|
3167
3179
|
outretval = {}
|
|
3168
3180
|
for curfname in infile:
|
|
3169
|
-
curretfile =
|
|
3181
|
+
curretfile[curfname] = ReadInFileWithContentToList(curfname, fmttype, seekstart, seekend, listonly, contentasfile, uncompress, skipchecksum, formatspecs, seektoend)
|
|
3170
3182
|
return outretval
|
|
3171
3183
|
|
|
3172
3184
|
def ReadInMultipleFilesWithContentToList(infile, fmttype="auto", seekstart=0, seekend=0, listonly=False, contentasfile=True, uncompress=True, skipchecksum=False, formatspecs=__file_format_multi_dict__, seektoend=False):
|
|
@@ -3211,7 +3223,7 @@ def AppendFileHeader(fp, numfiles, fencoding, extradata=[], checksumtype="crc32"
|
|
|
3211
3223
|
tmpoutlist = []
|
|
3212
3224
|
tmpoutlist.append(extrasizelen)
|
|
3213
3225
|
tmpoutlist.append(extrafields)
|
|
3214
|
-
fnumfiles = format(
|
|
3226
|
+
fnumfiles = format(numfiles, 'x').lower()
|
|
3215
3227
|
tmpoutlen = 3 + len(tmpoutlist) + len(extradata) + 2
|
|
3216
3228
|
tmpoutlenhex = format(tmpoutlen, 'x').lower()
|
|
3217
3229
|
fnumfilesa = AppendNullBytes(
|
|
@@ -3265,11 +3277,11 @@ def MakeEmptyFilePointer(fp, fmttype=__file_format_default__, checksumtype="crc3
|
|
|
3265
3277
|
return fp
|
|
3266
3278
|
|
|
3267
3279
|
|
|
3268
|
-
def
|
|
3280
|
+
def MakeEmptyArchiveFilePointer(fp, fmttype=__file_format_default__, checksumtype="crc32", formatspecs=__file_format_multi_dict__):
|
|
3269
3281
|
return MakeEmptyFilePointer(fp, fmttype, checksumtype, formatspecs)
|
|
3270
3282
|
|
|
3271
3283
|
|
|
3272
|
-
def MakeEmptyFile(outfile, fmttype="auto", compression="auto", compresswholefile=True, compressionlevel=None, checksumtype="crc32", formatspecs=__file_format_multi_dict__, returnfp=False):
|
|
3284
|
+
def MakeEmptyFile(outfile, fmttype="auto", compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, checksumtype="crc32", formatspecs=__file_format_multi_dict__, returnfp=False):
|
|
3273
3285
|
if(IsNestedDict(formatspecs) and fmttype=="auto" and
|
|
3274
3286
|
(outfile != "-" and outfile is not None and not hasattr(outfile, "read") and not hasattr(outfile, "write"))):
|
|
3275
3287
|
get_in_ext = os.path.splitext(outfile)
|
|
@@ -3313,7 +3325,7 @@ def MakeEmptyFile(outfile, fmttype="auto", compression="auto", compresswholefile
|
|
|
3313
3325
|
AppendFileHeader(fp, 0, "UTF-8", [], checksumtype, formatspecs)
|
|
3314
3326
|
if(outfile == "-" or outfile is None or hasattr(outfile, "read") or hasattr(outfile, "write")):
|
|
3315
3327
|
fp = CompressOpenFileAlt(
|
|
3316
|
-
fp, compression, compressionlevel, formatspecs)
|
|
3328
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
3317
3329
|
try:
|
|
3318
3330
|
fp.flush()
|
|
3319
3331
|
if(hasattr(os, "sync")):
|
|
@@ -3337,7 +3349,7 @@ def MakeEmptyFile(outfile, fmttype="auto", compression="auto", compresswholefile
|
|
|
3337
3349
|
return outvar
|
|
3338
3350
|
elif(re.findall("^(ftp|ftps|sftp):\\/\\/", outfile)):
|
|
3339
3351
|
fp = CompressOpenFileAlt(
|
|
3340
|
-
fp, compression, compressionlevel, formatspecs)
|
|
3352
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
3341
3353
|
fp.seek(0, 0)
|
|
3342
3354
|
upload_file_to_internet_file(fp, outfile)
|
|
3343
3355
|
if(returnfp):
|
|
@@ -3348,8 +3360,8 @@ def MakeEmptyFile(outfile, fmttype="auto", compression="auto", compresswholefile
|
|
|
3348
3360
|
return True
|
|
3349
3361
|
|
|
3350
3362
|
|
|
3351
|
-
def
|
|
3352
|
-
return MakeEmptyFile(outfile, compression, compresswholefile, compressionlevel, checksumtype, formatspecs, returnfp)
|
|
3363
|
+
def MakeEmptyArchiveFile(outfile, compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, checksumtype="crc32", formatspecs=__file_format_dict__, returnfp=False):
|
|
3364
|
+
return MakeEmptyFile(outfile, "auto", compression, compresswholefile, compressionlevel, compressionuselist, checksumtype, formatspecs, returnfp)
|
|
3353
3365
|
|
|
3354
3366
|
|
|
3355
3367
|
def AppendFileHeaderWithContent(fp, filevalues=[], extradata=[], jsondata={}, filecontent="", checksumtype=["crc32", "crc32", "crc32"], formatspecs=__file_format_dict__):
|
|
@@ -3448,6 +3460,7 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, filevalues=[], ext
|
|
|
3448
3460
|
if(verbose):
|
|
3449
3461
|
logging.basicConfig(format="%(message)s",
|
|
3450
3462
|
stream=sys.stdout, level=logging.DEBUG)
|
|
3463
|
+
infilelist = []
|
|
3451
3464
|
if(infiles == "-"):
|
|
3452
3465
|
for line in sys.stdin:
|
|
3453
3466
|
infilelist.append(line.strip())
|
|
@@ -3488,7 +3501,7 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, filevalues=[], ext
|
|
|
3488
3501
|
inodetoforminode = {}
|
|
3489
3502
|
numfiles = int(len(GetDirList))
|
|
3490
3503
|
fnumfiles = format(numfiles, 'x').lower()
|
|
3491
|
-
AppendFileHeader(fp,
|
|
3504
|
+
AppendFileHeader(fp, numfiles, "UTF-8", [], checksumtype[0], formatspecs)
|
|
3492
3505
|
FullSizeFilesAlt = 0
|
|
3493
3506
|
for curfname in GetDirList:
|
|
3494
3507
|
fencoding = "UTF-8"
|
|
@@ -3586,7 +3599,7 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, filevalues=[], ext
|
|
|
3586
3599
|
elif ftype in data_types:
|
|
3587
3600
|
fsize = format(int(fstatinfo.st_size), 'x').lower()
|
|
3588
3601
|
else:
|
|
3589
|
-
fsize = format(int(fstatinfo.st_size)).lower()
|
|
3602
|
+
fsize = format(int(fstatinfo.st_size), 'x').lower()
|
|
3590
3603
|
fatime = format(int(fstatinfo.st_atime), 'x').lower()
|
|
3591
3604
|
fmtime = format(int(fstatinfo.st_mtime), 'x').lower()
|
|
3592
3605
|
fctime = format(int(fstatinfo.st_ctime), 'x').lower()
|
|
@@ -3656,7 +3669,7 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, filevalues=[], ext
|
|
|
3656
3669
|
fcontents.seek(0, 0)
|
|
3657
3670
|
cfcontents.seek(0, 0)
|
|
3658
3671
|
cfcontents = CompressOpenFileAlt(
|
|
3659
|
-
cfcontents, compressionuselist[ilmin], compressionlevel, formatspecs)
|
|
3672
|
+
cfcontents, compressionuselist[ilmin], compressionlevel, compressionuselist, formatspecs)
|
|
3660
3673
|
if(cfcontents):
|
|
3661
3674
|
cfcontents.seek(0, 2)
|
|
3662
3675
|
ilcsize.append(cfcontents.tell())
|
|
@@ -3671,7 +3684,7 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, filevalues=[], ext
|
|
|
3671
3684
|
shutil.copyfileobj(fcontents, cfcontents)
|
|
3672
3685
|
cfcontents.seek(0, 0)
|
|
3673
3686
|
cfcontents = CompressOpenFileAlt(
|
|
3674
|
-
cfcontents, curcompression, compressionlevel, formatspecs)
|
|
3687
|
+
cfcontents, curcompression, compressionlevel, compressionuselist, formatspecs)
|
|
3675
3688
|
cfcontents.seek(0, 2)
|
|
3676
3689
|
cfsize = cfcontents.tell()
|
|
3677
3690
|
if(ucfsize > cfsize):
|
|
@@ -3703,7 +3716,7 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, filevalues=[], ext
|
|
|
3703
3716
|
fcontents.seek(0, 0)
|
|
3704
3717
|
cfcontents.seek(0, 0)
|
|
3705
3718
|
cfcontents = CompressOpenFileAlt(
|
|
3706
|
-
cfcontents, compressionuselist[ilmin], compressionlevel, formatspecs)
|
|
3719
|
+
cfcontents, compressionuselist[ilmin], compressionlevel, compressionuselist, formatspecs)
|
|
3707
3720
|
if(cfcontents):
|
|
3708
3721
|
cfcontents.seek(0, 2)
|
|
3709
3722
|
ilcsize.append(cfcontents.tell())
|
|
@@ -3718,7 +3731,7 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, filevalues=[], ext
|
|
|
3718
3731
|
shutil.copyfileobj(fcontents, cfcontents)
|
|
3719
3732
|
cfcontents.seek(0, 0)
|
|
3720
3733
|
cfcontents = CompressOpenFileAlt(
|
|
3721
|
-
cfcontents, curcompression, compressionlevel, formatspecs)
|
|
3734
|
+
cfcontents, curcompression, compressionlevel, compressionuselist, formatspecs)
|
|
3722
3735
|
cfcontents.seek(0, 2)
|
|
3723
3736
|
cfsize = cfcontents.tell()
|
|
3724
3737
|
if(ucfsize > cfsize):
|
|
@@ -3760,7 +3773,7 @@ def AppendListsWithContent(inlist, fp, dirlistfromtxt=False, filevalues=[], extr
|
|
|
3760
3773
|
inodetoforminode = {}
|
|
3761
3774
|
numfiles = int(len(GetDirList))
|
|
3762
3775
|
fnumfiles = format(numfiles, 'x').lower()
|
|
3763
|
-
AppendFileHeader(fp,
|
|
3776
|
+
AppendFileHeader(fp, numfiles, "UTF-8", [], checksumtype[0], formatspecs)
|
|
3764
3777
|
for curfname in GetDirList:
|
|
3765
3778
|
ftype = format(curfname[0], 'x').lower()
|
|
3766
3779
|
fencoding = curfname[1]
|
|
@@ -3862,7 +3875,7 @@ def AppendFilesWithContentToOutFile(infiles, outfile, dirlistfromtxt=False, fmtt
|
|
|
3862
3875
|
compresswholefile, compressionlevel, compressionuselist, followlink, checksumtype, formatspecs, verbose)
|
|
3863
3876
|
if(outfile == "-" or outfile is None or hasattr(outfile, "read") or hasattr(outfile, "write")):
|
|
3864
3877
|
fp = CompressOpenFileAlt(
|
|
3865
|
-
fp, compression, compressionlevel, formatspecs)
|
|
3878
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
3866
3879
|
try:
|
|
3867
3880
|
fp.flush()
|
|
3868
3881
|
if(hasattr(os, "sync")):
|
|
@@ -3886,7 +3899,7 @@ def AppendFilesWithContentToOutFile(infiles, outfile, dirlistfromtxt=False, fmtt
|
|
|
3886
3899
|
return outvar
|
|
3887
3900
|
elif((not hasattr(outfile, "read") and not hasattr(outfile, "write")) and re.findall("^(ftp|ftps|sftp):\\/\\/", outfile)):
|
|
3888
3901
|
fp = CompressOpenFileAlt(
|
|
3889
|
-
fp, compression, compressionlevel, formatspecs)
|
|
3902
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
3890
3903
|
fp.seek(0, 0)
|
|
3891
3904
|
upload_file_to_internet_file(fp, outfile)
|
|
3892
3905
|
if(returnfp):
|
|
@@ -3942,7 +3955,7 @@ def AppendListsWithContentToOutFile(inlist, outfile, dirlistfromtxt=False, fmtty
|
|
|
3942
3955
|
compresswholefile, compressionlevel, followlink, checksumtype, formatspecs, verbose)
|
|
3943
3956
|
if(outfile == "-" or outfile is None or hasattr(outfile, "read") or hasattr(outfile, "write")):
|
|
3944
3957
|
fp = CompressOpenFileAlt(
|
|
3945
|
-
fp, compression, compressionlevel, formatspecs)
|
|
3958
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
3946
3959
|
try:
|
|
3947
3960
|
fp.flush()
|
|
3948
3961
|
if(hasattr(os, "sync")):
|
|
@@ -3966,7 +3979,7 @@ def AppendListsWithContentToOutFile(inlist, outfile, dirlistfromtxt=False, fmtty
|
|
|
3966
3979
|
return outvar
|
|
3967
3980
|
elif((not hasattr(outfile, "read") and not hasattr(outfile, "write")) and re.findall("^(ftp|ftps|sftp):\\/\\/", outfile)):
|
|
3968
3981
|
fp = CompressOpenFileAlt(
|
|
3969
|
-
fp, compression, compressionlevel, formatspecs)
|
|
3982
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
3970
3983
|
fp.seek(0, 0)
|
|
3971
3984
|
upload_file_to_internet_file(fp, outfile)
|
|
3972
3985
|
if(returnfp):
|
|
@@ -4657,13 +4670,13 @@ def UncompressBytesAltFP(fp, formatspecs=__file_format_multi_dict__):
|
|
|
4657
4670
|
return filefp
|
|
4658
4671
|
|
|
4659
4672
|
|
|
4660
|
-
def CompressOpenFileAlt(fp, compression="auto", compressionlevel=None, formatspecs=__file_format_dict__):
|
|
4673
|
+
def CompressOpenFileAlt(fp, compression="auto", compressionlevel=None, compressionuselist=compressionlistalt, formatspecs=__file_format_dict__):
|
|
4661
4674
|
if(not hasattr(fp, "read")):
|
|
4662
4675
|
return False
|
|
4663
4676
|
fp.seek(0, 0)
|
|
4664
4677
|
if(not compression or compression == formatspecs['format_magic']):
|
|
4665
4678
|
compression = "auto"
|
|
4666
|
-
if(compression not in
|
|
4679
|
+
if(compression not in compressionuselist and compression is None):
|
|
4667
4680
|
compression = "auto"
|
|
4668
4681
|
if(compression == "gzip" and compression in compressionsupport):
|
|
4669
4682
|
bytesfp = BytesIO()
|
|
@@ -4882,7 +4895,7 @@ def PackFoxFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", compress
|
|
|
4882
4895
|
outfile = RemoveWindowsPath(outfile)
|
|
4883
4896
|
if(not compression or compression == formatspecs['format_magic']):
|
|
4884
4897
|
compression = "auto"
|
|
4885
|
-
if(compression not in
|
|
4898
|
+
if(compression not in compressionuselist and compression is None):
|
|
4886
4899
|
compression = "auto"
|
|
4887
4900
|
if(verbose):
|
|
4888
4901
|
logging.basicConfig(format="%(message)s",
|
|
@@ -5049,7 +5062,7 @@ def PackFoxFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", compress
|
|
|
5049
5062
|
elif ftype in data_types:
|
|
5050
5063
|
fsize = format(int(fstatinfo.st_size), 'x').lower()
|
|
5051
5064
|
else:
|
|
5052
|
-
fsize = format(int(fstatinfo.st_size)).lower()
|
|
5065
|
+
fsize = format(int(fstatinfo.st_size), 'x').lower()
|
|
5053
5066
|
fatime = format(int(fstatinfo.st_atime), 'x').lower()
|
|
5054
5067
|
fmtime = format(int(fstatinfo.st_mtime), 'x').lower()
|
|
5055
5068
|
fctime = format(int(fstatinfo.st_ctime), 'x').lower()
|
|
@@ -5118,7 +5131,7 @@ def PackFoxFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", compress
|
|
|
5118
5131
|
fcontents.seek(0, 0)
|
|
5119
5132
|
cfcontents.seek(0, 0)
|
|
5120
5133
|
cfcontents = CompressOpenFileAlt(
|
|
5121
|
-
cfcontents, compressionuselist[ilmin], compressionlevel, formatspecs)
|
|
5134
|
+
cfcontents, compressionuselist[ilmin], compressionlevel, compressionuselist, formatspecs)
|
|
5122
5135
|
if(cfcontents):
|
|
5123
5136
|
cfcontents.seek(0, 2)
|
|
5124
5137
|
ilcsize.append(cfcontents.tell())
|
|
@@ -5133,7 +5146,7 @@ def PackFoxFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", compress
|
|
|
5133
5146
|
shutil.copyfileobj(fcontents, cfcontents)
|
|
5134
5147
|
cfcontents.seek(0, 0)
|
|
5135
5148
|
cfcontents = CompressOpenFileAlt(
|
|
5136
|
-
cfcontents, curcompression, compressionlevel, formatspecs)
|
|
5149
|
+
cfcontents, curcompression, compressionlevel, compressionuselist, formatspecs)
|
|
5137
5150
|
cfcontents.seek(0, 2)
|
|
5138
5151
|
cfsize = cfcontents.tell()
|
|
5139
5152
|
if(ucfsize > cfsize):
|
|
@@ -5165,7 +5178,7 @@ def PackFoxFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", compress
|
|
|
5165
5178
|
fcontents.seek(0, 0)
|
|
5166
5179
|
cfcontents.seek(0, 0)
|
|
5167
5180
|
cfcontents = CompressOpenFileAlt(
|
|
5168
|
-
cfcontents, compressionuselist[ilmin], compressionlevel, formatspecs)
|
|
5181
|
+
cfcontents, compressionuselist[ilmin], compressionlevel, compressionuselist, formatspecs)
|
|
5169
5182
|
if(cfcontents):
|
|
5170
5183
|
cfcontents.seek(0, 2)
|
|
5171
5184
|
ilcsize.append(cfcontents.tell())
|
|
@@ -5180,7 +5193,7 @@ def PackFoxFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", compress
|
|
|
5180
5193
|
shutil.copyfileobj(fcontents, cfcontents)
|
|
5181
5194
|
cfcontents.seek(0, 0)
|
|
5182
5195
|
cfcontents = CompressOpenFileAlt(
|
|
5183
|
-
cfcontents, curcompression, compressionlevel, formatspecs)
|
|
5196
|
+
cfcontents, curcompression, compressionlevel, compressionuselist, formatspecs)
|
|
5184
5197
|
cfcontents.seek(0, 2)
|
|
5185
5198
|
cfsize = cfcontents.tell()
|
|
5186
5199
|
if(ucfsize > cfsize):
|
|
@@ -5205,7 +5218,7 @@ def PackFoxFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", compress
|
|
|
5205
5218
|
return False
|
|
5206
5219
|
if(outfile == "-" or outfile is None or hasattr(outfile, "read") or hasattr(outfile, "write")):
|
|
5207
5220
|
fp = CompressOpenFileAlt(
|
|
5208
|
-
fp, compression, compressionlevel, formatspecs)
|
|
5221
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
5209
5222
|
try:
|
|
5210
5223
|
fp.flush()
|
|
5211
5224
|
if(hasattr(os, "sync")):
|
|
@@ -5229,7 +5242,7 @@ def PackFoxFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", compress
|
|
|
5229
5242
|
return outvar
|
|
5230
5243
|
elif((not hasattr(outfile, "read") and not hasattr(outfile, "write")) and re.findall("^(ftp|ftps|sftp):\\/\\/", outfile)):
|
|
5231
5244
|
fp = CompressOpenFileAlt(
|
|
5232
|
-
fp, compression, compressionlevel, formatspecs)
|
|
5245
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
5233
5246
|
fp.seek(0, 0)
|
|
5234
5247
|
upload_file_to_internet_file(fp, outfile)
|
|
5235
5248
|
if(returnfp):
|
|
@@ -5267,7 +5280,7 @@ def PackFoxFileFromTarFile(infile, outfile, fmttype="auto", compression="auto",
|
|
|
5267
5280
|
outfile = RemoveWindowsPath(outfile)
|
|
5268
5281
|
if(not compression or compression == formatspecs['format_magic']):
|
|
5269
5282
|
compression = "auto"
|
|
5270
|
-
if(compression not in
|
|
5283
|
+
if(compression not in compressionuselist and compression is None):
|
|
5271
5284
|
compression = "auto"
|
|
5272
5285
|
if(verbose):
|
|
5273
5286
|
logging.basicConfig(format="%(message)s", stream=sys.stdout, level=logging.DEBUG)
|
|
@@ -5342,7 +5355,7 @@ def PackFoxFileFromTarFile(infile, outfile, fmttype="auto", compression="auto",
|
|
|
5342
5355
|
if 'zstandard' in sys.modules:
|
|
5343
5356
|
infile = ZstdFile(fileobj=infile, mode="rb")
|
|
5344
5357
|
elif 'pyzstd' in sys.modules:
|
|
5345
|
-
|
|
5358
|
+
infile = pyzstd.zstdfile.ZstdFile(fileobj=infile, mode="rb")
|
|
5346
5359
|
tarfp = tarfile.open(fileobj=infile, mode="r")
|
|
5347
5360
|
else:
|
|
5348
5361
|
tarfp = tarfile.open(fileobj=infile, mode="r")
|
|
@@ -5354,7 +5367,7 @@ def PackFoxFileFromTarFile(infile, outfile, fmttype="auto", compression="auto",
|
|
|
5354
5367
|
if 'zstandard' in sys.modules:
|
|
5355
5368
|
infile = ZstdFile(fileobj=infile, mode="rb")
|
|
5356
5369
|
elif 'pyzstd' in sys.modules:
|
|
5357
|
-
|
|
5370
|
+
infile = pyzstd.zstdfile.ZstdFile(fileobj=infile, mode="rb")
|
|
5358
5371
|
tarfp = tarfile.open(fileobj=infile, mode="r")
|
|
5359
5372
|
else:
|
|
5360
5373
|
tarfp = tarfile.open(infile, "r")
|
|
@@ -5446,6 +5459,7 @@ def PackFoxFileFromTarFile(infile, outfile, fmttype="auto", compression="auto",
|
|
|
5446
5459
|
curcompression = "none"
|
|
5447
5460
|
if ftype in data_types:
|
|
5448
5461
|
fpc = tarfp.extractfile(member)
|
|
5462
|
+
fpc.close()
|
|
5449
5463
|
shutil.copyfileobj(fpc, fcontents)
|
|
5450
5464
|
typechecktest = CheckCompressionType(fcontents, closefp=False)
|
|
5451
5465
|
fcontents.seek(0, 0)
|
|
@@ -5465,7 +5479,7 @@ def PackFoxFileFromTarFile(infile, outfile, fmttype="auto", compression="auto",
|
|
|
5465
5479
|
fcontents.seek(0, 0)
|
|
5466
5480
|
cfcontents.seek(0, 0)
|
|
5467
5481
|
cfcontents = CompressOpenFileAlt(
|
|
5468
|
-
cfcontents, compressionuselist[ilmin], compressionlevel, formatspecs)
|
|
5482
|
+
cfcontents, compressionuselist[ilmin], compressionlevel, compressionuselist, formatspecs)
|
|
5469
5483
|
if(cfcontents):
|
|
5470
5484
|
cfcontents.seek(0, 2)
|
|
5471
5485
|
ilcsize.append(cfcontents.tell())
|
|
@@ -5480,7 +5494,7 @@ def PackFoxFileFromTarFile(infile, outfile, fmttype="auto", compression="auto",
|
|
|
5480
5494
|
shutil.copyfileobj(fcontents, cfcontents)
|
|
5481
5495
|
cfcontents.seek(0, 0)
|
|
5482
5496
|
cfcontents = CompressOpenFileAlt(
|
|
5483
|
-
cfcontents, curcompression, compressionlevel, formatspecs)
|
|
5497
|
+
cfcontents, curcompression, compressionlevel, compressionuselist, formatspecs)
|
|
5484
5498
|
cfcontents.seek(0, 2)
|
|
5485
5499
|
cfsize = cfcontents.tell()
|
|
5486
5500
|
if(ucfsize > cfsize):
|
|
@@ -5505,7 +5519,7 @@ def PackFoxFileFromTarFile(infile, outfile, fmttype="auto", compression="auto",
|
|
|
5505
5519
|
return False
|
|
5506
5520
|
if(outfile == "-" or outfile is None or hasattr(outfile, "read") or hasattr(outfile, "write")):
|
|
5507
5521
|
fp = CompressOpenFileAlt(
|
|
5508
|
-
fp, compression, compressionlevel, formatspecs)
|
|
5522
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
5509
5523
|
try:
|
|
5510
5524
|
fp.flush()
|
|
5511
5525
|
if(hasattr(os, "sync")):
|
|
@@ -5529,7 +5543,7 @@ def PackFoxFileFromTarFile(infile, outfile, fmttype="auto", compression="auto",
|
|
|
5529
5543
|
return outvar
|
|
5530
5544
|
elif((not hasattr(outfile, "read") and not hasattr(outfile, "write")) and re.findall("^(ftp|ftps|sftp):\\/\\/", outfile)):
|
|
5531
5545
|
fp = CompressOpenFileAlt(
|
|
5532
|
-
fp, compression, compressionlevel, formatspecs)
|
|
5546
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
5533
5547
|
fp.seek(0, 0)
|
|
5534
5548
|
upload_file_to_internet_file(fp, outfile)
|
|
5535
5549
|
if(returnfp):
|
|
@@ -5563,7 +5577,7 @@ def PackFoxFileFromZipFile(infile, outfile, fmttype="auto", compression="auto",
|
|
|
5563
5577
|
outfile = RemoveWindowsPath(outfile)
|
|
5564
5578
|
if(not compression or compression == formatspecs['format_magic']):
|
|
5565
5579
|
compression = "auto"
|
|
5566
|
-
if(compression not in
|
|
5580
|
+
if(compression not in compressionuselist and compression is None):
|
|
5567
5581
|
compression = "auto"
|
|
5568
5582
|
if(verbose):
|
|
5569
5583
|
logging.basicConfig(format="%(message)s", stream=sys.stdout, level=logging.DEBUG)
|
|
@@ -5762,7 +5776,7 @@ def PackFoxFileFromZipFile(infile, outfile, fmttype="auto", compression="auto",
|
|
|
5762
5776
|
fcontents.seek(0, 0)
|
|
5763
5777
|
cfcontents.seek(0, 0)
|
|
5764
5778
|
cfcontents = CompressOpenFileAlt(
|
|
5765
|
-
cfcontents, compressionuselist[ilmin], compressionlevel, formatspecs)
|
|
5779
|
+
cfcontents, compressionuselist[ilmin], compressionlevel, compressionuselist, formatspecs)
|
|
5766
5780
|
cfcontents.seek(0, 2)
|
|
5767
5781
|
ilcsize.append(cfcontents.tell())
|
|
5768
5782
|
cfcontents.close()
|
|
@@ -5774,7 +5788,7 @@ def PackFoxFileFromZipFile(infile, outfile, fmttype="auto", compression="auto",
|
|
|
5774
5788
|
shutil.copyfileobj(fcontents, cfcontents)
|
|
5775
5789
|
cfcontents.seek(0, 0)
|
|
5776
5790
|
cfcontents = CompressOpenFileAlt(
|
|
5777
|
-
cfcontents, curcompression, compressionlevel, formatspecs)
|
|
5791
|
+
cfcontents, curcompression, compressionlevel, compressionuselist, formatspecs)
|
|
5778
5792
|
cfcontents.seek(0, 2)
|
|
5779
5793
|
cfsize = cfcontents.tell()
|
|
5780
5794
|
if(ucfsize > cfsize):
|
|
@@ -5799,7 +5813,7 @@ def PackFoxFileFromZipFile(infile, outfile, fmttype="auto", compression="auto",
|
|
|
5799
5813
|
return False
|
|
5800
5814
|
if(outfile == "-" or outfile is None or hasattr(outfile, "read") or hasattr(outfile, "write")):
|
|
5801
5815
|
fp = CompressOpenFileAlt(
|
|
5802
|
-
fp, compression, compressionlevel, formatspecs)
|
|
5816
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
5803
5817
|
try:
|
|
5804
5818
|
fp.flush()
|
|
5805
5819
|
if(hasattr(os, "sync")):
|
|
@@ -5823,7 +5837,7 @@ def PackFoxFileFromZipFile(infile, outfile, fmttype="auto", compression="auto",
|
|
|
5823
5837
|
return outvar
|
|
5824
5838
|
elif((not hasattr(outfile, "read") and not hasattr(outfile, "write")) and re.findall("^(ftp|ftps|sftp):\\/\\/", outfile)):
|
|
5825
5839
|
fp = CompressOpenFileAlt(
|
|
5826
|
-
fp, compression, compressionlevel, formatspecs)
|
|
5840
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
5827
5841
|
fp.seek(0, 0)
|
|
5828
5842
|
upload_file_to_internet_file(fp, outfile)
|
|
5829
5843
|
if(returnfp):
|
|
@@ -5862,7 +5876,7 @@ if(rarfile_support):
|
|
|
5862
5876
|
outfile = RemoveWindowsPath(outfile)
|
|
5863
5877
|
if(not compression or compression == formatspecs['format_magic']):
|
|
5864
5878
|
compression = "auto"
|
|
5865
|
-
if(compression not in
|
|
5879
|
+
if(compression not in compressionuselist and compression is None):
|
|
5866
5880
|
compression = "auto"
|
|
5867
5881
|
if(verbose):
|
|
5868
5882
|
logging.basicConfig(format="%(message)s", stream=sys.stdout, level=logging.DEBUG)
|
|
@@ -6079,7 +6093,7 @@ if(rarfile_support):
|
|
|
6079
6093
|
fcontents.seek(0, 0)
|
|
6080
6094
|
cfcontents.seek(0, 0)
|
|
6081
6095
|
cfcontents = CompressOpenFileAlt(
|
|
6082
|
-
cfcontents, compressionuselist[ilmin], compressionlevel, formatspecs)
|
|
6096
|
+
cfcontents, compressionuselist[ilmin], compressionlevel, compressionuselist, formatspecs)
|
|
6083
6097
|
if(cfcontents):
|
|
6084
6098
|
cfcontents.seek(0, 2)
|
|
6085
6099
|
ilcsize.append(cfcontents.tell())
|
|
@@ -6094,12 +6108,12 @@ if(rarfile_support):
|
|
|
6094
6108
|
shutil.copyfileobj(fcontents, cfcontents)
|
|
6095
6109
|
cfcontents.seek(0, 0)
|
|
6096
6110
|
cfcontents = CompressOpenFileAlt(
|
|
6097
|
-
cfcontents, curcompression, compressionlevel, formatspecs)
|
|
6111
|
+
cfcontents, curcompression, compressionlevel, compressionuselist, formatspecs)
|
|
6098
6112
|
cfcontents.seek(0, 2)
|
|
6099
6113
|
cfsize = cfcontents.tell()
|
|
6100
6114
|
if(ucfsize > cfsize):
|
|
6101
6115
|
fcsize = format(int(cfsize), 'x').lower()
|
|
6102
|
-
fcompression =
|
|
6116
|
+
fcompression = curcompression
|
|
6103
6117
|
fcontents.close()
|
|
6104
6118
|
fcontents = cfcontents
|
|
6105
6119
|
if(fcompression == "none"):
|
|
@@ -6119,7 +6133,7 @@ if(rarfile_support):
|
|
|
6119
6133
|
return False
|
|
6120
6134
|
if(outfile == "-" or outfile is None or hasattr(outfile, "read") or hasattr(outfile, "write")):
|
|
6121
6135
|
fp = CompressOpenFileAlt(
|
|
6122
|
-
fp, compression, compressionlevel, formatspecs)
|
|
6136
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
6123
6137
|
try:
|
|
6124
6138
|
fp.flush()
|
|
6125
6139
|
if(hasattr(os, "sync")):
|
|
@@ -6143,7 +6157,7 @@ if(rarfile_support):
|
|
|
6143
6157
|
return outvar
|
|
6144
6158
|
elif((not hasattr(outfile, "read") and not hasattr(outfile, "write")) and re.findall("^(ftp|ftps|sftp):\\/\\/", outfile)):
|
|
6145
6159
|
fp = CompressOpenFileAlt(
|
|
6146
|
-
fp, compression, compressionlevel, formatspecs)
|
|
6160
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
6147
6161
|
fp.seek(0, 0)
|
|
6148
6162
|
upload_file_to_internet_file(fp, outfile)
|
|
6149
6163
|
if(returnfp):
|
|
@@ -6182,7 +6196,7 @@ if(py7zr_support):
|
|
|
6182
6196
|
outfile = RemoveWindowsPath(outfile)
|
|
6183
6197
|
if(not compression or compression == formatspecs['format_magic']):
|
|
6184
6198
|
compression = "auto"
|
|
6185
|
-
if(compression not in
|
|
6199
|
+
if(compression not in compressionuselist and compression is None):
|
|
6186
6200
|
compression = "auto"
|
|
6187
6201
|
if(verbose):
|
|
6188
6202
|
logging.basicConfig(format="%(message)s", stream=sys.stdout, level=logging.DEBUG)
|
|
@@ -6309,13 +6323,14 @@ if(py7zr_support):
|
|
|
6309
6323
|
fgname = ""
|
|
6310
6324
|
fcontents = BytesIO()
|
|
6311
6325
|
fcencoding = "UTF-8"
|
|
6312
|
-
|
|
6326
|
+
curcompression = "none"
|
|
6313
6327
|
if ftype == 0:
|
|
6314
6328
|
fcontents.write(file_content[member.filename].read())
|
|
6329
|
+
fsize = format(fcontents.tell(), 'x').lower()
|
|
6330
|
+
fcontents.seek(0, 0)
|
|
6315
6331
|
typechecktest = CheckCompressionType(fcontents, closefp=False)
|
|
6316
6332
|
fcontents.seek(0, 0)
|
|
6317
6333
|
fcencoding = GetFileEncoding(fcontents, False)
|
|
6318
|
-
fsize = format(fcontents.tell(), 'x').lower()
|
|
6319
6334
|
file_content[member.filename].close()
|
|
6320
6335
|
if(typechecktest is False and not compresswholefile):
|
|
6321
6336
|
fcontents.seek(0, 2)
|
|
@@ -6332,7 +6347,7 @@ if(py7zr_support):
|
|
|
6332
6347
|
fcontents.seek(0, 0)
|
|
6333
6348
|
cfcontents.seek(0, 0)
|
|
6334
6349
|
cfcontents = CompressOpenFileAlt(
|
|
6335
|
-
cfcontents, compressionuselist[ilmin], compressionlevel, formatspecs)
|
|
6350
|
+
cfcontents, compressionuselist[ilmin], compressionlevel, compressionuselist, formatspecs)
|
|
6336
6351
|
if(cfcontents):
|
|
6337
6352
|
cfcontents.seek(0, 2)
|
|
6338
6353
|
ilcsize.append(cfcontents.tell())
|
|
@@ -6347,7 +6362,7 @@ if(py7zr_support):
|
|
|
6347
6362
|
shutil.copyfileobj(fcontents, cfcontents)
|
|
6348
6363
|
cfcontents.seek(0, 0)
|
|
6349
6364
|
cfcontents = CompressOpenFileAlt(
|
|
6350
|
-
cfcontents, curcompression, compressionlevel, formatspecs)
|
|
6365
|
+
cfcontents, curcompression, compressionlevel, compressionuselist, formatspecs)
|
|
6351
6366
|
cfcontents.seek(0, 2)
|
|
6352
6367
|
cfsize = cfcontents.tell()
|
|
6353
6368
|
if(ucfsize > cfsize):
|
|
@@ -6372,7 +6387,7 @@ if(py7zr_support):
|
|
|
6372
6387
|
return False
|
|
6373
6388
|
if(outfile == "-" or outfile is None or hasattr(outfile, "read") or hasattr(outfile, "write")):
|
|
6374
6389
|
fp = CompressOpenFileAlt(
|
|
6375
|
-
fp, compression, compressionlevel, formatspecs)
|
|
6390
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
6376
6391
|
try:
|
|
6377
6392
|
fp.flush()
|
|
6378
6393
|
if(hasattr(os, "sync")):
|
|
@@ -6396,7 +6411,7 @@ if(py7zr_support):
|
|
|
6396
6411
|
return outvar
|
|
6397
6412
|
elif((not hasattr(outfile, "read") and not hasattr(outfile, "write")) and re.findall("^(ftp|ftps|sftp):\\/\\/", outfile)):
|
|
6398
6413
|
fp = CompressOpenFileAlt(
|
|
6399
|
-
fp, compression, compressionlevel, formatspecs)
|
|
6414
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
6400
6415
|
fp.seek(0, 0)
|
|
6401
6416
|
upload_file_to_internet_file(fp, outfile)
|
|
6402
6417
|
if(returnfp):
|
|
@@ -7593,11 +7608,11 @@ def FoxFileToArray(infile, fmttype="auto", seekstart=0, seekend=0, listonly=Fals
|
|
|
7593
7608
|
if(fcompresstype==formatspecs['format_magic']):
|
|
7594
7609
|
fcompresstype = ""
|
|
7595
7610
|
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': []}
|
|
7596
|
-
if(seekstart < 0
|
|
7611
|
+
if (seekstart < 0) or (seekstart > fnumfiles):
|
|
7597
7612
|
seekstart = 0
|
|
7598
|
-
if(seekend == 0 or seekend > fnumfiles
|
|
7613
|
+
if (seekend == 0) or (seekend > fnumfiles) or (seekend < seekstart):
|
|
7599
7614
|
seekend = fnumfiles
|
|
7600
|
-
elif(seekend < 0 and abs(seekend) <= fnumfiles and abs(seekend) >= seekstart):
|
|
7615
|
+
elif (seekend < 0) and (abs(seekend) <= fnumfiles) and (abs(seekend) >= seekstart):
|
|
7601
7616
|
seekend = fnumfiles - abs(seekend)
|
|
7602
7617
|
if(seekstart > 0):
|
|
7603
7618
|
il = 0
|
|
@@ -7888,7 +7903,7 @@ def MultipleFoxFileToArray(infile, fmttype="auto", seekstart=0, seekend=0, listo
|
|
|
7888
7903
|
infile = [infile]
|
|
7889
7904
|
outretval = {}
|
|
7890
7905
|
for curfname in infile:
|
|
7891
|
-
curretfile =
|
|
7906
|
+
curretfile[curfname] = ArchiveFileToArray(curfname, fmttype, seekstart, seekend, listonly, contentasfile, uncompress, skipchecksum, formatspecs, seektoend, returnfp)
|
|
7892
7907
|
return outretval
|
|
7893
7908
|
|
|
7894
7909
|
def MultipleFoxFilesToArray(infile, fmttype="auto", seekstart=0, seekend=0, listonly=False, contentasfile=True, uncompress=True, skipchecksum=False, formatspecs=__file_format_multi_dict__, seektoend=False, returnfp=False):
|
|
@@ -8072,7 +8087,7 @@ def RePackFoxFile(infile, outfile, fmttype="auto", compression="auto", compressw
|
|
|
8072
8087
|
outfile = RemoveWindowsPath(outfile)
|
|
8073
8088
|
if(not compression or compression == formatspecs['format_magic']):
|
|
8074
8089
|
compression = "auto"
|
|
8075
|
-
if(compression not in
|
|
8090
|
+
if(compression not in compressionuselist and compression is None):
|
|
8076
8091
|
compression = "auto"
|
|
8077
8092
|
if(verbose):
|
|
8078
8093
|
logging.basicConfig(format="%(message)s", stream=sys.stdout, level=logging.DEBUG)
|
|
@@ -8200,7 +8215,7 @@ def RePackFoxFile(infile, outfile, fmttype="auto", compression="auto", compressw
|
|
|
8200
8215
|
fcontents.seek(0, 0)
|
|
8201
8216
|
cfcontents.seek(0, 0)
|
|
8202
8217
|
cfcontents = CompressOpenFileAlt(
|
|
8203
|
-
cfcontents, compressionuselist[ilmin], compressionlevel, formatspecs)
|
|
8218
|
+
cfcontents, compressionuselist[ilmin], compressionlevel, compressionuselist, formatspecs)
|
|
8204
8219
|
if(cfcontents):
|
|
8205
8220
|
cfcontents.seek(0, 2)
|
|
8206
8221
|
ilcsize.append(cfcontents.tell())
|
|
@@ -8215,7 +8230,7 @@ def RePackFoxFile(infile, outfile, fmttype="auto", compression="auto", compressw
|
|
|
8215
8230
|
shutil.copyfileobj(fcontents, cfcontents)
|
|
8216
8231
|
cfcontents.seek(0, 0)
|
|
8217
8232
|
cfcontents = CompressOpenFileAlt(
|
|
8218
|
-
cfcontents, curcompression, compressionlevel, formatspecs)
|
|
8233
|
+
cfcontents, curcompression, compressionlevel, compressionuselist, formatspecs)
|
|
8219
8234
|
cfcontents.seek(0, 2)
|
|
8220
8235
|
cfsize = cfcontents.tell()
|
|
8221
8236
|
if(ucfsize > cfsize):
|
|
@@ -8295,7 +8310,7 @@ def RePackFoxFile(infile, outfile, fmttype="auto", compression="auto", compressw
|
|
|
8295
8310
|
return False
|
|
8296
8311
|
if(outfile == "-" or outfile is None or hasattr(outfile, "read") or hasattr(outfile, "write")):
|
|
8297
8312
|
fp = CompressOpenFileAlt(
|
|
8298
|
-
fp, compression, compressionlevel, formatspecs)
|
|
8313
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
8299
8314
|
try:
|
|
8300
8315
|
fp.flush()
|
|
8301
8316
|
if(hasattr(os, "sync")):
|
|
@@ -8319,7 +8334,7 @@ def RePackFoxFile(infile, outfile, fmttype="auto", compression="auto", compressw
|
|
|
8319
8334
|
return outvar
|
|
8320
8335
|
elif((not hasattr(outfile, "read") and not hasattr(outfile, "write")) and re.findall("^(ftp|ftps|sftp):\\/\\/", outfile)):
|
|
8321
8336
|
fp = CompressOpenFileAlt(
|
|
8322
|
-
fp, compression, compressionlevel, formatspecs)
|
|
8337
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
8323
8338
|
fp.seek(0, 0)
|
|
8324
8339
|
upload_file_to_internet_file(fp, outfile)
|
|
8325
8340
|
if(returnfp):
|
|
@@ -8728,7 +8743,7 @@ def TarFileListFiles(infile, verbose=False, returnfp=False):
|
|
|
8728
8743
|
if 'zstandard' in sys.modules:
|
|
8729
8744
|
infile = ZstdFile(fileobj=infile, mode="rb")
|
|
8730
8745
|
elif 'pyzstd' in sys.modules:
|
|
8731
|
-
|
|
8746
|
+
infile = pyzstd.zstdfile.ZstdFile(fileobj=infile, mode="rb")
|
|
8732
8747
|
tarfp = tarfile.open(fileobj=infile, mode="r")
|
|
8733
8748
|
else:
|
|
8734
8749
|
tarfp = tarfile.open(fileobj=infile, mode="r")
|
|
@@ -8740,7 +8755,7 @@ def TarFileListFiles(infile, verbose=False, returnfp=False):
|
|
|
8740
8755
|
if 'zstandard' in sys.modules:
|
|
8741
8756
|
infile = ZstdFile(fileobj=infile, mode="rb")
|
|
8742
8757
|
elif 'pyzstd' in sys.modules:
|
|
8743
|
-
|
|
8758
|
+
infile = pyzstd.zstdfile.ZstdFile(fileobj=infile, mode="rb")
|
|
8744
8759
|
tarfp = tarfile.open(fileobj=infile, mode="r")
|
|
8745
8760
|
else:
|
|
8746
8761
|
tarfp = tarfile.open(infile, "r")
|
|
@@ -9774,9 +9789,9 @@ def upload_file_to_internet_file(ifp, url):
|
|
|
9774
9789
|
return False
|
|
9775
9790
|
|
|
9776
9791
|
|
|
9777
|
-
def upload_file_to_internet_compress_file(ifp, url, compression="auto", compressionlevel=None, formatspecs=__file_format_dict__):
|
|
9792
|
+
def upload_file_to_internet_compress_file(ifp, url, compression="auto", compressionlevel=None, compressionuselist=compressionlistalt, formatspecs=__file_format_dict__):
|
|
9778
9793
|
fp = CompressOpenFileAlt(
|
|
9779
|
-
fp, compression, compressionlevel, formatspecs)
|
|
9794
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
9780
9795
|
if(not foxfileout):
|
|
9781
9796
|
return False
|
|
9782
9797
|
fp.seek(0, 0)
|
|
@@ -9800,9 +9815,9 @@ def upload_file_to_internet_string(ifp, url):
|
|
|
9800
9815
|
return False
|
|
9801
9816
|
|
|
9802
9817
|
|
|
9803
|
-
def upload_file_to_internet_compress_string(ifp, url, compression="auto", compressionlevel=None, formatspecs=__file_format_dict__):
|
|
9818
|
+
def upload_file_to_internet_compress_string(ifp, url, compression="auto", compressionlevel=None, compressionuselist=compressionlistalt, formatspecs=__file_format_dict__):
|
|
9804
9819
|
fp = CompressOpenFileAlt(
|
|
9805
|
-
BytesIO(ifp), compression, compressionlevel, formatspecs)
|
|
9820
|
+
BytesIO(ifp), compression, compressionlevel, compressionuselist, formatspecs)
|
|
9806
9821
|
if(not foxfileout):
|
|
9807
9822
|
return False
|
|
9808
9823
|
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
|