PyArchiveFile 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.
- {pyarchivefile-0.21.0 → pyarchivefile-0.21.2}/PKG-INFO +1 -1
- {pyarchivefile-0.21.0 → pyarchivefile-0.21.2}/PyArchiveFile.egg-info/PKG-INFO +1 -1
- {pyarchivefile-0.21.0 → pyarchivefile-0.21.2}/archivefile.py +6 -6
- {pyarchivefile-0.21.0 → pyarchivefile-0.21.2}/archiveneofile.py +3 -3
- {pyarchivefile-0.21.0 → pyarchivefile-0.21.2}/pyarchivefile.py +128 -113
- {pyarchivefile-0.21.0 → pyarchivefile-0.21.2}/pyproject.toml +1 -1
- {pyarchivefile-0.21.0 → pyarchivefile-0.21.2}/setup.py +1 -1
- {pyarchivefile-0.21.0 → pyarchivefile-0.21.2}/LICENSE +0 -0
- {pyarchivefile-0.21.0 → pyarchivefile-0.21.2}/PyArchiveFile.egg-info/SOURCES.txt +0 -0
- {pyarchivefile-0.21.0 → pyarchivefile-0.21.2}/PyArchiveFile.egg-info/dependency_links.txt +0 -0
- {pyarchivefile-0.21.0 → pyarchivefile-0.21.2}/PyArchiveFile.egg-info/top_level.txt +0 -0
- {pyarchivefile-0.21.0 → pyarchivefile-0.21.2}/PyArchiveFile.egg-info/zip-safe +0 -0
- {pyarchivefile-0.21.0 → pyarchivefile-0.21.2}/README.md +0 -0
- {pyarchivefile-0.21.0 → pyarchivefile-0.21.2}/neoarchivefile.py +0 -0
- {pyarchivefile-0.21.0 → pyarchivefile-0.21.2}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: PyArchiveFile
|
|
3
|
-
Version: 0.21.
|
|
3
|
+
Version: 0.21.2
|
|
4
4
|
Summary: A tar like file format name archivefile.
|
|
5
5
|
Home-page: https://github.com/GameMaker2k/PyArchiveFile
|
|
6
6
|
Download-URL: https://github.com/GameMaker2k/PyArchiveFile/archive/master.tar.gz
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: PyArchiveFile
|
|
3
|
-
Version: 0.21.
|
|
3
|
+
Version: 0.21.2
|
|
4
4
|
Summary: A tar like file format name archivefile.
|
|
5
5
|
Home-page: https://github.com/GameMaker2k/PyArchiveFile
|
|
6
6
|
Download-URL: https://github.com/GameMaker2k/PyArchiveFile/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: archivefile.py - Last Update: 8/
|
|
17
|
+
$FileInfo: archivefile.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 = pyarchivefile.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((pyarchivefile.IsNestedDict(fnamedict) and checkcompressfile in fnamedict) or (pyarchivefile.IsSingleDict(fnamedict) and checkcompressfile==fnamedict['format_magic'])):
|
|
176
176
|
tmpout = pyarchivefile.RePackArchiveFile(input_file, getargs.output, getargs.compression, getargs.wholefile, getargs.level, pyarchivefile.compressionlistalt, False, 0, 0, [getargs.checksum, getargs.checksum, getargs.checksum, getargs.checksum], getargs.skipchecksum, [], {}, fnamedict, getargs.verbose, False)
|
|
177
177
|
else:
|
|
178
178
|
tmpout = pyarchivefile.PackArchiveFileFromInFile(
|
|
@@ -185,7 +185,7 @@ if active_action:
|
|
|
185
185
|
if getargs.convert:
|
|
186
186
|
checkcompressfile = pyarchivefile.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((pyarchivefile.IsNestedDict(fnamedict) and checkcompressfile in fnamedict) or (pyarchivefile.IsSingleDict(fnamedict) and checkcompressfile==fnamedict['format_magic'])):
|
|
189
189
|
pyarchivefile.RePackArchiveFile(input_file, getargs.output, getargs.compression, getargs.wholefile, getargs.level, pyarchivefile.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 = pyarchivefile.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((pyarchivefile.IsNestedDict(fnamedict) and checkcompressfile in fnamedict) or (pyarchivefile.IsSingleDict(fnamedict) and checkcompressfile==fnamedict['format_magic'])):
|
|
204
204
|
tmpout = pyarchivefile.RePackArchiveFile(input_file, tempout, getargs.compression, getargs.wholefile, getargs.level, pyarchivefile.compressionlistalt, False, 0, 0, [getargs.checksum, getargs.checksum, getargs.checksum, getargs.checksum], getargs.skipchecksum, [], {}, fnamedict, False, False)
|
|
205
205
|
else:
|
|
206
206
|
tmpout = pyarchivefile.PackArchiveFileFromInFile(
|
|
@@ -214,7 +214,7 @@ if active_action:
|
|
|
214
214
|
if getargs.convert:
|
|
215
215
|
checkcompressfile = pyarchivefile.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((pyarchivefile.IsNestedDict(fnamedict) and checkcompressfile in fnamedict) or (pyarchivefile.IsSingleDict(fnamedict) and checkcompressfile==fnamedict['format_magic'])):
|
|
218
218
|
tmpout = pyarchivefile.ArchiveFileListFiles(input_file, "auto", 0, 0, getargs.skipchecksum, fnamedict, False, getargs.verbose, False, False)
|
|
219
219
|
else:
|
|
220
220
|
tmpout = pyarchivefile.InFileListFiles(input_file, getargs.verbose, fnamedict, False, False, False)
|
|
@@ -227,7 +227,7 @@ if active_action:
|
|
|
227
227
|
checkcompressfile = pyarchivefile.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((pyarchivefile.IsNestedDict(fnamedict) and checkcompressfile in fnamedict) or (pyarchivefile.IsSingleDict(fnamedict) and checkcompressfile==fnamedict['format_magic'])):
|
|
231
231
|
tmpout = pyarchivefile.RePackArchiveFile(input_file, tempout, getargs.compression, getargs.wholefile, getargs.level, pyarchivefile.compressionlistalt, False, 0, 0, [getargs.checksum, getargs.checksum, getargs.checksum, getargs.checksum], getargs.skipchecksum, [], {}, fnamedict, False, False, False)
|
|
232
232
|
else:
|
|
233
233
|
tmpout = pyarchivefile.PackArchiveFileFromInFile(
|
|
@@ -5,9 +5,9 @@ from __future__ import absolute_import, division, print_function, unicode_litera
|
|
|
5
5
|
import sys, os, io, argparse
|
|
6
6
|
|
|
7
7
|
try:
|
|
8
|
-
import
|
|
8
|
+
import pyarchivefile as P # core must provide *_neo functions
|
|
9
9
|
except Exception as e:
|
|
10
|
-
sys.stderr.write("Failed to import core module '
|
|
10
|
+
sys.stderr.write("Failed to import core module 'pyarchivefile': %s\n" % (e,))
|
|
11
11
|
sys.exit(2)
|
|
12
12
|
|
|
13
13
|
|
|
@@ -28,7 +28,7 @@ def main():
|
|
|
28
28
|
argv = _expand_combined_short_opts(sys.argv)
|
|
29
29
|
|
|
30
30
|
p = argparse.ArgumentParser(
|
|
31
|
-
description="PyNeoFile CLI (uses
|
|
31
|
+
description="PyNeoFile CLI (uses pyarchivefile core)")
|
|
32
32
|
g = p.add_mutually_exclusive_group(required=True)
|
|
33
33
|
g.add_argument("-l", "--list", action="store_true", help="List archive")
|
|
34
34
|
g.add_argument("-e", "--extract", action="store_true", help="Extract archive")
|
|
@@ -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: pyarchivefile.py - Last Update:
|
|
17
|
+
$FileInfo: pyarchivefile.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
|
|
@@ -379,12 +379,12 @@ __file_format_extension__ = __file_format_multi_dict__[__file_format_default__][
|
|
|
379
379
|
__file_format_dict__ = __file_format_multi_dict__[__file_format_default__]
|
|
380
380
|
__project__ = __program_name__
|
|
381
381
|
__project_url__ = "https://github.com/GameMaker2k/PyArchiveFile"
|
|
382
|
-
__version_info__ = (0, 21,
|
|
383
|
-
__version_date_info__ = (2025, 9,
|
|
382
|
+
__version_info__ = (0, 21, 2, "RC 1", 1)
|
|
383
|
+
__version_date_info__ = (2025, 9, 24, "RC 1", 1)
|
|
384
384
|
__version_date__ = str(__version_date_info__[0]) + "." + str(
|
|
385
385
|
__version_date_info__[1]).zfill(2) + "." + str(__version_date_info__[2]).zfill(2)
|
|
386
386
|
__revision__ = __version_info__[3]
|
|
387
|
-
__revision_id__ = "$Id:
|
|
387
|
+
__revision_id__ = "$Id: 63a1e32836c9ba97b9b17a2b226161059221667b $"
|
|
388
388
|
if(__version_info__[4] is not None):
|
|
389
389
|
__version_date_plusrc__ = __version_date__ + \
|
|
390
390
|
"-" + str(__version_date_info__[4])
|
|
@@ -1947,15 +1947,15 @@ def ReadFileHeaderDataWithContent(fp, listonly=False, uncompress=True, skipcheck
|
|
|
1947
1947
|
HeaderOut = ReadFileHeaderDataWoSize(fp, delimiter)
|
|
1948
1948
|
if(len(HeaderOut) == 0):
|
|
1949
1949
|
return False
|
|
1950
|
-
if(re.findall("^[.|/]", HeaderOut[
|
|
1951
|
-
fname = HeaderOut[
|
|
1950
|
+
if(re.findall("^[.|/]", HeaderOut[5])):
|
|
1951
|
+
fname = HeaderOut[5]
|
|
1952
1952
|
else:
|
|
1953
|
-
fname = "./"+HeaderOut[
|
|
1953
|
+
fname = "./"+HeaderOut[5]
|
|
1954
1954
|
fcs = HeaderOut[-2].lower()
|
|
1955
1955
|
fccs = HeaderOut[-1].lower()
|
|
1956
|
-
fsize = int(HeaderOut[
|
|
1957
|
-
fcompression = HeaderOut[
|
|
1958
|
-
fcsize = int(HeaderOut[
|
|
1956
|
+
fsize = int(HeaderOut[7], 16)
|
|
1957
|
+
fcompression = HeaderOut[14]
|
|
1958
|
+
fcsize = int(HeaderOut[15], 16)
|
|
1959
1959
|
fseeknextfile = HeaderOut[26]
|
|
1960
1960
|
fjsontype = HeaderOut[27]
|
|
1961
1961
|
fjsonlen = int(HeaderOut[28], 16)
|
|
@@ -2008,6 +2008,7 @@ def ReadFileHeaderDataWithContent(fp, listonly=False, uncompress=True, skipcheck
|
|
|
2008
2008
|
fcontents.seek(0, 0)
|
|
2009
2009
|
newfccs = GetFileChecksum(
|
|
2010
2010
|
fcontents.read(), HeaderOut[-3].lower(), False, formatspecs)
|
|
2011
|
+
fcontents.seek(0, 0)
|
|
2011
2012
|
if(fccs != newfccs and not skipchecksum and not listonly):
|
|
2012
2013
|
VerbosePrintOut("File Content Checksum Error with file " +
|
|
2013
2014
|
fname + " at offset " + str(fcontentstart))
|
|
@@ -2020,7 +2021,7 @@ def ReadFileHeaderDataWithContent(fp, listonly=False, uncompress=True, skipcheck
|
|
|
2020
2021
|
if(uncompress):
|
|
2021
2022
|
cfcontents = UncompressFileAlt(fcontents, formatspecs)
|
|
2022
2023
|
cfcontents.seek(0, 0)
|
|
2023
|
-
|
|
2024
|
+
fcontents = BytesIO()
|
|
2024
2025
|
shutil.copyfileobj(cfcontents, fcontents)
|
|
2025
2026
|
cfcontents.close()
|
|
2026
2027
|
fcontents.seek(0, 0)
|
|
@@ -2112,6 +2113,7 @@ def ReadFileHeaderDataWithContentToArray(fp, listonly=False, contentasfile=True,
|
|
|
2112
2113
|
fextrafieldslist = json.loads(fextrafieldslist[0])
|
|
2113
2114
|
except (binascii.Error, json.decoder.JSONDecodeError, UnicodeDecodeError):
|
|
2114
2115
|
pass
|
|
2116
|
+
fjstart = fp.tell()
|
|
2115
2117
|
if(fjsontype=="json"):
|
|
2116
2118
|
fjsoncontent = {}
|
|
2117
2119
|
fprejsoncontent = fp.read(fjsonsize).decode("UTF-8")
|
|
@@ -2139,11 +2141,11 @@ def ReadFileHeaderDataWithContentToArray(fp, listonly=False, contentasfile=True,
|
|
|
2139
2141
|
fjsoncontent = ReadFileHeaderData(flisttmp, fjsonlen, delimiter)
|
|
2140
2142
|
flisttmp.close()
|
|
2141
2143
|
fjsonrawcontent = fjsoncontent
|
|
2142
|
-
if(
|
|
2144
|
+
if(fjsonlen==1):
|
|
2143
2145
|
try:
|
|
2144
2146
|
fjsonrawcontent = base64.b64decode(fjsoncontent[0]).decode("UTF-8")
|
|
2145
2147
|
fjsoncontent = json.loads(base64.b64decode(fjsoncontent[0]).decode("UTF-8"))
|
|
2146
|
-
|
|
2148
|
+
fjsonlen = len(fjsoncontent)
|
|
2147
2149
|
except (binascii.Error, json.decoder.JSONDecodeError, UnicodeDecodeError):
|
|
2148
2150
|
try:
|
|
2149
2151
|
fjsonrawcontent = fjsoncontent[0]
|
|
@@ -2151,6 +2153,7 @@ def ReadFileHeaderDataWithContentToArray(fp, listonly=False, contentasfile=True,
|
|
|
2151
2153
|
except (binascii.Error, json.decoder.JSONDecodeError, UnicodeDecodeError):
|
|
2152
2154
|
pass
|
|
2153
2155
|
fp.seek(len(delimiter), 1)
|
|
2156
|
+
fjend = fp.tell() - 1
|
|
2154
2157
|
jsonfcs = GetFileChecksum(fprejsoncontent, fjsonchecksumtype, True, formatspecs)
|
|
2155
2158
|
if(jsonfcs != fjsonchecksum and not skipchecksum):
|
|
2156
2159
|
VerbosePrintOut("File JSON Data Checksum Error with file " +
|
|
@@ -2185,6 +2188,7 @@ def ReadFileHeaderDataWithContentToArray(fp, listonly=False, contentasfile=True,
|
|
|
2185
2188
|
fcontents.seek(0, 0)
|
|
2186
2189
|
newfccs = GetFileChecksum(
|
|
2187
2190
|
fcontents.read(), HeaderOut[-3].lower(), False, formatspecs)
|
|
2191
|
+
fcontents.seek(0, 0)
|
|
2188
2192
|
if(fccs != newfccs and not skipchecksum and not listonly):
|
|
2189
2193
|
VerbosePrintOut("File Content Checksum Error with file " +
|
|
2190
2194
|
fname + " at offset " + str(fcontentstart))
|
|
@@ -2226,7 +2230,7 @@ def ReadFileHeaderDataWithContentToArray(fp, listonly=False, contentasfile=True,
|
|
|
2226
2230
|
if(not contentasfile):
|
|
2227
2231
|
fcontents = fcontents.read()
|
|
2228
2232
|
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,
|
|
2229
|
-
'fdev': fdev, 'fminor': fdev_minor, 'fmajor': fdev_major, 'fseeknextfile': fseeknextfile, 'fheaderchecksumtype': HeaderOut[-4], 'fjsonchecksumtype':
|
|
2233
|
+
'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}
|
|
2230
2234
|
return outlist
|
|
2231
2235
|
|
|
2232
2236
|
|
|
@@ -2323,11 +2327,11 @@ def ReadFileHeaderDataWithContentToList(fp, listonly=False, contentasfile=False,
|
|
|
2323
2327
|
fjsoncontent = ReadFileHeaderData(flisttmp, fjsonlen, delimiter)
|
|
2324
2328
|
flisttmp.close()
|
|
2325
2329
|
fjsonrawcontent = fjsoncontent
|
|
2326
|
-
if(
|
|
2330
|
+
if(fjsonlen==1):
|
|
2327
2331
|
try:
|
|
2328
2332
|
fjsonrawcontent = base64.b64decode(fjsoncontent[0]).decode("UTF-8")
|
|
2329
2333
|
fjsoncontent = json.loads(base64.b64decode(fjsoncontent[0]).decode("UTF-8"))
|
|
2330
|
-
|
|
2334
|
+
fjsonlen = len(fjsoncontent)
|
|
2331
2335
|
except (binascii.Error, json.decoder.JSONDecodeError, UnicodeDecodeError):
|
|
2332
2336
|
try:
|
|
2333
2337
|
fjsonrawcontent = fjsoncontent[0]
|
|
@@ -2537,11 +2541,11 @@ def ReadFileDataWithContentToArray(fp, seekstart=0, seekend=0, listonly=False, c
|
|
|
2537
2541
|
formversions = re.search('(.*?)(\\d+)', formstring).groups()
|
|
2538
2542
|
fcompresstype = ""
|
|
2539
2543
|
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': []}
|
|
2540
|
-
if(seekstart < 0
|
|
2544
|
+
if (seekstart < 0) or (seekstart > fnumfiles):
|
|
2541
2545
|
seekstart = 0
|
|
2542
|
-
if(seekend == 0 or seekend > fnumfiles
|
|
2546
|
+
if (seekend == 0) or (seekend > fnumfiles) or (seekend < seekstart):
|
|
2543
2547
|
seekend = fnumfiles
|
|
2544
|
-
elif(seekend < 0 and abs(seekend) <= fnumfiles and abs(seekend) >= seekstart):
|
|
2548
|
+
elif (seekend < 0) and (abs(seekend) <= fnumfiles) and (abs(seekend) >= seekstart):
|
|
2545
2549
|
seekend = fnumfiles - abs(seekend)
|
|
2546
2550
|
if(seekstart > 0):
|
|
2547
2551
|
il = 0
|
|
@@ -2552,14 +2556,18 @@ def ReadFileDataWithContentToArray(fp, seekstart=0, seekend=0, listonly=False, c
|
|
|
2552
2556
|
if(len(preheaderdata) == 0):
|
|
2553
2557
|
break
|
|
2554
2558
|
prefsize = int(preheaderdata[5], 16)
|
|
2559
|
+
if(re.findall("^[.|/]", preheaderdata[5])):
|
|
2560
|
+
prefname = preheaderdata[5]
|
|
2561
|
+
else:
|
|
2562
|
+
prefname = "./"+preheaderdata[5]
|
|
2555
2563
|
prefseeknextfile = preheaderdata[26]
|
|
2556
2564
|
prefjsonlen = int(preheaderdata[28], 16)
|
|
2557
2565
|
prefjsonsize = int(preheaderdata[29], 16)
|
|
2558
2566
|
prefjsonchecksumtype = preheaderdata[30]
|
|
2559
2567
|
prefjsonchecksum = preheaderdata[31]
|
|
2560
|
-
|
|
2568
|
+
prejsoncontent = fp.read(prefjsonsize).decode("UTF-8")
|
|
2561
2569
|
fp.seek(len(delimiter), 1)
|
|
2562
|
-
prejsonfcs = GetFileChecksum(
|
|
2570
|
+
prejsonfcs = GetFileChecksum(prejsoncontent, prefjsonchecksumtype, True, formatspecs)
|
|
2563
2571
|
if(prejsonfcs != prefjsonchecksum and not skipchecksum):
|
|
2564
2572
|
VerbosePrintOut("File JSON Data Checksum Error with file " +
|
|
2565
2573
|
prefname + " at offset " + str(prefhstart))
|
|
@@ -2569,7 +2577,7 @@ def ReadFileDataWithContentToArray(fp, seekstart=0, seekend=0, listonly=False, c
|
|
|
2569
2577
|
preheaderdata[:-2], preheaderdata[-4].lower(), True, formatspecs)
|
|
2570
2578
|
prefcs = preheaderdata[-2]
|
|
2571
2579
|
if(prefcs != prenewfcs and not skipchecksum):
|
|
2572
|
-
|
|
2580
|
+
VerbosePrintOut("File Header Checksum Error with file " +
|
|
2573
2581
|
prefname + " at offset " + str(prefhstart))
|
|
2574
2582
|
VerbosePrintOut("'" + prefcs + "' != " +
|
|
2575
2583
|
"'" + prenewfcs + "'")
|
|
@@ -2692,11 +2700,11 @@ def ReadFileDataWithContentToList(fp, seekstart=0, seekend=0, listonly=False, co
|
|
|
2692
2700
|
return False
|
|
2693
2701
|
formversions = re.search('(.*?)(\\d+)', formstring).groups()
|
|
2694
2702
|
outlist = []
|
|
2695
|
-
if(seekstart < 0
|
|
2703
|
+
if (seekstart < 0) or (seekstart > fnumfiles):
|
|
2696
2704
|
seekstart = 0
|
|
2697
|
-
if(seekend == 0 or seekend > fnumfiles
|
|
2705
|
+
if (seekend == 0) or (seekend > fnumfiles) or (seekend < seekstart):
|
|
2698
2706
|
seekend = fnumfiles
|
|
2699
|
-
elif(seekend < 0 and abs(seekend) <= fnumfiles and abs(seekend) >= seekstart):
|
|
2707
|
+
elif (seekend < 0) and (abs(seekend) <= fnumfiles) and (abs(seekend) >= seekstart):
|
|
2700
2708
|
seekend = fnumfiles - abs(seekend)
|
|
2701
2709
|
if(seekstart > 0):
|
|
2702
2710
|
il = 0
|
|
@@ -2711,16 +2719,20 @@ def ReadFileDataWithContentToList(fp, seekstart=0, seekend=0, listonly=False, co
|
|
|
2711
2719
|
if(len(preheaderdata) == 0):
|
|
2712
2720
|
break
|
|
2713
2721
|
prefsize = int(preheaderdata[5], 16)
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2722
|
+
if(re.findall("^[.|/]", preheaderdata[5])):
|
|
2723
|
+
prefname = preheaderdata[5]
|
|
2724
|
+
else:
|
|
2725
|
+
prefname = "./"+preheaderdata[5]
|
|
2726
|
+
prefcompression = preheaderdata[14]
|
|
2727
|
+
prefcsize = int(preheaderdata[15], 16)
|
|
2728
|
+
prefseeknextfile = preheaderdata[26]
|
|
2717
2729
|
prefjsonlen = int(preheaderdata[28], 16)
|
|
2718
2730
|
prefjsonsize = int(preheaderdata[29], 16)
|
|
2719
2731
|
prefjsonchecksumtype = preheaderdata[30]
|
|
2720
2732
|
prefjsonchecksum = preheaderdata[31]
|
|
2721
2733
|
prefprejsoncontent = fp.read(prefjsonsize).decode("UTF-8")
|
|
2722
2734
|
fp.seek(len(delimiter), 1)
|
|
2723
|
-
prejsonfcs = GetFileChecksum(
|
|
2735
|
+
prejsonfcs = GetFileChecksum(prefprejsoncontent, prefjsonchecksumtype, True, formatspecs)
|
|
2724
2736
|
if(prejsonfcs != prefjsonchecksum and not skipchecksum):
|
|
2725
2737
|
VerbosePrintOut("File JSON Data Checksum Error with file " +
|
|
2726
2738
|
prefname + " at offset " + str(prefhstart))
|
|
@@ -2807,13 +2819,13 @@ def ReadInFileWithContentToArray(infile, fmttype="auto", seekstart=0, seekend=0,
|
|
|
2807
2819
|
fp = UncompressFileAlt(fp, formatspecs)
|
|
2808
2820
|
checkcompressfile = CheckCompressionSubType(fp, formatspecs, True)
|
|
2809
2821
|
if(checkcompressfile == "tarfile" and TarFileCheck(infile)):
|
|
2810
|
-
return TarFileToArray(infile, seekstart, seekend, listonly, contentasfile, skipchecksum, formatspecs, seektoend,
|
|
2822
|
+
return TarFileToArray(infile, seekstart, seekend, listonly, contentasfile, skipchecksum, formatspecs, seektoend, True)
|
|
2811
2823
|
elif(checkcompressfile == "zipfile" and zipfile.is_zipfile(infile)):
|
|
2812
|
-
return ZipFileToArray(infile, seekstart, seekend, listonly, contentasfile, skipchecksum, formatspecs, seektoend,
|
|
2824
|
+
return ZipFileToArray(infile, seekstart, seekend, listonly, contentasfile, skipchecksum, formatspecs, seektoend, True)
|
|
2813
2825
|
elif(rarfile_support and checkcompressfile == "rarfile" and (rarfile.is_rarfile(infile) or rarfile.is_rarfile_sfx(infile))):
|
|
2814
|
-
return RarFileToArray(infile, seekstart, seekend, listonly, contentasfile, skipchecksum, formatspecs, seektoend,
|
|
2826
|
+
return RarFileToArray(infile, seekstart, seekend, listonly, contentasfile, skipchecksum, formatspecs, seektoend, True)
|
|
2815
2827
|
elif(py7zr_support and checkcompressfile == "7zipfile" and py7zr.is_7zfile(infile)):
|
|
2816
|
-
return SevenZipFileToArray(infile, seekstart, seekend, listonly, contentasfile, skipchecksum, formatspecs, seektoend,
|
|
2828
|
+
return SevenZipFileToArray(infile, seekstart, seekend, listonly, contentasfile, skipchecksum, formatspecs, seektoend, True)
|
|
2817
2829
|
elif(IsSingleDict(formatspecs) and checkcompressfile != formatspecs['format_magic']):
|
|
2818
2830
|
return False
|
|
2819
2831
|
elif(IsNestedDict(formatspecs) and checkcompressfile not in formatspecs):
|
|
@@ -2923,13 +2935,13 @@ def ReadInFileWithContentToArray(infile, fmttype="auto", seekstart=0, seekend=0,
|
|
|
2923
2935
|
if(IsNestedDict(formatspecs) and checkcompressfile in formatspecs):
|
|
2924
2936
|
formatspecs = formatspecs[checkcompressfile]
|
|
2925
2937
|
if(checkcompressfile == "tarfile" and TarFileCheck(infile)):
|
|
2926
|
-
return TarFileToArray(infile, seekstart, seekend, listonly, skipchecksum, formatspecs, seektoend,
|
|
2938
|
+
return TarFileToArray(infile, seekstart, seekend, listonly, skipchecksum, formatspecs, seektoend, True)
|
|
2927
2939
|
elif(checkcompressfile == "zipfile" and zipfile.is_zipfile(infile)):
|
|
2928
|
-
return ZipFileToArray(infile, seekstart, seekend, listonly, skipchecksum, formatspecs, seektoend,
|
|
2940
|
+
return ZipFileToArray(infile, seekstart, seekend, listonly, skipchecksum, formatspecs, seektoend, True)
|
|
2929
2941
|
elif(rarfile_support and checkcompressfile == "rarfile" and (rarfile.is_rarfile(infile) or rarfile.is_rarfile_sfx(infile))):
|
|
2930
|
-
return RarFileToArray(infile, seekstart, seekend, listonly, skipchecksum, formatspecs, seektoend,
|
|
2942
|
+
return RarFileToArray(infile, seekstart, seekend, listonly, skipchecksum, formatspecs, seektoend, True)
|
|
2931
2943
|
elif(py7zr_support and checkcompressfile == "7zipfile" and py7zr.is_7zfile(infile)):
|
|
2932
|
-
return SevenZipFileToArray(infile, seekstart, seekend, listonly, skipchecksum, formatspecs, seektoend,
|
|
2944
|
+
return SevenZipFileToArray(infile, seekstart, seekend, listonly, skipchecksum, formatspecs, seektoend, True)
|
|
2933
2945
|
elif(IsSingleDict(formatspecs) and checkcompressfile != formatspecs['format_magic']):
|
|
2934
2946
|
return False
|
|
2935
2947
|
elif(IsNestedDict(formatspecs) and checkcompressfile not in formatspecs):
|
|
@@ -2968,7 +2980,7 @@ def ReadInMultipleFileWithContentToArray(infile, fmttype="auto", seekstart=0, se
|
|
|
2968
2980
|
infile = [infile]
|
|
2969
2981
|
outretval = {}
|
|
2970
2982
|
for curfname in infile:
|
|
2971
|
-
|
|
2983
|
+
outretval[curfname] = ReadInFileWithContentToArray(curfname, fmttype, seekstart, seekend, listonly, contentasfile, uncompress, skipchecksum, formatspecs, seektoend)
|
|
2972
2984
|
return outretval
|
|
2973
2985
|
|
|
2974
2986
|
def ReadInMultipleFilesWithContentToArray(infile, fmttype="auto", seekstart=0, seekend=0, listonly=False, contentasfile=True, uncompress=True, skipchecksum=False, formatspecs=__file_format_multi_dict__, seektoend=False):
|
|
@@ -2995,13 +3007,13 @@ def ReadInFileWithContentToList(infile, fmttype="auto", seekstart=0, seekend=0,
|
|
|
2995
3007
|
fp = UncompressFileAlt(fp, formatspecs)
|
|
2996
3008
|
checkcompressfile = CheckCompressionSubType(fp, formatspecs, True)
|
|
2997
3009
|
if(checkcompressfile == "tarfile" and TarFileCheck(infile)):
|
|
2998
|
-
return TarFileToArray(infile, seekstart, seekend, listonly, contentasfile, skipchecksum, formatspecs, seektoend,
|
|
3010
|
+
return TarFileToArray(infile, seekstart, seekend, listonly, contentasfile, skipchecksum, formatspecs, seektoend, True)
|
|
2999
3011
|
elif(checkcompressfile == "zipfile" and zipfile.is_zipfile(infile)):
|
|
3000
|
-
return ZipFileToArray(infile, seekstart, seekend, listonly, contentasfile, skipchecksum, formatspecs, seektoend,
|
|
3012
|
+
return ZipFileToArray(infile, seekstart, seekend, listonly, contentasfile, skipchecksum, formatspecs, seektoend, True)
|
|
3001
3013
|
elif(rarfile_support and checkcompressfile == "rarfile" and (rarfile.is_rarfile(infile) or rarfile.is_rarfile_sfx(infile))):
|
|
3002
|
-
return RarFileToArray(infile, seekstart, seekend, listonly, contentasfile, skipchecksum, formatspecs, seektoend,
|
|
3014
|
+
return RarFileToArray(infile, seekstart, seekend, listonly, contentasfile, skipchecksum, formatspecs, seektoend, True)
|
|
3003
3015
|
elif(py7zr_support and checkcompressfile == "7zipfile" and py7zr.is_7zfile(infile)):
|
|
3004
|
-
return SevenZipFileToArray(infile, seekstart, seekend, listonly, contentasfile, skipchecksum, formatspecs, seektoend,
|
|
3016
|
+
return SevenZipFileToArray(infile, seekstart, seekend, listonly, contentasfile, skipchecksum, formatspecs, seektoend, True)
|
|
3005
3017
|
elif(IsSingleDict(formatspecs) and checkcompressfile != formatspecs['format_magic']):
|
|
3006
3018
|
return False
|
|
3007
3019
|
elif(IsNestedDict(formatspecs) and checkcompressfile not in formatspecs):
|
|
@@ -3111,13 +3123,13 @@ def ReadInFileWithContentToList(infile, fmttype="auto", seekstart=0, seekend=0,
|
|
|
3111
3123
|
if(IsNestedDict(formatspecs) and checkcompressfile in formatspecs):
|
|
3112
3124
|
formatspecs = formatspecs[checkcompressfile]
|
|
3113
3125
|
if(checkcompressfile == "tarfile" and TarFileCheck(infile)):
|
|
3114
|
-
return TarFileToArray(infile, seekstart, seekend, listonly, skipchecksum, formatspecs, seektoend,
|
|
3126
|
+
return TarFileToArray(infile, seekstart, seekend, listonly, skipchecksum, formatspecs, seektoend, True)
|
|
3115
3127
|
elif(checkcompressfile == "zipfile" and zipfile.is_zipfile(infile)):
|
|
3116
|
-
return ZipFileToArray(infile, seekstart, seekend, listonly, skipchecksum, formatspecs, seektoend,
|
|
3128
|
+
return ZipFileToArray(infile, seekstart, seekend, listonly, skipchecksum, formatspecs, seektoend, True)
|
|
3117
3129
|
elif(rarfile_support and checkcompressfile == "rarfile" and (rarfile.is_rarfile(infile) or rarfile.is_rarfile_sfx(infile))):
|
|
3118
|
-
return RarFileToArray(infile, seekstart, seekend, listonly, skipchecksum, formatspecs, seektoend,
|
|
3130
|
+
return RarFileToArray(infile, seekstart, seekend, listonly, skipchecksum, formatspecs, seektoend, True)
|
|
3119
3131
|
elif(py7zr_support and checkcompressfile == "7zipfile" and py7zr.is_7zfile(infile)):
|
|
3120
|
-
return SevenZipFileToArray(infile, seekstart, seekend, listonly, skipchecksum, formatspecs, seektoend,
|
|
3132
|
+
return SevenZipFileToArray(infile, seekstart, seekend, listonly, skipchecksum, formatspecs, seektoend, True)
|
|
3121
3133
|
elif(IsSingleDict(formatspecs) and checkcompressfile != formatspecs['format_magic']):
|
|
3122
3134
|
return False
|
|
3123
3135
|
elif(IsNestedDict(formatspecs) and checkcompressfile not in formatspecs):
|
|
@@ -3156,7 +3168,7 @@ def ReadInMultipleFileWithContentToList(infile, fmttype="auto", seekstart=0, see
|
|
|
3156
3168
|
infile = [infile]
|
|
3157
3169
|
outretval = {}
|
|
3158
3170
|
for curfname in infile:
|
|
3159
|
-
curretfile =
|
|
3171
|
+
curretfile[curfname] = ReadInFileWithContentToList(curfname, fmttype, seekstart, seekend, listonly, contentasfile, uncompress, skipchecksum, formatspecs, seektoend)
|
|
3160
3172
|
return outretval
|
|
3161
3173
|
|
|
3162
3174
|
def ReadInMultipleFilesWithContentToList(infile, fmttype="auto", seekstart=0, seekend=0, listonly=False, contentasfile=True, uncompress=True, skipchecksum=False, formatspecs=__file_format_multi_dict__, seektoend=False):
|
|
@@ -3201,7 +3213,7 @@ def AppendFileHeader(fp, numfiles, fencoding, extradata=[], checksumtype="crc32"
|
|
|
3201
3213
|
tmpoutlist = []
|
|
3202
3214
|
tmpoutlist.append(extrasizelen)
|
|
3203
3215
|
tmpoutlist.append(extrafields)
|
|
3204
|
-
fnumfiles = format(
|
|
3216
|
+
fnumfiles = format(numfiles, 'x').lower()
|
|
3205
3217
|
tmpoutlen = 3 + len(tmpoutlist) + len(extradata) + 2
|
|
3206
3218
|
tmpoutlenhex = format(tmpoutlen, 'x').lower()
|
|
3207
3219
|
fnumfilesa = AppendNullBytes(
|
|
@@ -3259,7 +3271,7 @@ def MakeEmptyArchiveFilePointer(fp, fmttype=__file_format_default__, checksumtyp
|
|
|
3259
3271
|
return MakeEmptyFilePointer(fp, fmttype, checksumtype, formatspecs)
|
|
3260
3272
|
|
|
3261
3273
|
|
|
3262
|
-
def MakeEmptyFile(outfile, fmttype="auto", compression="auto", compresswholefile=True, compressionlevel=None, checksumtype="crc32", formatspecs=__file_format_multi_dict__, returnfp=False):
|
|
3274
|
+
def MakeEmptyFile(outfile, fmttype="auto", compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, checksumtype="crc32", formatspecs=__file_format_multi_dict__, returnfp=False):
|
|
3263
3275
|
if(IsNestedDict(formatspecs) and fmttype=="auto" and
|
|
3264
3276
|
(outfile != "-" and outfile is not None and not hasattr(outfile, "read") and not hasattr(outfile, "write"))):
|
|
3265
3277
|
get_in_ext = os.path.splitext(outfile)
|
|
@@ -3303,7 +3315,7 @@ def MakeEmptyFile(outfile, fmttype="auto", compression="auto", compresswholefile
|
|
|
3303
3315
|
AppendFileHeader(fp, 0, "UTF-8", [], checksumtype, formatspecs)
|
|
3304
3316
|
if(outfile == "-" or outfile is None or hasattr(outfile, "read") or hasattr(outfile, "write")):
|
|
3305
3317
|
fp = CompressOpenFileAlt(
|
|
3306
|
-
fp, compression, compressionlevel, formatspecs)
|
|
3318
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
3307
3319
|
try:
|
|
3308
3320
|
fp.flush()
|
|
3309
3321
|
if(hasattr(os, "sync")):
|
|
@@ -3327,7 +3339,7 @@ def MakeEmptyFile(outfile, fmttype="auto", compression="auto", compresswholefile
|
|
|
3327
3339
|
return outvar
|
|
3328
3340
|
elif(re.findall("^(ftp|ftps|sftp):\\/\\/", outfile)):
|
|
3329
3341
|
fp = CompressOpenFileAlt(
|
|
3330
|
-
fp, compression, compressionlevel, formatspecs)
|
|
3342
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
3331
3343
|
fp.seek(0, 0)
|
|
3332
3344
|
upload_file_to_internet_file(fp, outfile)
|
|
3333
3345
|
if(returnfp):
|
|
@@ -3338,8 +3350,8 @@ def MakeEmptyFile(outfile, fmttype="auto", compression="auto", compresswholefile
|
|
|
3338
3350
|
return True
|
|
3339
3351
|
|
|
3340
3352
|
|
|
3341
|
-
def MakeEmptyArchiveFile(outfile, compression="auto", compresswholefile=True, compressionlevel=None, checksumtype="crc32", formatspecs=__file_format_dict__, returnfp=False):
|
|
3342
|
-
return MakeEmptyFile(outfile, compression, compresswholefile, compressionlevel, checksumtype, formatspecs, returnfp)
|
|
3353
|
+
def MakeEmptyArchiveFile(outfile, compression="auto", compresswholefile=True, compressionlevel=None, compressionuselist=compressionlistalt, checksumtype="crc32", formatspecs=__file_format_dict__, returnfp=False):
|
|
3354
|
+
return MakeEmptyFile(outfile, "auto", compression, compresswholefile, compressionlevel, compressionuselist, checksumtype, formatspecs, returnfp)
|
|
3343
3355
|
|
|
3344
3356
|
|
|
3345
3357
|
def AppendFileHeaderWithContent(fp, filevalues=[], extradata=[], jsondata={}, filecontent="", checksumtype=["crc32", "crc32", "crc32"], formatspecs=__file_format_dict__):
|
|
@@ -3438,6 +3450,7 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, filevalues=[], ext
|
|
|
3438
3450
|
if(verbose):
|
|
3439
3451
|
logging.basicConfig(format="%(message)s",
|
|
3440
3452
|
stream=sys.stdout, level=logging.DEBUG)
|
|
3453
|
+
infilelist = []
|
|
3441
3454
|
if(infiles == "-"):
|
|
3442
3455
|
for line in sys.stdin:
|
|
3443
3456
|
infilelist.append(line.strip())
|
|
@@ -3478,7 +3491,7 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, filevalues=[], ext
|
|
|
3478
3491
|
inodetoforminode = {}
|
|
3479
3492
|
numfiles = int(len(GetDirList))
|
|
3480
3493
|
fnumfiles = format(numfiles, 'x').lower()
|
|
3481
|
-
AppendFileHeader(fp,
|
|
3494
|
+
AppendFileHeader(fp, numfiles, "UTF-8", [], checksumtype[0], formatspecs)
|
|
3482
3495
|
FullSizeFilesAlt = 0
|
|
3483
3496
|
for curfname in GetDirList:
|
|
3484
3497
|
fencoding = "UTF-8"
|
|
@@ -3576,7 +3589,7 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, filevalues=[], ext
|
|
|
3576
3589
|
elif ftype in data_types:
|
|
3577
3590
|
fsize = format(int(fstatinfo.st_size), 'x').lower()
|
|
3578
3591
|
else:
|
|
3579
|
-
fsize = format(int(fstatinfo.st_size)).lower()
|
|
3592
|
+
fsize = format(int(fstatinfo.st_size), 'x').lower()
|
|
3580
3593
|
fatime = format(int(fstatinfo.st_atime), 'x').lower()
|
|
3581
3594
|
fmtime = format(int(fstatinfo.st_mtime), 'x').lower()
|
|
3582
3595
|
fctime = format(int(fstatinfo.st_ctime), 'x').lower()
|
|
@@ -3646,7 +3659,7 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, filevalues=[], ext
|
|
|
3646
3659
|
fcontents.seek(0, 0)
|
|
3647
3660
|
cfcontents.seek(0, 0)
|
|
3648
3661
|
cfcontents = CompressOpenFileAlt(
|
|
3649
|
-
cfcontents, compressionuselist[ilmin], compressionlevel, formatspecs)
|
|
3662
|
+
cfcontents, compressionuselist[ilmin], compressionlevel, compressionuselist, formatspecs)
|
|
3650
3663
|
if(cfcontents):
|
|
3651
3664
|
cfcontents.seek(0, 2)
|
|
3652
3665
|
ilcsize.append(cfcontents.tell())
|
|
@@ -3661,7 +3674,7 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, filevalues=[], ext
|
|
|
3661
3674
|
shutil.copyfileobj(fcontents, cfcontents)
|
|
3662
3675
|
cfcontents.seek(0, 0)
|
|
3663
3676
|
cfcontents = CompressOpenFileAlt(
|
|
3664
|
-
cfcontents, curcompression, compressionlevel, formatspecs)
|
|
3677
|
+
cfcontents, curcompression, compressionlevel, compressionuselist, formatspecs)
|
|
3665
3678
|
cfcontents.seek(0, 2)
|
|
3666
3679
|
cfsize = cfcontents.tell()
|
|
3667
3680
|
if(ucfsize > cfsize):
|
|
@@ -3693,7 +3706,7 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, filevalues=[], ext
|
|
|
3693
3706
|
fcontents.seek(0, 0)
|
|
3694
3707
|
cfcontents.seek(0, 0)
|
|
3695
3708
|
cfcontents = CompressOpenFileAlt(
|
|
3696
|
-
cfcontents, compressionuselist[ilmin], compressionlevel, formatspecs)
|
|
3709
|
+
cfcontents, compressionuselist[ilmin], compressionlevel, compressionuselist, formatspecs)
|
|
3697
3710
|
if(cfcontents):
|
|
3698
3711
|
cfcontents.seek(0, 2)
|
|
3699
3712
|
ilcsize.append(cfcontents.tell())
|
|
@@ -3708,7 +3721,7 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, filevalues=[], ext
|
|
|
3708
3721
|
shutil.copyfileobj(fcontents, cfcontents)
|
|
3709
3722
|
cfcontents.seek(0, 0)
|
|
3710
3723
|
cfcontents = CompressOpenFileAlt(
|
|
3711
|
-
cfcontents, curcompression, compressionlevel, formatspecs)
|
|
3724
|
+
cfcontents, curcompression, compressionlevel, compressionuselist, formatspecs)
|
|
3712
3725
|
cfcontents.seek(0, 2)
|
|
3713
3726
|
cfsize = cfcontents.tell()
|
|
3714
3727
|
if(ucfsize > cfsize):
|
|
@@ -3750,7 +3763,7 @@ def AppendListsWithContent(inlist, fp, dirlistfromtxt=False, filevalues=[], extr
|
|
|
3750
3763
|
inodetoforminode = {}
|
|
3751
3764
|
numfiles = int(len(GetDirList))
|
|
3752
3765
|
fnumfiles = format(numfiles, 'x').lower()
|
|
3753
|
-
AppendFileHeader(fp,
|
|
3766
|
+
AppendFileHeader(fp, numfiles, "UTF-8", [], checksumtype[0], formatspecs)
|
|
3754
3767
|
for curfname in GetDirList:
|
|
3755
3768
|
ftype = format(curfname[0], 'x').lower()
|
|
3756
3769
|
fencoding = curfname[1]
|
|
@@ -3852,7 +3865,7 @@ def AppendFilesWithContentToOutFile(infiles, outfile, dirlistfromtxt=False, fmtt
|
|
|
3852
3865
|
compresswholefile, compressionlevel, compressionuselist, followlink, checksumtype, formatspecs, verbose)
|
|
3853
3866
|
if(outfile == "-" or outfile is None or hasattr(outfile, "read") or hasattr(outfile, "write")):
|
|
3854
3867
|
fp = CompressOpenFileAlt(
|
|
3855
|
-
fp, compression, compressionlevel, formatspecs)
|
|
3868
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
3856
3869
|
try:
|
|
3857
3870
|
fp.flush()
|
|
3858
3871
|
if(hasattr(os, "sync")):
|
|
@@ -3876,7 +3889,7 @@ def AppendFilesWithContentToOutFile(infiles, outfile, dirlistfromtxt=False, fmtt
|
|
|
3876
3889
|
return outvar
|
|
3877
3890
|
elif((not hasattr(outfile, "read") and not hasattr(outfile, "write")) and re.findall("^(ftp|ftps|sftp):\\/\\/", outfile)):
|
|
3878
3891
|
fp = CompressOpenFileAlt(
|
|
3879
|
-
fp, compression, compressionlevel, formatspecs)
|
|
3892
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
3880
3893
|
fp.seek(0, 0)
|
|
3881
3894
|
upload_file_to_internet_file(fp, outfile)
|
|
3882
3895
|
if(returnfp):
|
|
@@ -3932,7 +3945,7 @@ def AppendListsWithContentToOutFile(inlist, outfile, dirlistfromtxt=False, fmtty
|
|
|
3932
3945
|
compresswholefile, compressionlevel, followlink, checksumtype, formatspecs, verbose)
|
|
3933
3946
|
if(outfile == "-" or outfile is None or hasattr(outfile, "read") or hasattr(outfile, "write")):
|
|
3934
3947
|
fp = CompressOpenFileAlt(
|
|
3935
|
-
fp, compression, compressionlevel, formatspecs)
|
|
3948
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
3936
3949
|
try:
|
|
3937
3950
|
fp.flush()
|
|
3938
3951
|
if(hasattr(os, "sync")):
|
|
@@ -3956,7 +3969,7 @@ def AppendListsWithContentToOutFile(inlist, outfile, dirlistfromtxt=False, fmtty
|
|
|
3956
3969
|
return outvar
|
|
3957
3970
|
elif((not hasattr(outfile, "read") and not hasattr(outfile, "write")) and re.findall("^(ftp|ftps|sftp):\\/\\/", outfile)):
|
|
3958
3971
|
fp = CompressOpenFileAlt(
|
|
3959
|
-
fp, compression, compressionlevel, formatspecs)
|
|
3972
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
3960
3973
|
fp.seek(0, 0)
|
|
3961
3974
|
upload_file_to_internet_file(fp, outfile)
|
|
3962
3975
|
if(returnfp):
|
|
@@ -4647,13 +4660,13 @@ def UncompressBytesAltFP(fp, formatspecs=__file_format_multi_dict__):
|
|
|
4647
4660
|
return filefp
|
|
4648
4661
|
|
|
4649
4662
|
|
|
4650
|
-
def CompressOpenFileAlt(fp, compression="auto", compressionlevel=None, formatspecs=__file_format_dict__):
|
|
4663
|
+
def CompressOpenFileAlt(fp, compression="auto", compressionlevel=None, compressionuselist=compressionlistalt, formatspecs=__file_format_dict__):
|
|
4651
4664
|
if(not hasattr(fp, "read")):
|
|
4652
4665
|
return False
|
|
4653
4666
|
fp.seek(0, 0)
|
|
4654
4667
|
if(not compression or compression == formatspecs['format_magic']):
|
|
4655
4668
|
compression = "auto"
|
|
4656
|
-
if(compression not in
|
|
4669
|
+
if(compression not in compressionuselist and compression is None):
|
|
4657
4670
|
compression = "auto"
|
|
4658
4671
|
if(compression == "gzip" and compression in compressionsupport):
|
|
4659
4672
|
bytesfp = BytesIO()
|
|
@@ -4872,7 +4885,7 @@ def PackArchiveFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", comp
|
|
|
4872
4885
|
outfile = RemoveWindowsPath(outfile)
|
|
4873
4886
|
if(not compression or compression == formatspecs['format_magic']):
|
|
4874
4887
|
compression = "auto"
|
|
4875
|
-
if(compression not in
|
|
4888
|
+
if(compression not in compressionuselist and compression is None):
|
|
4876
4889
|
compression = "auto"
|
|
4877
4890
|
if(verbose):
|
|
4878
4891
|
logging.basicConfig(format="%(message)s",
|
|
@@ -5039,7 +5052,7 @@ def PackArchiveFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", comp
|
|
|
5039
5052
|
elif ftype in data_types:
|
|
5040
5053
|
fsize = format(int(fstatinfo.st_size), 'x').lower()
|
|
5041
5054
|
else:
|
|
5042
|
-
fsize = format(int(fstatinfo.st_size)).lower()
|
|
5055
|
+
fsize = format(int(fstatinfo.st_size), 'x').lower()
|
|
5043
5056
|
fatime = format(int(fstatinfo.st_atime), 'x').lower()
|
|
5044
5057
|
fmtime = format(int(fstatinfo.st_mtime), 'x').lower()
|
|
5045
5058
|
fctime = format(int(fstatinfo.st_ctime), 'x').lower()
|
|
@@ -5108,7 +5121,7 @@ def PackArchiveFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", comp
|
|
|
5108
5121
|
fcontents.seek(0, 0)
|
|
5109
5122
|
cfcontents.seek(0, 0)
|
|
5110
5123
|
cfcontents = CompressOpenFileAlt(
|
|
5111
|
-
cfcontents, compressionuselist[ilmin], compressionlevel, formatspecs)
|
|
5124
|
+
cfcontents, compressionuselist[ilmin], compressionlevel, compressionuselist, formatspecs)
|
|
5112
5125
|
if(cfcontents):
|
|
5113
5126
|
cfcontents.seek(0, 2)
|
|
5114
5127
|
ilcsize.append(cfcontents.tell())
|
|
@@ -5123,7 +5136,7 @@ def PackArchiveFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", comp
|
|
|
5123
5136
|
shutil.copyfileobj(fcontents, cfcontents)
|
|
5124
5137
|
cfcontents.seek(0, 0)
|
|
5125
5138
|
cfcontents = CompressOpenFileAlt(
|
|
5126
|
-
cfcontents, curcompression, compressionlevel, formatspecs)
|
|
5139
|
+
cfcontents, curcompression, compressionlevel, compressionuselist, formatspecs)
|
|
5127
5140
|
cfcontents.seek(0, 2)
|
|
5128
5141
|
cfsize = cfcontents.tell()
|
|
5129
5142
|
if(ucfsize > cfsize):
|
|
@@ -5155,7 +5168,7 @@ def PackArchiveFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", comp
|
|
|
5155
5168
|
fcontents.seek(0, 0)
|
|
5156
5169
|
cfcontents.seek(0, 0)
|
|
5157
5170
|
cfcontents = CompressOpenFileAlt(
|
|
5158
|
-
cfcontents, compressionuselist[ilmin], compressionlevel, formatspecs)
|
|
5171
|
+
cfcontents, compressionuselist[ilmin], compressionlevel, compressionuselist, formatspecs)
|
|
5159
5172
|
if(cfcontents):
|
|
5160
5173
|
cfcontents.seek(0, 2)
|
|
5161
5174
|
ilcsize.append(cfcontents.tell())
|
|
@@ -5170,7 +5183,7 @@ def PackArchiveFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", comp
|
|
|
5170
5183
|
shutil.copyfileobj(fcontents, cfcontents)
|
|
5171
5184
|
cfcontents.seek(0, 0)
|
|
5172
5185
|
cfcontents = CompressOpenFileAlt(
|
|
5173
|
-
cfcontents, curcompression, compressionlevel, formatspecs)
|
|
5186
|
+
cfcontents, curcompression, compressionlevel, compressionuselist, formatspecs)
|
|
5174
5187
|
cfcontents.seek(0, 2)
|
|
5175
5188
|
cfsize = cfcontents.tell()
|
|
5176
5189
|
if(ucfsize > cfsize):
|
|
@@ -5195,7 +5208,7 @@ def PackArchiveFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", comp
|
|
|
5195
5208
|
return False
|
|
5196
5209
|
if(outfile == "-" or outfile is None or hasattr(outfile, "read") or hasattr(outfile, "write")):
|
|
5197
5210
|
fp = CompressOpenFileAlt(
|
|
5198
|
-
fp, compression, compressionlevel, formatspecs)
|
|
5211
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
5199
5212
|
try:
|
|
5200
5213
|
fp.flush()
|
|
5201
5214
|
if(hasattr(os, "sync")):
|
|
@@ -5219,7 +5232,7 @@ def PackArchiveFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", comp
|
|
|
5219
5232
|
return outvar
|
|
5220
5233
|
elif((not hasattr(outfile, "read") and not hasattr(outfile, "write")) and re.findall("^(ftp|ftps|sftp):\\/\\/", outfile)):
|
|
5221
5234
|
fp = CompressOpenFileAlt(
|
|
5222
|
-
fp, compression, compressionlevel, formatspecs)
|
|
5235
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
5223
5236
|
fp.seek(0, 0)
|
|
5224
5237
|
upload_file_to_internet_file(fp, outfile)
|
|
5225
5238
|
if(returnfp):
|
|
@@ -5257,7 +5270,7 @@ def PackArchiveFileFromTarFile(infile, outfile, fmttype="auto", compression="aut
|
|
|
5257
5270
|
outfile = RemoveWindowsPath(outfile)
|
|
5258
5271
|
if(not compression or compression == formatspecs['format_magic']):
|
|
5259
5272
|
compression = "auto"
|
|
5260
|
-
if(compression not in
|
|
5273
|
+
if(compression not in compressionuselist and compression is None):
|
|
5261
5274
|
compression = "auto"
|
|
5262
5275
|
if(verbose):
|
|
5263
5276
|
logging.basicConfig(format="%(message)s", stream=sys.stdout, level=logging.DEBUG)
|
|
@@ -5332,7 +5345,7 @@ def PackArchiveFileFromTarFile(infile, outfile, fmttype="auto", compression="aut
|
|
|
5332
5345
|
if 'zstandard' in sys.modules:
|
|
5333
5346
|
infile = ZstdFile(fileobj=infile, mode="rb")
|
|
5334
5347
|
elif 'pyzstd' in sys.modules:
|
|
5335
|
-
|
|
5348
|
+
infile = pyzstd.zstdfile.ZstdFile(fileobj=infile, mode="rb")
|
|
5336
5349
|
tarfp = tarfile.open(fileobj=infile, mode="r")
|
|
5337
5350
|
else:
|
|
5338
5351
|
tarfp = tarfile.open(fileobj=infile, mode="r")
|
|
@@ -5344,7 +5357,7 @@ def PackArchiveFileFromTarFile(infile, outfile, fmttype="auto", compression="aut
|
|
|
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(infile, "r")
|
|
@@ -5437,6 +5450,7 @@ def PackArchiveFileFromTarFile(infile, outfile, fmttype="auto", compression="aut
|
|
|
5437
5450
|
if ftype in data_types:
|
|
5438
5451
|
fpc = tarfp.extractfile(member)
|
|
5439
5452
|
shutil.copyfileobj(fpc, fcontents)
|
|
5453
|
+
fpc.close()
|
|
5440
5454
|
typechecktest = CheckCompressionType(fcontents, closefp=False)
|
|
5441
5455
|
fcontents.seek(0, 0)
|
|
5442
5456
|
fcencoding = GetFileEncoding(fcontents, False)
|
|
@@ -5455,7 +5469,7 @@ def PackArchiveFileFromTarFile(infile, outfile, fmttype="auto", compression="aut
|
|
|
5455
5469
|
fcontents.seek(0, 0)
|
|
5456
5470
|
cfcontents.seek(0, 0)
|
|
5457
5471
|
cfcontents = CompressOpenFileAlt(
|
|
5458
|
-
cfcontents, compressionuselist[ilmin], compressionlevel, formatspecs)
|
|
5472
|
+
cfcontents, compressionuselist[ilmin], compressionlevel, compressionuselist, formatspecs)
|
|
5459
5473
|
if(cfcontents):
|
|
5460
5474
|
cfcontents.seek(0, 2)
|
|
5461
5475
|
ilcsize.append(cfcontents.tell())
|
|
@@ -5470,7 +5484,7 @@ def PackArchiveFileFromTarFile(infile, outfile, fmttype="auto", compression="aut
|
|
|
5470
5484
|
shutil.copyfileobj(fcontents, cfcontents)
|
|
5471
5485
|
cfcontents.seek(0, 0)
|
|
5472
5486
|
cfcontents = CompressOpenFileAlt(
|
|
5473
|
-
cfcontents, curcompression, compressionlevel, formatspecs)
|
|
5487
|
+
cfcontents, curcompression, compressionlevel, compressionuselist, formatspecs)
|
|
5474
5488
|
cfcontents.seek(0, 2)
|
|
5475
5489
|
cfsize = cfcontents.tell()
|
|
5476
5490
|
if(ucfsize > cfsize):
|
|
@@ -5495,7 +5509,7 @@ def PackArchiveFileFromTarFile(infile, outfile, fmttype="auto", compression="aut
|
|
|
5495
5509
|
return False
|
|
5496
5510
|
if(outfile == "-" or outfile is None or hasattr(outfile, "read") or hasattr(outfile, "write")):
|
|
5497
5511
|
fp = CompressOpenFileAlt(
|
|
5498
|
-
fp, compression, compressionlevel, formatspecs)
|
|
5512
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
5499
5513
|
try:
|
|
5500
5514
|
fp.flush()
|
|
5501
5515
|
if(hasattr(os, "sync")):
|
|
@@ -5519,7 +5533,7 @@ def PackArchiveFileFromTarFile(infile, outfile, fmttype="auto", compression="aut
|
|
|
5519
5533
|
return outvar
|
|
5520
5534
|
elif((not hasattr(outfile, "read") and not hasattr(outfile, "write")) and re.findall("^(ftp|ftps|sftp):\\/\\/", outfile)):
|
|
5521
5535
|
fp = CompressOpenFileAlt(
|
|
5522
|
-
fp, compression, compressionlevel, formatspecs)
|
|
5536
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
5523
5537
|
fp.seek(0, 0)
|
|
5524
5538
|
upload_file_to_internet_file(fp, outfile)
|
|
5525
5539
|
if(returnfp):
|
|
@@ -5553,7 +5567,7 @@ def PackArchiveFileFromZipFile(infile, outfile, fmttype="auto", compression="aut
|
|
|
5553
5567
|
outfile = RemoveWindowsPath(outfile)
|
|
5554
5568
|
if(not compression or compression == formatspecs['format_magic']):
|
|
5555
5569
|
compression = "auto"
|
|
5556
|
-
if(compression not in
|
|
5570
|
+
if(compression not in compressionuselist and compression is None):
|
|
5557
5571
|
compression = "auto"
|
|
5558
5572
|
if(verbose):
|
|
5559
5573
|
logging.basicConfig(format="%(message)s", stream=sys.stdout, level=logging.DEBUG)
|
|
@@ -5752,7 +5766,7 @@ def PackArchiveFileFromZipFile(infile, outfile, fmttype="auto", compression="aut
|
|
|
5752
5766
|
fcontents.seek(0, 0)
|
|
5753
5767
|
cfcontents.seek(0, 0)
|
|
5754
5768
|
cfcontents = CompressOpenFileAlt(
|
|
5755
|
-
cfcontents, compressionuselist[ilmin], compressionlevel, formatspecs)
|
|
5769
|
+
cfcontents, compressionuselist[ilmin], compressionlevel, compressionuselist, formatspecs)
|
|
5756
5770
|
cfcontents.seek(0, 2)
|
|
5757
5771
|
ilcsize.append(cfcontents.tell())
|
|
5758
5772
|
cfcontents.close()
|
|
@@ -5764,7 +5778,7 @@ def PackArchiveFileFromZipFile(infile, outfile, fmttype="auto", compression="aut
|
|
|
5764
5778
|
shutil.copyfileobj(fcontents, cfcontents)
|
|
5765
5779
|
cfcontents.seek(0, 0)
|
|
5766
5780
|
cfcontents = CompressOpenFileAlt(
|
|
5767
|
-
cfcontents, curcompression, compressionlevel, formatspecs)
|
|
5781
|
+
cfcontents, curcompression, compressionlevel, compressionuselist, formatspecs)
|
|
5768
5782
|
cfcontents.seek(0, 2)
|
|
5769
5783
|
cfsize = cfcontents.tell()
|
|
5770
5784
|
if(ucfsize > cfsize):
|
|
@@ -5789,7 +5803,7 @@ def PackArchiveFileFromZipFile(infile, outfile, fmttype="auto", compression="aut
|
|
|
5789
5803
|
return False
|
|
5790
5804
|
if(outfile == "-" or outfile is None or hasattr(outfile, "read") or hasattr(outfile, "write")):
|
|
5791
5805
|
fp = CompressOpenFileAlt(
|
|
5792
|
-
fp, compression, compressionlevel, formatspecs)
|
|
5806
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
5793
5807
|
try:
|
|
5794
5808
|
fp.flush()
|
|
5795
5809
|
if(hasattr(os, "sync")):
|
|
@@ -5813,7 +5827,7 @@ def PackArchiveFileFromZipFile(infile, outfile, fmttype="auto", compression="aut
|
|
|
5813
5827
|
return outvar
|
|
5814
5828
|
elif((not hasattr(outfile, "read") and not hasattr(outfile, "write")) and re.findall("^(ftp|ftps|sftp):\\/\\/", outfile)):
|
|
5815
5829
|
fp = CompressOpenFileAlt(
|
|
5816
|
-
fp, compression, compressionlevel, formatspecs)
|
|
5830
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
5817
5831
|
fp.seek(0, 0)
|
|
5818
5832
|
upload_file_to_internet_file(fp, outfile)
|
|
5819
5833
|
if(returnfp):
|
|
@@ -5852,7 +5866,7 @@ if(rarfile_support):
|
|
|
5852
5866
|
outfile = RemoveWindowsPath(outfile)
|
|
5853
5867
|
if(not compression or compression == formatspecs['format_magic']):
|
|
5854
5868
|
compression = "auto"
|
|
5855
|
-
if(compression not in
|
|
5869
|
+
if(compression not in compressionuselist and compression is None):
|
|
5856
5870
|
compression = "auto"
|
|
5857
5871
|
if(verbose):
|
|
5858
5872
|
logging.basicConfig(format="%(message)s", stream=sys.stdout, level=logging.DEBUG)
|
|
@@ -6069,7 +6083,7 @@ if(rarfile_support):
|
|
|
6069
6083
|
fcontents.seek(0, 0)
|
|
6070
6084
|
cfcontents.seek(0, 0)
|
|
6071
6085
|
cfcontents = CompressOpenFileAlt(
|
|
6072
|
-
cfcontents, compressionuselist[ilmin], compressionlevel, formatspecs)
|
|
6086
|
+
cfcontents, compressionuselist[ilmin], compressionlevel, compressionuselist, formatspecs)
|
|
6073
6087
|
if(cfcontents):
|
|
6074
6088
|
cfcontents.seek(0, 2)
|
|
6075
6089
|
ilcsize.append(cfcontents.tell())
|
|
@@ -6084,12 +6098,12 @@ if(rarfile_support):
|
|
|
6084
6098
|
shutil.copyfileobj(fcontents, cfcontents)
|
|
6085
6099
|
cfcontents.seek(0, 0)
|
|
6086
6100
|
cfcontents = CompressOpenFileAlt(
|
|
6087
|
-
cfcontents, curcompression, compressionlevel, formatspecs)
|
|
6101
|
+
cfcontents, curcompression, compressionlevel, compressionuselist, formatspecs)
|
|
6088
6102
|
cfcontents.seek(0, 2)
|
|
6089
6103
|
cfsize = cfcontents.tell()
|
|
6090
6104
|
if(ucfsize > cfsize):
|
|
6091
6105
|
fcsize = format(int(cfsize), 'x').lower()
|
|
6092
|
-
fcompression =
|
|
6106
|
+
fcompression = curcompression
|
|
6093
6107
|
fcontents.close()
|
|
6094
6108
|
fcontents = cfcontents
|
|
6095
6109
|
if(fcompression == "none"):
|
|
@@ -6109,7 +6123,7 @@ if(rarfile_support):
|
|
|
6109
6123
|
return False
|
|
6110
6124
|
if(outfile == "-" or outfile is None or hasattr(outfile, "read") or hasattr(outfile, "write")):
|
|
6111
6125
|
fp = CompressOpenFileAlt(
|
|
6112
|
-
fp, compression, compressionlevel, formatspecs)
|
|
6126
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
6113
6127
|
try:
|
|
6114
6128
|
fp.flush()
|
|
6115
6129
|
if(hasattr(os, "sync")):
|
|
@@ -6133,7 +6147,7 @@ if(rarfile_support):
|
|
|
6133
6147
|
return outvar
|
|
6134
6148
|
elif((not hasattr(outfile, "read") and not hasattr(outfile, "write")) and re.findall("^(ftp|ftps|sftp):\\/\\/", outfile)):
|
|
6135
6149
|
fp = CompressOpenFileAlt(
|
|
6136
|
-
fp, compression, compressionlevel, formatspecs)
|
|
6150
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
6137
6151
|
fp.seek(0, 0)
|
|
6138
6152
|
upload_file_to_internet_file(fp, outfile)
|
|
6139
6153
|
if(returnfp):
|
|
@@ -6172,7 +6186,7 @@ if(py7zr_support):
|
|
|
6172
6186
|
outfile = RemoveWindowsPath(outfile)
|
|
6173
6187
|
if(not compression or compression == formatspecs['format_magic']):
|
|
6174
6188
|
compression = "auto"
|
|
6175
|
-
if(compression not in
|
|
6189
|
+
if(compression not in compressionuselist and compression is None):
|
|
6176
6190
|
compression = "auto"
|
|
6177
6191
|
if(verbose):
|
|
6178
6192
|
logging.basicConfig(format="%(message)s", stream=sys.stdout, level=logging.DEBUG)
|
|
@@ -6302,10 +6316,11 @@ if(py7zr_support):
|
|
|
6302
6316
|
curcompression = "none"
|
|
6303
6317
|
if ftype == 0:
|
|
6304
6318
|
fcontents.write(file_content[member.filename].read())
|
|
6319
|
+
fsize = format(fcontents.tell(), 'x').lower()
|
|
6320
|
+
fcontents.seek(0, 0)
|
|
6305
6321
|
typechecktest = CheckCompressionType(fcontents, closefp=False)
|
|
6306
6322
|
fcontents.seek(0, 0)
|
|
6307
6323
|
fcencoding = GetFileEncoding(fcontents, False)
|
|
6308
|
-
fsize = format(fcontents.tell(), 'x').lower()
|
|
6309
6324
|
file_content[member.filename].close()
|
|
6310
6325
|
if(typechecktest is False and not compresswholefile):
|
|
6311
6326
|
fcontents.seek(0, 2)
|
|
@@ -6322,7 +6337,7 @@ if(py7zr_support):
|
|
|
6322
6337
|
fcontents.seek(0, 0)
|
|
6323
6338
|
cfcontents.seek(0, 0)
|
|
6324
6339
|
cfcontents = CompressOpenFileAlt(
|
|
6325
|
-
cfcontents, compressionuselist[ilmin], compressionlevel, formatspecs)
|
|
6340
|
+
cfcontents, compressionuselist[ilmin], compressionlevel, compressionuselist, formatspecs)
|
|
6326
6341
|
if(cfcontents):
|
|
6327
6342
|
cfcontents.seek(0, 2)
|
|
6328
6343
|
ilcsize.append(cfcontents.tell())
|
|
@@ -6337,7 +6352,7 @@ if(py7zr_support):
|
|
|
6337
6352
|
shutil.copyfileobj(fcontents, cfcontents)
|
|
6338
6353
|
cfcontents.seek(0, 0)
|
|
6339
6354
|
cfcontents = CompressOpenFileAlt(
|
|
6340
|
-
cfcontents, curcompression, compressionlevel, formatspecs)
|
|
6355
|
+
cfcontents, curcompression, compressionlevel, compressionuselist, formatspecs)
|
|
6341
6356
|
cfcontents.seek(0, 2)
|
|
6342
6357
|
cfsize = cfcontents.tell()
|
|
6343
6358
|
if(ucfsize > cfsize):
|
|
@@ -6362,7 +6377,7 @@ if(py7zr_support):
|
|
|
6362
6377
|
return False
|
|
6363
6378
|
if(outfile == "-" or outfile is None or hasattr(outfile, "read") or hasattr(outfile, "write")):
|
|
6364
6379
|
fp = CompressOpenFileAlt(
|
|
6365
|
-
fp, compression, compressionlevel, formatspecs)
|
|
6380
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
6366
6381
|
try:
|
|
6367
6382
|
fp.flush()
|
|
6368
6383
|
if(hasattr(os, "sync")):
|
|
@@ -6386,7 +6401,7 @@ if(py7zr_support):
|
|
|
6386
6401
|
return outvar
|
|
6387
6402
|
elif((not hasattr(outfile, "read") and not hasattr(outfile, "write")) and re.findall("^(ftp|ftps|sftp):\\/\\/", outfile)):
|
|
6388
6403
|
fp = CompressOpenFileAlt(
|
|
6389
|
-
fp, compression, compressionlevel, formatspecs)
|
|
6404
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
6390
6405
|
fp.seek(0, 0)
|
|
6391
6406
|
upload_file_to_internet_file(fp, outfile)
|
|
6392
6407
|
if(returnfp):
|
|
@@ -7583,11 +7598,11 @@ def ArchiveFileToArray(infile, fmttype="auto", seekstart=0, seekend=0, listonly=
|
|
|
7583
7598
|
if(fcompresstype==formatspecs['format_magic']):
|
|
7584
7599
|
fcompresstype = ""
|
|
7585
7600
|
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': []}
|
|
7586
|
-
if(seekstart < 0
|
|
7601
|
+
if (seekstart < 0) or (seekstart > fnumfiles):
|
|
7587
7602
|
seekstart = 0
|
|
7588
|
-
if(seekend == 0 or seekend > fnumfiles
|
|
7603
|
+
if (seekend == 0) or (seekend > fnumfiles) or (seekend < seekstart):
|
|
7589
7604
|
seekend = fnumfiles
|
|
7590
|
-
elif(seekend < 0 and abs(seekend) <= fnumfiles and abs(seekend) >= seekstart):
|
|
7605
|
+
elif (seekend < 0) and (abs(seekend) <= fnumfiles) and (abs(seekend) >= seekstart):
|
|
7591
7606
|
seekend = fnumfiles - abs(seekend)
|
|
7592
7607
|
if(seekstart > 0):
|
|
7593
7608
|
il = 0
|
|
@@ -7878,7 +7893,7 @@ def MultipleArchiveFileToArray(infile, fmttype="auto", seekstart=0, seekend=0, l
|
|
|
7878
7893
|
infile = [infile]
|
|
7879
7894
|
outretval = {}
|
|
7880
7895
|
for curfname in infile:
|
|
7881
|
-
curretfile =
|
|
7896
|
+
curretfile[curfname] = ArchiveFileToArray(curfname, fmttype, seekstart, seekend, listonly, contentasfile, uncompress, skipchecksum, formatspecs, seektoend, returnfp)
|
|
7882
7897
|
return outretval
|
|
7883
7898
|
|
|
7884
7899
|
def MultipleArchiveFilesToArray(infile, fmttype="auto", seekstart=0, seekend=0, listonly=False, contentasfile=True, uncompress=True, skipchecksum=False, formatspecs=__file_format_multi_dict__, seektoend=False, returnfp=False):
|
|
@@ -8062,7 +8077,7 @@ def RePackArchiveFile(infile, outfile, fmttype="auto", compression="auto", compr
|
|
|
8062
8077
|
outfile = RemoveWindowsPath(outfile)
|
|
8063
8078
|
if(not compression or compression == formatspecs['format_magic']):
|
|
8064
8079
|
compression = "auto"
|
|
8065
|
-
if(compression not in
|
|
8080
|
+
if(compression not in compressionuselist and compression is None):
|
|
8066
8081
|
compression = "auto"
|
|
8067
8082
|
if(verbose):
|
|
8068
8083
|
logging.basicConfig(format="%(message)s", stream=sys.stdout, level=logging.DEBUG)
|
|
@@ -8190,7 +8205,7 @@ def RePackArchiveFile(infile, outfile, fmttype="auto", compression="auto", compr
|
|
|
8190
8205
|
fcontents.seek(0, 0)
|
|
8191
8206
|
cfcontents.seek(0, 0)
|
|
8192
8207
|
cfcontents = CompressOpenFileAlt(
|
|
8193
|
-
cfcontents, compressionuselist[ilmin], compressionlevel, formatspecs)
|
|
8208
|
+
cfcontents, compressionuselist[ilmin], compressionlevel, compressionuselist, formatspecs)
|
|
8194
8209
|
if(cfcontents):
|
|
8195
8210
|
cfcontents.seek(0, 2)
|
|
8196
8211
|
ilcsize.append(cfcontents.tell())
|
|
@@ -8205,7 +8220,7 @@ def RePackArchiveFile(infile, outfile, fmttype="auto", compression="auto", compr
|
|
|
8205
8220
|
shutil.copyfileobj(fcontents, cfcontents)
|
|
8206
8221
|
cfcontents.seek(0, 0)
|
|
8207
8222
|
cfcontents = CompressOpenFileAlt(
|
|
8208
|
-
cfcontents, curcompression, compressionlevel, formatspecs)
|
|
8223
|
+
cfcontents, curcompression, compressionlevel, compressionuselist, formatspecs)
|
|
8209
8224
|
cfcontents.seek(0, 2)
|
|
8210
8225
|
cfsize = cfcontents.tell()
|
|
8211
8226
|
if(ucfsize > cfsize):
|
|
@@ -8285,7 +8300,7 @@ def RePackArchiveFile(infile, outfile, fmttype="auto", compression="auto", compr
|
|
|
8285
8300
|
return False
|
|
8286
8301
|
if(outfile == "-" or outfile is None or hasattr(outfile, "read") or hasattr(outfile, "write")):
|
|
8287
8302
|
fp = CompressOpenFileAlt(
|
|
8288
|
-
fp, compression, compressionlevel, formatspecs)
|
|
8303
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
8289
8304
|
try:
|
|
8290
8305
|
fp.flush()
|
|
8291
8306
|
if(hasattr(os, "sync")):
|
|
@@ -8309,7 +8324,7 @@ def RePackArchiveFile(infile, outfile, fmttype="auto", compression="auto", compr
|
|
|
8309
8324
|
return outvar
|
|
8310
8325
|
elif((not hasattr(outfile, "read") and not hasattr(outfile, "write")) and re.findall("^(ftp|ftps|sftp):\\/\\/", outfile)):
|
|
8311
8326
|
fp = CompressOpenFileAlt(
|
|
8312
|
-
fp, compression, compressionlevel, formatspecs)
|
|
8327
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
8313
8328
|
fp.seek(0, 0)
|
|
8314
8329
|
upload_file_to_internet_file(fp, outfile)
|
|
8315
8330
|
if(returnfp):
|
|
@@ -8718,7 +8733,7 @@ def TarFileListFiles(infile, verbose=False, returnfp=False):
|
|
|
8718
8733
|
if 'zstandard' in sys.modules:
|
|
8719
8734
|
infile = ZstdFile(fileobj=infile, mode="rb")
|
|
8720
8735
|
elif 'pyzstd' in sys.modules:
|
|
8721
|
-
|
|
8736
|
+
infile = pyzstd.zstdfile.ZstdFile(fileobj=infile, mode="rb")
|
|
8722
8737
|
tarfp = tarfile.open(fileobj=infile, mode="r")
|
|
8723
8738
|
else:
|
|
8724
8739
|
tarfp = tarfile.open(fileobj=infile, mode="r")
|
|
@@ -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(infile, "r")
|
|
@@ -9764,9 +9779,9 @@ def upload_file_to_internet_file(ifp, url):
|
|
|
9764
9779
|
return False
|
|
9765
9780
|
|
|
9766
9781
|
|
|
9767
|
-
def upload_file_to_internet_compress_file(ifp, url, compression="auto", compressionlevel=None, formatspecs=__file_format_dict__):
|
|
9782
|
+
def upload_file_to_internet_compress_file(ifp, url, compression="auto", compressionlevel=None, compressionuselist=compressionlistalt, formatspecs=__file_format_dict__):
|
|
9768
9783
|
fp = CompressOpenFileAlt(
|
|
9769
|
-
fp, compression, compressionlevel, formatspecs)
|
|
9784
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
9770
9785
|
if(not archivefileout):
|
|
9771
9786
|
return False
|
|
9772
9787
|
fp.seek(0, 0)
|
|
@@ -9790,9 +9805,9 @@ def upload_file_to_internet_string(ifp, url):
|
|
|
9790
9805
|
return False
|
|
9791
9806
|
|
|
9792
9807
|
|
|
9793
|
-
def upload_file_to_internet_compress_string(ifp, url, compression="auto", compressionlevel=None, formatspecs=__file_format_dict__):
|
|
9808
|
+
def upload_file_to_internet_compress_string(ifp, url, compression="auto", compressionlevel=None, compressionuselist=compressionlistalt, formatspecs=__file_format_dict__):
|
|
9794
9809
|
fp = CompressOpenFileAlt(
|
|
9795
|
-
BytesIO(ifp), compression, compressionlevel, formatspecs)
|
|
9810
|
+
BytesIO(ifp), compression, compressionlevel, compressionuselist, formatspecs)
|
|
9796
9811
|
if(not archivefileout):
|
|
9797
9812
|
return False
|
|
9798
9813
|
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
|