PyFoxFile 0.20.8__py3-none-any.whl → 0.21.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pyfoxfile-0.20.8.data → pyfoxfile-0.21.2.data}/scripts/foxfile.py +6 -6
- pyfoxfile-0.21.2.data/scripts/foxneofile.py +130 -0
- {pyfoxfile-0.20.8.dist-info → pyfoxfile-0.21.2.dist-info}/METADATA +1 -1
- pyfoxfile-0.21.2.dist-info/RECORD +10 -0
- pyfoxfile.py +204 -182
- pyfoxfile-0.20.8.dist-info/RECORD +0 -9
- {pyfoxfile-0.20.8.data → pyfoxfile-0.21.2.data}/scripts/neofoxfile.py +0 -0
- {pyfoxfile-0.20.8.dist-info → pyfoxfile-0.21.2.dist-info}/WHEEL +0 -0
- {pyfoxfile-0.20.8.dist-info → pyfoxfile-0.21.2.dist-info}/licenses/LICENSE +0 -0
- {pyfoxfile-0.20.8.dist-info → pyfoxfile-0.21.2.dist-info}/top_level.txt +0 -0
- {pyfoxfile-0.20.8.dist-info → pyfoxfile-0.21.2.dist-info}/zip-safe +0 -0
pyfoxfile.py
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
Copyright 2018-2024 Game Maker 2k - http://intdb.sourceforge.net/
|
|
15
15
|
Copyright 2018-2024 Kazuki Przyborowski - https://github.com/KazukiPrzyborowski
|
|
16
16
|
|
|
17
|
-
$FileInfo: 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
|
|
@@ -370,6 +370,10 @@ if(__include_defaults__):
|
|
|
370
370
|
__file_format_multi_dict__.update( { 'きつねファイル': {'format_name': "KitsuneFairu", 'format_magic': "きつねファイル", 'format_len': 21, 'format_hex': "e3818de381a4e381ade38395e382a1e382a4e383ab", 'format_delimiter': "\x00", 'format_ver': "001", 'new_style': True, 'use_advanced_list': True, 'use_alt_inode': False, 'format_extension': ".きつね" } } )
|
|
371
371
|
if("狐ファイル" not in __file_format_multi_dict__):
|
|
372
372
|
__file_format_multi_dict__.update( { '狐ファイル': {'format_name': "KitsuneFairu", 'format_magic': "狐ファイル", 'format_len': 15, 'format_hex': "e78b90e38395e382a1e382a4e383ab", 'format_delimiter': "\x00", 'format_ver': "001", 'new_style': True, 'use_advanced_list': True, 'use_alt_inode': False, 'format_extension': ".狐" } } )
|
|
373
|
+
if("狐狸文件" not in __file_format_multi_dict__):
|
|
374
|
+
__file_format_multi_dict__.update( { '狐狸文件': {'format_name': "HúlíWénjiàn", 'format_magic': "狐狸文件", 'format_len': 12, 'format_hex': "ec97acec9ab0ed8c8cec9dbc", 'format_delimiter': "\x00", 'format_ver': "001", 'new_style': True, 'use_advanced_list': True, 'use_alt_inode': False, 'format_extension': ".狐狸" } } )
|
|
375
|
+
if("여우파일" not in __file_format_multi_dict__):
|
|
376
|
+
__file_format_multi_dict__.update( { '여우파일': {'format_name': "YeouPa-il", 'format_magic': "여우파일", 'format_len': 12, 'format_hex': "ec97acec9ab0ed8c8cec9dbc", 'format_delimiter': "\x00", 'format_ver': "001", 'new_style': True, 'use_advanced_list': True, 'use_alt_inode': False, 'format_extension': ".여우" } } )
|
|
373
377
|
if(__file_format_default__ not in __file_format_multi_dict__):
|
|
374
378
|
__file_format_default__ = next(iter(__file_format_multi_dict__))
|
|
375
379
|
__file_format_name__ = __file_format_multi_dict__[__file_format_default__]['format_name']
|
|
@@ -385,12 +389,12 @@ __file_format_extension__ = __file_format_multi_dict__[__file_format_default__][
|
|
|
385
389
|
__file_format_dict__ = __file_format_multi_dict__[__file_format_default__]
|
|
386
390
|
__project__ = __program_name__
|
|
387
391
|
__project_url__ = "https://github.com/GameMaker2k/PyFoxFile"
|
|
388
|
-
__version_info__ = (0,
|
|
389
|
-
__version_date_info__ = (2025, 9,
|
|
392
|
+
__version_info__ = (0, 21, 2, "RC 1", 1)
|
|
393
|
+
__version_date_info__ = (2025, 9, 24, "RC 1", 1)
|
|
390
394
|
__version_date__ = str(__version_date_info__[0]) + "." + str(
|
|
391
395
|
__version_date_info__[1]).zfill(2) + "." + str(__version_date_info__[2]).zfill(2)
|
|
392
396
|
__revision__ = __version_info__[3]
|
|
393
|
-
__revision_id__ = "$Id:
|
|
397
|
+
__revision_id__ = "$Id: c85d5aa829f172404f285788e6b35f73a35767c2 $"
|
|
394
398
|
if(__version_info__[4] is not None):
|
|
395
399
|
__version_date_plusrc__ = __version_date__ + \
|
|
396
400
|
"-" + str(__version_date_info__[4])
|
|
@@ -1953,15 +1957,15 @@ def ReadFileHeaderDataWithContent(fp, listonly=False, uncompress=True, skipcheck
|
|
|
1953
1957
|
HeaderOut = ReadFileHeaderDataWoSize(fp, delimiter)
|
|
1954
1958
|
if(len(HeaderOut) == 0):
|
|
1955
1959
|
return False
|
|
1956
|
-
if(re.findall("^[.|/]", HeaderOut[
|
|
1957
|
-
fname = HeaderOut[
|
|
1960
|
+
if(re.findall("^[.|/]", HeaderOut[5])):
|
|
1961
|
+
fname = HeaderOut[5]
|
|
1958
1962
|
else:
|
|
1959
|
-
fname = "./"+HeaderOut[
|
|
1963
|
+
fname = "./"+HeaderOut[5]
|
|
1960
1964
|
fcs = HeaderOut[-2].lower()
|
|
1961
1965
|
fccs = HeaderOut[-1].lower()
|
|
1962
|
-
fsize = int(HeaderOut[
|
|
1963
|
-
fcompression = HeaderOut[
|
|
1964
|
-
fcsize = int(HeaderOut[
|
|
1966
|
+
fsize = int(HeaderOut[7], 16)
|
|
1967
|
+
fcompression = HeaderOut[14]
|
|
1968
|
+
fcsize = int(HeaderOut[15], 16)
|
|
1965
1969
|
fseeknextfile = HeaderOut[26]
|
|
1966
1970
|
fjsontype = HeaderOut[27]
|
|
1967
1971
|
fjsonlen = int(HeaderOut[28], 16)
|
|
@@ -2014,6 +2018,7 @@ def ReadFileHeaderDataWithContent(fp, listonly=False, uncompress=True, skipcheck
|
|
|
2014
2018
|
fcontents.seek(0, 0)
|
|
2015
2019
|
newfccs = GetFileChecksum(
|
|
2016
2020
|
fcontents.read(), HeaderOut[-3].lower(), False, formatspecs)
|
|
2021
|
+
fcontents.seek(0, 0)
|
|
2017
2022
|
if(fccs != newfccs and not skipchecksum and not listonly):
|
|
2018
2023
|
VerbosePrintOut("File Content Checksum Error with file " +
|
|
2019
2024
|
fname + " at offset " + str(fcontentstart))
|
|
@@ -2026,7 +2031,7 @@ def ReadFileHeaderDataWithContent(fp, listonly=False, uncompress=True, skipcheck
|
|
|
2026
2031
|
if(uncompress):
|
|
2027
2032
|
cfcontents = UncompressFileAlt(fcontents, formatspecs)
|
|
2028
2033
|
cfcontents.seek(0, 0)
|
|
2029
|
-
|
|
2034
|
+
fcontents = BytesIO()
|
|
2030
2035
|
shutil.copyfileobj(cfcontents, fcontents)
|
|
2031
2036
|
cfcontents.close()
|
|
2032
2037
|
fcontents.seek(0, 0)
|
|
@@ -2118,6 +2123,7 @@ def ReadFileHeaderDataWithContentToArray(fp, listonly=False, contentasfile=True,
|
|
|
2118
2123
|
fextrafieldslist = json.loads(fextrafieldslist[0])
|
|
2119
2124
|
except (binascii.Error, json.decoder.JSONDecodeError, UnicodeDecodeError):
|
|
2120
2125
|
pass
|
|
2126
|
+
fjstart = fp.tell()
|
|
2121
2127
|
if(fjsontype=="json"):
|
|
2122
2128
|
fjsoncontent = {}
|
|
2123
2129
|
fprejsoncontent = fp.read(fjsonsize).decode("UTF-8")
|
|
@@ -2145,11 +2151,11 @@ def ReadFileHeaderDataWithContentToArray(fp, listonly=False, contentasfile=True,
|
|
|
2145
2151
|
fjsoncontent = ReadFileHeaderData(flisttmp, fjsonlen, delimiter)
|
|
2146
2152
|
flisttmp.close()
|
|
2147
2153
|
fjsonrawcontent = fjsoncontent
|
|
2148
|
-
if(
|
|
2154
|
+
if(fjsonlen==1):
|
|
2149
2155
|
try:
|
|
2150
2156
|
fjsonrawcontent = base64.b64decode(fjsoncontent[0]).decode("UTF-8")
|
|
2151
2157
|
fjsoncontent = json.loads(base64.b64decode(fjsoncontent[0]).decode("UTF-8"))
|
|
2152
|
-
|
|
2158
|
+
fjsonlen = len(fjsoncontent)
|
|
2153
2159
|
except (binascii.Error, json.decoder.JSONDecodeError, UnicodeDecodeError):
|
|
2154
2160
|
try:
|
|
2155
2161
|
fjsonrawcontent = fjsoncontent[0]
|
|
@@ -2157,6 +2163,7 @@ def ReadFileHeaderDataWithContentToArray(fp, listonly=False, contentasfile=True,
|
|
|
2157
2163
|
except (binascii.Error, json.decoder.JSONDecodeError, UnicodeDecodeError):
|
|
2158
2164
|
pass
|
|
2159
2165
|
fp.seek(len(delimiter), 1)
|
|
2166
|
+
fjend = fp.tell() - 1
|
|
2160
2167
|
jsonfcs = GetFileChecksum(fprejsoncontent, fjsonchecksumtype, True, formatspecs)
|
|
2161
2168
|
if(jsonfcs != fjsonchecksum and not skipchecksum):
|
|
2162
2169
|
VerbosePrintOut("File JSON Data Checksum Error with file " +
|
|
@@ -2191,6 +2198,7 @@ def ReadFileHeaderDataWithContentToArray(fp, listonly=False, contentasfile=True,
|
|
|
2191
2198
|
fcontents.seek(0, 0)
|
|
2192
2199
|
newfccs = GetFileChecksum(
|
|
2193
2200
|
fcontents.read(), HeaderOut[-3].lower(), False, formatspecs)
|
|
2201
|
+
fcontents.seek(0, 0)
|
|
2194
2202
|
if(fccs != newfccs and not skipchecksum and not listonly):
|
|
2195
2203
|
VerbosePrintOut("File Content Checksum Error with file " +
|
|
2196
2204
|
fname + " at offset " + str(fcontentstart))
|
|
@@ -2232,7 +2240,7 @@ def ReadFileHeaderDataWithContentToArray(fp, listonly=False, contentasfile=True,
|
|
|
2232
2240
|
if(not contentasfile):
|
|
2233
2241
|
fcontents = fcontents.read()
|
|
2234
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,
|
|
2235
|
-
'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}
|
|
2236
2244
|
return outlist
|
|
2237
2245
|
|
|
2238
2246
|
|
|
@@ -2329,11 +2337,11 @@ def ReadFileHeaderDataWithContentToList(fp, listonly=False, contentasfile=False,
|
|
|
2329
2337
|
fjsoncontent = ReadFileHeaderData(flisttmp, fjsonlen, delimiter)
|
|
2330
2338
|
flisttmp.close()
|
|
2331
2339
|
fjsonrawcontent = fjsoncontent
|
|
2332
|
-
if(
|
|
2340
|
+
if(fjsonlen==1):
|
|
2333
2341
|
try:
|
|
2334
2342
|
fjsonrawcontent = base64.b64decode(fjsoncontent[0]).decode("UTF-8")
|
|
2335
2343
|
fjsoncontent = json.loads(base64.b64decode(fjsoncontent[0]).decode("UTF-8"))
|
|
2336
|
-
|
|
2344
|
+
fjsonlen = len(fjsoncontent)
|
|
2337
2345
|
except (binascii.Error, json.decoder.JSONDecodeError, UnicodeDecodeError):
|
|
2338
2346
|
try:
|
|
2339
2347
|
fjsonrawcontent = fjsoncontent[0]
|
|
@@ -2543,11 +2551,11 @@ def ReadFileDataWithContentToArray(fp, seekstart=0, seekend=0, listonly=False, c
|
|
|
2543
2551
|
formversions = re.search('(.*?)(\\d+)', formstring).groups()
|
|
2544
2552
|
fcompresstype = ""
|
|
2545
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': []}
|
|
2546
|
-
if(seekstart < 0
|
|
2554
|
+
if (seekstart < 0) or (seekstart > fnumfiles):
|
|
2547
2555
|
seekstart = 0
|
|
2548
|
-
if(seekend == 0 or seekend > fnumfiles
|
|
2556
|
+
if (seekend == 0) or (seekend > fnumfiles) or (seekend < seekstart):
|
|
2549
2557
|
seekend = fnumfiles
|
|
2550
|
-
elif(seekend < 0 and abs(seekend) <= fnumfiles and abs(seekend) >= seekstart):
|
|
2558
|
+
elif (seekend < 0) and (abs(seekend) <= fnumfiles) and (abs(seekend) >= seekstart):
|
|
2551
2559
|
seekend = fnumfiles - abs(seekend)
|
|
2552
2560
|
if(seekstart > 0):
|
|
2553
2561
|
il = 0
|
|
@@ -2558,14 +2566,18 @@ def ReadFileDataWithContentToArray(fp, seekstart=0, seekend=0, listonly=False, c
|
|
|
2558
2566
|
if(len(preheaderdata) == 0):
|
|
2559
2567
|
break
|
|
2560
2568
|
prefsize = int(preheaderdata[5], 16)
|
|
2569
|
+
if(re.findall("^[.|/]", preheaderdata[5])):
|
|
2570
|
+
prefname = preheaderdata[5]
|
|
2571
|
+
else:
|
|
2572
|
+
prefname = "./"+preheaderdata[5]
|
|
2561
2573
|
prefseeknextfile = preheaderdata[26]
|
|
2562
2574
|
prefjsonlen = int(preheaderdata[28], 16)
|
|
2563
2575
|
prefjsonsize = int(preheaderdata[29], 16)
|
|
2564
2576
|
prefjsonchecksumtype = preheaderdata[30]
|
|
2565
2577
|
prefjsonchecksum = preheaderdata[31]
|
|
2566
|
-
|
|
2578
|
+
prejsoncontent = fp.read(prefjsonsize).decode("UTF-8")
|
|
2567
2579
|
fp.seek(len(delimiter), 1)
|
|
2568
|
-
prejsonfcs = GetFileChecksum(
|
|
2580
|
+
prejsonfcs = GetFileChecksum(prejsoncontent, prefjsonchecksumtype, True, formatspecs)
|
|
2569
2581
|
if(prejsonfcs != prefjsonchecksum and not skipchecksum):
|
|
2570
2582
|
VerbosePrintOut("File JSON Data Checksum Error with file " +
|
|
2571
2583
|
prefname + " at offset " + str(prefhstart))
|
|
@@ -2575,7 +2587,7 @@ def ReadFileDataWithContentToArray(fp, seekstart=0, seekend=0, listonly=False, c
|
|
|
2575
2587
|
preheaderdata[:-2], preheaderdata[-4].lower(), True, formatspecs)
|
|
2576
2588
|
prefcs = preheaderdata[-2]
|
|
2577
2589
|
if(prefcs != prenewfcs and not skipchecksum):
|
|
2578
|
-
|
|
2590
|
+
VerbosePrintOut("File Header Checksum Error with file " +
|
|
2579
2591
|
prefname + " at offset " + str(prefhstart))
|
|
2580
2592
|
VerbosePrintOut("'" + prefcs + "' != " +
|
|
2581
2593
|
"'" + prenewfcs + "'")
|
|
@@ -2698,11 +2710,11 @@ def ReadFileDataWithContentToList(fp, seekstart=0, seekend=0, listonly=False, co
|
|
|
2698
2710
|
return False
|
|
2699
2711
|
formversions = re.search('(.*?)(\\d+)', formstring).groups()
|
|
2700
2712
|
outlist = []
|
|
2701
|
-
if(seekstart < 0
|
|
2713
|
+
if (seekstart < 0) or (seekstart > fnumfiles):
|
|
2702
2714
|
seekstart = 0
|
|
2703
|
-
if(seekend == 0 or seekend > fnumfiles
|
|
2715
|
+
if (seekend == 0) or (seekend > fnumfiles) or (seekend < seekstart):
|
|
2704
2716
|
seekend = fnumfiles
|
|
2705
|
-
elif(seekend < 0 and abs(seekend) <= fnumfiles and abs(seekend) >= seekstart):
|
|
2717
|
+
elif (seekend < 0) and (abs(seekend) <= fnumfiles) and (abs(seekend) >= seekstart):
|
|
2706
2718
|
seekend = fnumfiles - abs(seekend)
|
|
2707
2719
|
if(seekstart > 0):
|
|
2708
2720
|
il = 0
|
|
@@ -2717,16 +2729,20 @@ def ReadFileDataWithContentToList(fp, seekstart=0, seekend=0, listonly=False, co
|
|
|
2717
2729
|
if(len(preheaderdata) == 0):
|
|
2718
2730
|
break
|
|
2719
2731
|
prefsize = int(preheaderdata[5], 16)
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
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]
|
|
2723
2739
|
prefjsonlen = int(preheaderdata[28], 16)
|
|
2724
2740
|
prefjsonsize = int(preheaderdata[29], 16)
|
|
2725
2741
|
prefjsonchecksumtype = preheaderdata[30]
|
|
2726
2742
|
prefjsonchecksum = preheaderdata[31]
|
|
2727
2743
|
prefprejsoncontent = fp.read(prefjsonsize).decode("UTF-8")
|
|
2728
2744
|
fp.seek(len(delimiter), 1)
|
|
2729
|
-
prejsonfcs = GetFileChecksum(
|
|
2745
|
+
prejsonfcs = GetFileChecksum(prefprejsoncontent, prefjsonchecksumtype, True, formatspecs)
|
|
2730
2746
|
if(prejsonfcs != prefjsonchecksum and not skipchecksum):
|
|
2731
2747
|
VerbosePrintOut("File JSON Data Checksum Error with file " +
|
|
2732
2748
|
prefname + " at offset " + str(prefhstart))
|
|
@@ -2813,13 +2829,13 @@ def ReadInFileWithContentToArray(infile, fmttype="auto", seekstart=0, seekend=0,
|
|
|
2813
2829
|
fp = UncompressFileAlt(fp, formatspecs)
|
|
2814
2830
|
checkcompressfile = CheckCompressionSubType(fp, formatspecs, True)
|
|
2815
2831
|
if(checkcompressfile == "tarfile" and TarFileCheck(infile)):
|
|
2816
|
-
return TarFileToArray(infile, seekstart, seekend, listonly, contentasfile, skipchecksum, formatspecs, seektoend,
|
|
2832
|
+
return TarFileToArray(infile, seekstart, seekend, listonly, contentasfile, skipchecksum, formatspecs, seektoend, True)
|
|
2817
2833
|
elif(checkcompressfile == "zipfile" and zipfile.is_zipfile(infile)):
|
|
2818
|
-
return ZipFileToArray(infile, seekstart, seekend, listonly, contentasfile, skipchecksum, formatspecs, seektoend,
|
|
2834
|
+
return ZipFileToArray(infile, seekstart, seekend, listonly, contentasfile, skipchecksum, formatspecs, seektoend, True)
|
|
2819
2835
|
elif(rarfile_support and checkcompressfile == "rarfile" and (rarfile.is_rarfile(infile) or rarfile.is_rarfile_sfx(infile))):
|
|
2820
|
-
return RarFileToArray(infile, seekstart, seekend, listonly, contentasfile, skipchecksum, formatspecs, seektoend,
|
|
2836
|
+
return RarFileToArray(infile, seekstart, seekend, listonly, contentasfile, skipchecksum, formatspecs, seektoend, True)
|
|
2821
2837
|
elif(py7zr_support and checkcompressfile == "7zipfile" and py7zr.is_7zfile(infile)):
|
|
2822
|
-
return SevenZipFileToArray(infile, seekstart, seekend, listonly, contentasfile, skipchecksum, formatspecs, seektoend,
|
|
2838
|
+
return SevenZipFileToArray(infile, seekstart, seekend, listonly, contentasfile, skipchecksum, formatspecs, seektoend, True)
|
|
2823
2839
|
elif(IsSingleDict(formatspecs) and checkcompressfile != formatspecs['format_magic']):
|
|
2824
2840
|
return False
|
|
2825
2841
|
elif(IsNestedDict(formatspecs) and checkcompressfile not in formatspecs):
|
|
@@ -2929,13 +2945,13 @@ def ReadInFileWithContentToArray(infile, fmttype="auto", seekstart=0, seekend=0,
|
|
|
2929
2945
|
if(IsNestedDict(formatspecs) and checkcompressfile in formatspecs):
|
|
2930
2946
|
formatspecs = formatspecs[checkcompressfile]
|
|
2931
2947
|
if(checkcompressfile == "tarfile" and TarFileCheck(infile)):
|
|
2932
|
-
return TarFileToArray(infile, seekstart, seekend, listonly, skipchecksum, formatspecs, seektoend,
|
|
2948
|
+
return TarFileToArray(infile, seekstart, seekend, listonly, skipchecksum, formatspecs, seektoend, True)
|
|
2933
2949
|
elif(checkcompressfile == "zipfile" and zipfile.is_zipfile(infile)):
|
|
2934
|
-
return ZipFileToArray(infile, seekstart, seekend, listonly, skipchecksum, formatspecs, seektoend,
|
|
2950
|
+
return ZipFileToArray(infile, seekstart, seekend, listonly, skipchecksum, formatspecs, seektoend, True)
|
|
2935
2951
|
elif(rarfile_support and checkcompressfile == "rarfile" and (rarfile.is_rarfile(infile) or rarfile.is_rarfile_sfx(infile))):
|
|
2936
|
-
return RarFileToArray(infile, seekstart, seekend, listonly, skipchecksum, formatspecs, seektoend,
|
|
2952
|
+
return RarFileToArray(infile, seekstart, seekend, listonly, skipchecksum, formatspecs, seektoend, True)
|
|
2937
2953
|
elif(py7zr_support and checkcompressfile == "7zipfile" and py7zr.is_7zfile(infile)):
|
|
2938
|
-
return SevenZipFileToArray(infile, seekstart, seekend, listonly, skipchecksum, formatspecs, seektoend,
|
|
2954
|
+
return SevenZipFileToArray(infile, seekstart, seekend, listonly, skipchecksum, formatspecs, seektoend, True)
|
|
2939
2955
|
elif(IsSingleDict(formatspecs) and checkcompressfile != formatspecs['format_magic']):
|
|
2940
2956
|
return False
|
|
2941
2957
|
elif(IsNestedDict(formatspecs) and checkcompressfile not in formatspecs):
|
|
@@ -2974,7 +2990,7 @@ def ReadInMultipleFileWithContentToArray(infile, fmttype="auto", seekstart=0, se
|
|
|
2974
2990
|
infile = [infile]
|
|
2975
2991
|
outretval = {}
|
|
2976
2992
|
for curfname in infile:
|
|
2977
|
-
|
|
2993
|
+
outretval[curfname] = ReadInFileWithContentToArray(curfname, fmttype, seekstart, seekend, listonly, contentasfile, uncompress, skipchecksum, formatspecs, seektoend)
|
|
2978
2994
|
return outretval
|
|
2979
2995
|
|
|
2980
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):
|
|
@@ -3001,13 +3017,13 @@ def ReadInFileWithContentToList(infile, fmttype="auto", seekstart=0, seekend=0,
|
|
|
3001
3017
|
fp = UncompressFileAlt(fp, formatspecs)
|
|
3002
3018
|
checkcompressfile = CheckCompressionSubType(fp, formatspecs, True)
|
|
3003
3019
|
if(checkcompressfile == "tarfile" and TarFileCheck(infile)):
|
|
3004
|
-
return TarFileToArray(infile, seekstart, seekend, listonly, contentasfile, skipchecksum, formatspecs, seektoend,
|
|
3020
|
+
return TarFileToArray(infile, seekstart, seekend, listonly, contentasfile, skipchecksum, formatspecs, seektoend, True)
|
|
3005
3021
|
elif(checkcompressfile == "zipfile" and zipfile.is_zipfile(infile)):
|
|
3006
|
-
return ZipFileToArray(infile, seekstart, seekend, listonly, contentasfile, skipchecksum, formatspecs, seektoend,
|
|
3022
|
+
return ZipFileToArray(infile, seekstart, seekend, listonly, contentasfile, skipchecksum, formatspecs, seektoend, True)
|
|
3007
3023
|
elif(rarfile_support and checkcompressfile == "rarfile" and (rarfile.is_rarfile(infile) or rarfile.is_rarfile_sfx(infile))):
|
|
3008
|
-
return RarFileToArray(infile, seekstart, seekend, listonly, contentasfile, skipchecksum, formatspecs, seektoend,
|
|
3024
|
+
return RarFileToArray(infile, seekstart, seekend, listonly, contentasfile, skipchecksum, formatspecs, seektoend, True)
|
|
3009
3025
|
elif(py7zr_support and checkcompressfile == "7zipfile" and py7zr.is_7zfile(infile)):
|
|
3010
|
-
return SevenZipFileToArray(infile, seekstart, seekend, listonly, contentasfile, skipchecksum, formatspecs, seektoend,
|
|
3026
|
+
return SevenZipFileToArray(infile, seekstart, seekend, listonly, contentasfile, skipchecksum, formatspecs, seektoend, True)
|
|
3011
3027
|
elif(IsSingleDict(formatspecs) and checkcompressfile != formatspecs['format_magic']):
|
|
3012
3028
|
return False
|
|
3013
3029
|
elif(IsNestedDict(formatspecs) and checkcompressfile not in formatspecs):
|
|
@@ -3117,13 +3133,13 @@ def ReadInFileWithContentToList(infile, fmttype="auto", seekstart=0, seekend=0,
|
|
|
3117
3133
|
if(IsNestedDict(formatspecs) and checkcompressfile in formatspecs):
|
|
3118
3134
|
formatspecs = formatspecs[checkcompressfile]
|
|
3119
3135
|
if(checkcompressfile == "tarfile" and TarFileCheck(infile)):
|
|
3120
|
-
return TarFileToArray(infile, seekstart, seekend, listonly, skipchecksum, formatspecs, seektoend,
|
|
3136
|
+
return TarFileToArray(infile, seekstart, seekend, listonly, skipchecksum, formatspecs, seektoend, True)
|
|
3121
3137
|
elif(checkcompressfile == "zipfile" and zipfile.is_zipfile(infile)):
|
|
3122
|
-
return ZipFileToArray(infile, seekstart, seekend, listonly, skipchecksum, formatspecs, seektoend,
|
|
3138
|
+
return ZipFileToArray(infile, seekstart, seekend, listonly, skipchecksum, formatspecs, seektoend, True)
|
|
3123
3139
|
elif(rarfile_support and checkcompressfile == "rarfile" and (rarfile.is_rarfile(infile) or rarfile.is_rarfile_sfx(infile))):
|
|
3124
|
-
return RarFileToArray(infile, seekstart, seekend, listonly, skipchecksum, formatspecs, seektoend,
|
|
3140
|
+
return RarFileToArray(infile, seekstart, seekend, listonly, skipchecksum, formatspecs, seektoend, True)
|
|
3125
3141
|
elif(py7zr_support and checkcompressfile == "7zipfile" and py7zr.is_7zfile(infile)):
|
|
3126
|
-
return SevenZipFileToArray(infile, seekstart, seekend, listonly, skipchecksum, formatspecs, seektoend,
|
|
3142
|
+
return SevenZipFileToArray(infile, seekstart, seekend, listonly, skipchecksum, formatspecs, seektoend, True)
|
|
3127
3143
|
elif(IsSingleDict(formatspecs) and checkcompressfile != formatspecs['format_magic']):
|
|
3128
3144
|
return False
|
|
3129
3145
|
elif(IsNestedDict(formatspecs) and checkcompressfile not in formatspecs):
|
|
@@ -3162,7 +3178,7 @@ def ReadInMultipleFileWithContentToList(infile, fmttype="auto", seekstart=0, see
|
|
|
3162
3178
|
infile = [infile]
|
|
3163
3179
|
outretval = {}
|
|
3164
3180
|
for curfname in infile:
|
|
3165
|
-
curretfile =
|
|
3181
|
+
curretfile[curfname] = ReadInFileWithContentToList(curfname, fmttype, seekstart, seekend, listonly, contentasfile, uncompress, skipchecksum, formatspecs, seektoend)
|
|
3166
3182
|
return outretval
|
|
3167
3183
|
|
|
3168
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):
|
|
@@ -3207,7 +3223,7 @@ def AppendFileHeader(fp, numfiles, fencoding, extradata=[], checksumtype="crc32"
|
|
|
3207
3223
|
tmpoutlist = []
|
|
3208
3224
|
tmpoutlist.append(extrasizelen)
|
|
3209
3225
|
tmpoutlist.append(extrafields)
|
|
3210
|
-
fnumfiles = format(
|
|
3226
|
+
fnumfiles = format(numfiles, 'x').lower()
|
|
3211
3227
|
tmpoutlen = 3 + len(tmpoutlist) + len(extradata) + 2
|
|
3212
3228
|
tmpoutlenhex = format(tmpoutlen, 'x').lower()
|
|
3213
3229
|
fnumfilesa = AppendNullBytes(
|
|
@@ -3261,11 +3277,11 @@ def MakeEmptyFilePointer(fp, fmttype=__file_format_default__, checksumtype="crc3
|
|
|
3261
3277
|
return fp
|
|
3262
3278
|
|
|
3263
3279
|
|
|
3264
|
-
def
|
|
3280
|
+
def MakeEmptyArchiveFilePointer(fp, fmttype=__file_format_default__, checksumtype="crc32", formatspecs=__file_format_multi_dict__):
|
|
3265
3281
|
return MakeEmptyFilePointer(fp, fmttype, checksumtype, formatspecs)
|
|
3266
3282
|
|
|
3267
3283
|
|
|
3268
|
-
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):
|
|
3269
3285
|
if(IsNestedDict(formatspecs) and fmttype=="auto" and
|
|
3270
3286
|
(outfile != "-" and outfile is not None and not hasattr(outfile, "read") and not hasattr(outfile, "write"))):
|
|
3271
3287
|
get_in_ext = os.path.splitext(outfile)
|
|
@@ -3309,7 +3325,7 @@ def MakeEmptyFile(outfile, fmttype="auto", compression="auto", compresswholefile
|
|
|
3309
3325
|
AppendFileHeader(fp, 0, "UTF-8", [], checksumtype, formatspecs)
|
|
3310
3326
|
if(outfile == "-" or outfile is None or hasattr(outfile, "read") or hasattr(outfile, "write")):
|
|
3311
3327
|
fp = CompressOpenFileAlt(
|
|
3312
|
-
fp, compression, compressionlevel, formatspecs)
|
|
3328
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
3313
3329
|
try:
|
|
3314
3330
|
fp.flush()
|
|
3315
3331
|
if(hasattr(os, "sync")):
|
|
@@ -3333,7 +3349,7 @@ def MakeEmptyFile(outfile, fmttype="auto", compression="auto", compresswholefile
|
|
|
3333
3349
|
return outvar
|
|
3334
3350
|
elif(re.findall("^(ftp|ftps|sftp):\\/\\/", outfile)):
|
|
3335
3351
|
fp = CompressOpenFileAlt(
|
|
3336
|
-
fp, compression, compressionlevel, formatspecs)
|
|
3352
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
3337
3353
|
fp.seek(0, 0)
|
|
3338
3354
|
upload_file_to_internet_file(fp, outfile)
|
|
3339
3355
|
if(returnfp):
|
|
@@ -3344,8 +3360,8 @@ def MakeEmptyFile(outfile, fmttype="auto", compression="auto", compresswholefile
|
|
|
3344
3360
|
return True
|
|
3345
3361
|
|
|
3346
3362
|
|
|
3347
|
-
def
|
|
3348
|
-
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)
|
|
3349
3365
|
|
|
3350
3366
|
|
|
3351
3367
|
def AppendFileHeaderWithContent(fp, filevalues=[], extradata=[], jsondata={}, filecontent="", checksumtype=["crc32", "crc32", "crc32"], formatspecs=__file_format_dict__):
|
|
@@ -3444,6 +3460,7 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, filevalues=[], ext
|
|
|
3444
3460
|
if(verbose):
|
|
3445
3461
|
logging.basicConfig(format="%(message)s",
|
|
3446
3462
|
stream=sys.stdout, level=logging.DEBUG)
|
|
3463
|
+
infilelist = []
|
|
3447
3464
|
if(infiles == "-"):
|
|
3448
3465
|
for line in sys.stdin:
|
|
3449
3466
|
infilelist.append(line.strip())
|
|
@@ -3484,7 +3501,7 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, filevalues=[], ext
|
|
|
3484
3501
|
inodetoforminode = {}
|
|
3485
3502
|
numfiles = int(len(GetDirList))
|
|
3486
3503
|
fnumfiles = format(numfiles, 'x').lower()
|
|
3487
|
-
AppendFileHeader(fp,
|
|
3504
|
+
AppendFileHeader(fp, numfiles, "UTF-8", [], checksumtype[0], formatspecs)
|
|
3488
3505
|
FullSizeFilesAlt = 0
|
|
3489
3506
|
for curfname in GetDirList:
|
|
3490
3507
|
fencoding = "UTF-8"
|
|
@@ -3582,7 +3599,7 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, filevalues=[], ext
|
|
|
3582
3599
|
elif ftype in data_types:
|
|
3583
3600
|
fsize = format(int(fstatinfo.st_size), 'x').lower()
|
|
3584
3601
|
else:
|
|
3585
|
-
fsize = format(int(fstatinfo.st_size)).lower()
|
|
3602
|
+
fsize = format(int(fstatinfo.st_size), 'x').lower()
|
|
3586
3603
|
fatime = format(int(fstatinfo.st_atime), 'x').lower()
|
|
3587
3604
|
fmtime = format(int(fstatinfo.st_mtime), 'x').lower()
|
|
3588
3605
|
fctime = format(int(fstatinfo.st_ctime), 'x').lower()
|
|
@@ -3630,11 +3647,14 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, filevalues=[], ext
|
|
|
3630
3647
|
fcontents = BytesIO()
|
|
3631
3648
|
chunk_size = 1024
|
|
3632
3649
|
fcencoding = "UTF-8"
|
|
3633
|
-
|
|
3650
|
+
curcompression = "none"
|
|
3651
|
+
if not followlink and ftype in data_types:
|
|
3634
3652
|
with open(fname, "rb") as fpc:
|
|
3635
3653
|
shutil.copyfileobj(fpc, fcontents)
|
|
3654
|
+
typechecktest = CheckCompressionType(fcontents, closefp=False)
|
|
3655
|
+
fcontents.seek(0, 0)
|
|
3636
3656
|
fcencoding = GetFileEncoding(fcontents, False)
|
|
3637
|
-
if(not compresswholefile):
|
|
3657
|
+
if(typechecktest is False and not compresswholefile):
|
|
3638
3658
|
fcontents.seek(0, 2)
|
|
3639
3659
|
ucfsize = fcontents.tell()
|
|
3640
3660
|
fcontents.seek(0, 0)
|
|
@@ -3649,16 +3669,13 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, filevalues=[], ext
|
|
|
3649
3669
|
fcontents.seek(0, 0)
|
|
3650
3670
|
cfcontents.seek(0, 0)
|
|
3651
3671
|
cfcontents = CompressOpenFileAlt(
|
|
3652
|
-
cfcontents, compressionuselist[ilmin], compressionlevel, formatspecs)
|
|
3672
|
+
cfcontents, compressionuselist[ilmin], compressionlevel, compressionuselist, formatspecs)
|
|
3653
3673
|
if(cfcontents):
|
|
3654
3674
|
cfcontents.seek(0, 2)
|
|
3655
3675
|
ilcsize.append(cfcontents.tell())
|
|
3656
3676
|
cfcontents.close()
|
|
3657
3677
|
else:
|
|
3658
|
-
|
|
3659
|
-
ilcsize.append(sys.maxint)
|
|
3660
|
-
except AttributeError:
|
|
3661
|
-
ilcsize.append(sys.maxsize)
|
|
3678
|
+
ilcsize.append(float("inf"))
|
|
3662
3679
|
ilmin = ilmin + 1
|
|
3663
3680
|
ilcmin = ilcsize.index(min(ilcsize))
|
|
3664
3681
|
curcompression = compressionuselist[ilcmin]
|
|
@@ -3667,7 +3684,7 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, filevalues=[], ext
|
|
|
3667
3684
|
shutil.copyfileobj(fcontents, cfcontents)
|
|
3668
3685
|
cfcontents.seek(0, 0)
|
|
3669
3686
|
cfcontents = CompressOpenFileAlt(
|
|
3670
|
-
cfcontents, curcompression, compressionlevel, formatspecs)
|
|
3687
|
+
cfcontents, curcompression, compressionlevel, compressionuselist, formatspecs)
|
|
3671
3688
|
cfcontents.seek(0, 2)
|
|
3672
3689
|
cfsize = cfcontents.tell()
|
|
3673
3690
|
if(ucfsize > cfsize):
|
|
@@ -3675,13 +3692,16 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, filevalues=[], ext
|
|
|
3675
3692
|
fcompression = curcompression
|
|
3676
3693
|
fcontents.close()
|
|
3677
3694
|
fcontents = cfcontents
|
|
3678
|
-
|
|
3695
|
+
elif followlink and (ftype == 1 or ftype == 2):
|
|
3679
3696
|
if(not os.path.exists(flinkname)):
|
|
3680
3697
|
return False
|
|
3681
3698
|
flstatinfo = os.stat(flinkname)
|
|
3682
3699
|
with open(flinkname, "rb") as fpc:
|
|
3683
3700
|
shutil.copyfileobj(fpc, fcontents)
|
|
3684
|
-
|
|
3701
|
+
typechecktest = CheckCompressionType(fcontents, closefp=False)
|
|
3702
|
+
fcontents.seek(0, 0)
|
|
3703
|
+
fcencoding = GetFileEncoding(fcontents, False)
|
|
3704
|
+
if(typechecktest is False and not compresswholefile):
|
|
3685
3705
|
fcontents.seek(0, 2)
|
|
3686
3706
|
ucfsize = fcontents.tell()
|
|
3687
3707
|
fcontents.seek(0, 0)
|
|
@@ -3696,16 +3716,13 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, filevalues=[], ext
|
|
|
3696
3716
|
fcontents.seek(0, 0)
|
|
3697
3717
|
cfcontents.seek(0, 0)
|
|
3698
3718
|
cfcontents = CompressOpenFileAlt(
|
|
3699
|
-
cfcontents, compressionuselist[ilmin], compressionlevel, formatspecs)
|
|
3719
|
+
cfcontents, compressionuselist[ilmin], compressionlevel, compressionuselist, formatspecs)
|
|
3700
3720
|
if(cfcontents):
|
|
3701
3721
|
cfcontents.seek(0, 2)
|
|
3702
3722
|
ilcsize.append(cfcontents.tell())
|
|
3703
3723
|
cfcontents.close()
|
|
3704
3724
|
else:
|
|
3705
|
-
|
|
3706
|
-
ilcsize.append(sys.maxint)
|
|
3707
|
-
except AttributeError:
|
|
3708
|
-
ilcsize.append(sys.maxsize)
|
|
3725
|
+
ilcsize.append(float("inf"))
|
|
3709
3726
|
ilmin = ilmin + 1
|
|
3710
3727
|
ilcmin = ilcsize.index(min(ilcsize))
|
|
3711
3728
|
curcompression = compressionuselist[ilcmin]
|
|
@@ -3714,7 +3731,7 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, filevalues=[], ext
|
|
|
3714
3731
|
shutil.copyfileobj(fcontents, cfcontents)
|
|
3715
3732
|
cfcontents.seek(0, 0)
|
|
3716
3733
|
cfcontents = CompressOpenFileAlt(
|
|
3717
|
-
cfcontents, curcompression, compressionlevel, formatspecs)
|
|
3734
|
+
cfcontents, curcompression, compressionlevel, compressionuselist, formatspecs)
|
|
3718
3735
|
cfcontents.seek(0, 2)
|
|
3719
3736
|
cfsize = cfcontents.tell()
|
|
3720
3737
|
if(ucfsize > cfsize):
|
|
@@ -3756,7 +3773,7 @@ def AppendListsWithContent(inlist, fp, dirlistfromtxt=False, filevalues=[], extr
|
|
|
3756
3773
|
inodetoforminode = {}
|
|
3757
3774
|
numfiles = int(len(GetDirList))
|
|
3758
3775
|
fnumfiles = format(numfiles, 'x').lower()
|
|
3759
|
-
AppendFileHeader(fp,
|
|
3776
|
+
AppendFileHeader(fp, numfiles, "UTF-8", [], checksumtype[0], formatspecs)
|
|
3760
3777
|
for curfname in GetDirList:
|
|
3761
3778
|
ftype = format(curfname[0], 'x').lower()
|
|
3762
3779
|
fencoding = curfname[1]
|
|
@@ -3858,7 +3875,7 @@ def AppendFilesWithContentToOutFile(infiles, outfile, dirlistfromtxt=False, fmtt
|
|
|
3858
3875
|
compresswholefile, compressionlevel, compressionuselist, followlink, checksumtype, formatspecs, verbose)
|
|
3859
3876
|
if(outfile == "-" or outfile is None or hasattr(outfile, "read") or hasattr(outfile, "write")):
|
|
3860
3877
|
fp = CompressOpenFileAlt(
|
|
3861
|
-
fp, compression, compressionlevel, formatspecs)
|
|
3878
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
3862
3879
|
try:
|
|
3863
3880
|
fp.flush()
|
|
3864
3881
|
if(hasattr(os, "sync")):
|
|
@@ -3882,7 +3899,7 @@ def AppendFilesWithContentToOutFile(infiles, outfile, dirlistfromtxt=False, fmtt
|
|
|
3882
3899
|
return outvar
|
|
3883
3900
|
elif((not hasattr(outfile, "read") and not hasattr(outfile, "write")) and re.findall("^(ftp|ftps|sftp):\\/\\/", outfile)):
|
|
3884
3901
|
fp = CompressOpenFileAlt(
|
|
3885
|
-
fp, compression, compressionlevel, formatspecs)
|
|
3902
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
3886
3903
|
fp.seek(0, 0)
|
|
3887
3904
|
upload_file_to_internet_file(fp, outfile)
|
|
3888
3905
|
if(returnfp):
|
|
@@ -3938,7 +3955,7 @@ def AppendListsWithContentToOutFile(inlist, outfile, dirlistfromtxt=False, fmtty
|
|
|
3938
3955
|
compresswholefile, compressionlevel, followlink, checksumtype, formatspecs, verbose)
|
|
3939
3956
|
if(outfile == "-" or outfile is None or hasattr(outfile, "read") or hasattr(outfile, "write")):
|
|
3940
3957
|
fp = CompressOpenFileAlt(
|
|
3941
|
-
fp, compression, compressionlevel, formatspecs)
|
|
3958
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
3942
3959
|
try:
|
|
3943
3960
|
fp.flush()
|
|
3944
3961
|
if(hasattr(os, "sync")):
|
|
@@ -3962,7 +3979,7 @@ def AppendListsWithContentToOutFile(inlist, outfile, dirlistfromtxt=False, fmtty
|
|
|
3962
3979
|
return outvar
|
|
3963
3980
|
elif((not hasattr(outfile, "read") and not hasattr(outfile, "write")) and re.findall("^(ftp|ftps|sftp):\\/\\/", outfile)):
|
|
3964
3981
|
fp = CompressOpenFileAlt(
|
|
3965
|
-
fp, compression, compressionlevel, formatspecs)
|
|
3982
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
3966
3983
|
fp.seek(0, 0)
|
|
3967
3984
|
upload_file_to_internet_file(fp, outfile)
|
|
3968
3985
|
if(returnfp):
|
|
@@ -4653,13 +4670,13 @@ def UncompressBytesAltFP(fp, formatspecs=__file_format_multi_dict__):
|
|
|
4653
4670
|
return filefp
|
|
4654
4671
|
|
|
4655
4672
|
|
|
4656
|
-
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__):
|
|
4657
4674
|
if(not hasattr(fp, "read")):
|
|
4658
4675
|
return False
|
|
4659
4676
|
fp.seek(0, 0)
|
|
4660
4677
|
if(not compression or compression == formatspecs['format_magic']):
|
|
4661
4678
|
compression = "auto"
|
|
4662
|
-
if(compression not in
|
|
4679
|
+
if(compression not in compressionuselist and compression is None):
|
|
4663
4680
|
compression = "auto"
|
|
4664
4681
|
if(compression == "gzip" and compression in compressionsupport):
|
|
4665
4682
|
bytesfp = BytesIO()
|
|
@@ -4878,7 +4895,7 @@ def PackFoxFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", compress
|
|
|
4878
4895
|
outfile = RemoveWindowsPath(outfile)
|
|
4879
4896
|
if(not compression or compression == formatspecs['format_magic']):
|
|
4880
4897
|
compression = "auto"
|
|
4881
|
-
if(compression not in
|
|
4898
|
+
if(compression not in compressionuselist and compression is None):
|
|
4882
4899
|
compression = "auto"
|
|
4883
4900
|
if(verbose):
|
|
4884
4901
|
logging.basicConfig(format="%(message)s",
|
|
@@ -5045,7 +5062,7 @@ def PackFoxFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", compress
|
|
|
5045
5062
|
elif ftype in data_types:
|
|
5046
5063
|
fsize = format(int(fstatinfo.st_size), 'x').lower()
|
|
5047
5064
|
else:
|
|
5048
|
-
fsize = format(int(fstatinfo.st_size)).lower()
|
|
5065
|
+
fsize = format(int(fstatinfo.st_size), 'x').lower()
|
|
5049
5066
|
fatime = format(int(fstatinfo.st_atime), 'x').lower()
|
|
5050
5067
|
fmtime = format(int(fstatinfo.st_mtime), 'x').lower()
|
|
5051
5068
|
fctime = format(int(fstatinfo.st_ctime), 'x').lower()
|
|
@@ -5092,11 +5109,14 @@ def PackFoxFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", compress
|
|
|
5092
5109
|
fcsize = format(int(0), 'x').lower()
|
|
5093
5110
|
fcontents = BytesIO()
|
|
5094
5111
|
fcencoding = "UTF-8"
|
|
5095
|
-
|
|
5112
|
+
curcompression = "none"
|
|
5113
|
+
if not followlink and ftype in data_types:
|
|
5096
5114
|
with open(fname, "rb") as fpc:
|
|
5097
5115
|
shutil.copyfileobj(fpc, fcontents)
|
|
5116
|
+
typechecktest = CheckCompressionType(fcontents, closefp=False)
|
|
5117
|
+
fcontents.seek(0, 0)
|
|
5098
5118
|
fcencoding = GetFileEncoding(fcontents, False)
|
|
5099
|
-
if(not compresswholefile):
|
|
5119
|
+
if(typechecktest is False and not compresswholefile):
|
|
5100
5120
|
fcontents.seek(0, 2)
|
|
5101
5121
|
ucfsize = fcontents.tell()
|
|
5102
5122
|
fcontents.seek(0, 0)
|
|
@@ -5111,16 +5131,13 @@ def PackFoxFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", compress
|
|
|
5111
5131
|
fcontents.seek(0, 0)
|
|
5112
5132
|
cfcontents.seek(0, 0)
|
|
5113
5133
|
cfcontents = CompressOpenFileAlt(
|
|
5114
|
-
cfcontents, compressionuselist[ilmin], compressionlevel, formatspecs)
|
|
5134
|
+
cfcontents, compressionuselist[ilmin], compressionlevel, compressionuselist, formatspecs)
|
|
5115
5135
|
if(cfcontents):
|
|
5116
5136
|
cfcontents.seek(0, 2)
|
|
5117
5137
|
ilcsize.append(cfcontents.tell())
|
|
5118
5138
|
cfcontents.close()
|
|
5119
5139
|
else:
|
|
5120
|
-
|
|
5121
|
-
ilcsize.append(sys.maxint)
|
|
5122
|
-
except AttributeError:
|
|
5123
|
-
ilcsize.append(sys.maxsize)
|
|
5140
|
+
ilcsize.append(float("inf"))
|
|
5124
5141
|
ilmin = ilmin + 1
|
|
5125
5142
|
ilcmin = ilcsize.index(min(ilcsize))
|
|
5126
5143
|
curcompression = compressionuselist[ilcmin]
|
|
@@ -5129,7 +5146,7 @@ def PackFoxFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", compress
|
|
|
5129
5146
|
shutil.copyfileobj(fcontents, cfcontents)
|
|
5130
5147
|
cfcontents.seek(0, 0)
|
|
5131
5148
|
cfcontents = CompressOpenFileAlt(
|
|
5132
|
-
cfcontents, curcompression, compressionlevel, formatspecs)
|
|
5149
|
+
cfcontents, curcompression, compressionlevel, compressionuselist, formatspecs)
|
|
5133
5150
|
cfcontents.seek(0, 2)
|
|
5134
5151
|
cfsize = cfcontents.tell()
|
|
5135
5152
|
if(ucfsize > cfsize):
|
|
@@ -5137,15 +5154,16 @@ def PackFoxFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", compress
|
|
|
5137
5154
|
fcompression = curcompression
|
|
5138
5155
|
fcontents.close()
|
|
5139
5156
|
fcontents = cfcontents
|
|
5140
|
-
|
|
5141
|
-
fcompression = ""
|
|
5142
|
-
if(followlink and (ftype == 1 or ftype == 2)):
|
|
5157
|
+
elif followlink and (ftype == 1 or ftype == 2):
|
|
5143
5158
|
if(not os.path.exists(flinkname)):
|
|
5144
5159
|
return False
|
|
5145
5160
|
flstatinfo = os.stat(flinkname)
|
|
5146
5161
|
with open(flinkname, "rb") as fpc:
|
|
5147
5162
|
shutil.copyfileobj(fpc, fcontents)
|
|
5148
|
-
|
|
5163
|
+
typechecktest = CheckCompressionType(fcontents, closefp=False)
|
|
5164
|
+
fcontents.seek(0, 0)
|
|
5165
|
+
fcencoding = GetFileEncoding(fcontents, False)
|
|
5166
|
+
if(typechecktest is False and not compresswholefile):
|
|
5149
5167
|
fcontents.seek(0, 2)
|
|
5150
5168
|
ucfsize = fcontents.tell()
|
|
5151
5169
|
fcontents.seek(0, 0)
|
|
@@ -5160,16 +5178,13 @@ def PackFoxFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", compress
|
|
|
5160
5178
|
fcontents.seek(0, 0)
|
|
5161
5179
|
cfcontents.seek(0, 0)
|
|
5162
5180
|
cfcontents = CompressOpenFileAlt(
|
|
5163
|
-
cfcontents, compressionuselist[ilmin], compressionlevel, formatspecs)
|
|
5181
|
+
cfcontents, compressionuselist[ilmin], compressionlevel, compressionuselist, formatspecs)
|
|
5164
5182
|
if(cfcontents):
|
|
5165
5183
|
cfcontents.seek(0, 2)
|
|
5166
5184
|
ilcsize.append(cfcontents.tell())
|
|
5167
5185
|
cfcontents.close()
|
|
5168
5186
|
else:
|
|
5169
|
-
|
|
5170
|
-
ilcsize.append(sys.maxint)
|
|
5171
|
-
except AttributeError:
|
|
5172
|
-
ilcsize.append(sys.maxsize)
|
|
5187
|
+
ilcsize.append(float("inf"))
|
|
5173
5188
|
ilmin = ilmin + 1
|
|
5174
5189
|
ilcmin = ilcsize.index(min(ilcsize))
|
|
5175
5190
|
curcompression = compressionuselist[ilcmin]
|
|
@@ -5178,7 +5193,7 @@ def PackFoxFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", compress
|
|
|
5178
5193
|
shutil.copyfileobj(fcontents, cfcontents)
|
|
5179
5194
|
cfcontents.seek(0, 0)
|
|
5180
5195
|
cfcontents = CompressOpenFileAlt(
|
|
5181
|
-
cfcontents, curcompression, compressionlevel, formatspecs)
|
|
5196
|
+
cfcontents, curcompression, compressionlevel, compressionuselist, formatspecs)
|
|
5182
5197
|
cfcontents.seek(0, 2)
|
|
5183
5198
|
cfsize = cfcontents.tell()
|
|
5184
5199
|
if(ucfsize > cfsize):
|
|
@@ -5186,6 +5201,8 @@ def PackFoxFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", compress
|
|
|
5186
5201
|
fcompression = curcompression
|
|
5187
5202
|
fcontents.close()
|
|
5188
5203
|
fcontents = cfcontents
|
|
5204
|
+
if(fcompression == "none"):
|
|
5205
|
+
fcompression = ""
|
|
5189
5206
|
fcontents.seek(0, 0)
|
|
5190
5207
|
ftypehex = format(ftype, 'x').lower()
|
|
5191
5208
|
tmpoutlist = [ftypehex, fencoding, fcencoding, fname, flinkname, fsize, fatime, fmtime, fctime, fbtime, fmode, fwinattributes, fcompression,
|
|
@@ -5201,7 +5218,7 @@ def PackFoxFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", compress
|
|
|
5201
5218
|
return False
|
|
5202
5219
|
if(outfile == "-" or outfile is None or hasattr(outfile, "read") or hasattr(outfile, "write")):
|
|
5203
5220
|
fp = CompressOpenFileAlt(
|
|
5204
|
-
fp, compression, compressionlevel, formatspecs)
|
|
5221
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
5205
5222
|
try:
|
|
5206
5223
|
fp.flush()
|
|
5207
5224
|
if(hasattr(os, "sync")):
|
|
@@ -5225,7 +5242,7 @@ def PackFoxFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", compress
|
|
|
5225
5242
|
return outvar
|
|
5226
5243
|
elif((not hasattr(outfile, "read") and not hasattr(outfile, "write")) and re.findall("^(ftp|ftps|sftp):\\/\\/", outfile)):
|
|
5227
5244
|
fp = CompressOpenFileAlt(
|
|
5228
|
-
fp, compression, compressionlevel, formatspecs)
|
|
5245
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
5229
5246
|
fp.seek(0, 0)
|
|
5230
5247
|
upload_file_to_internet_file(fp, outfile)
|
|
5231
5248
|
if(returnfp):
|
|
@@ -5263,7 +5280,7 @@ def PackFoxFileFromTarFile(infile, outfile, fmttype="auto", compression="auto",
|
|
|
5263
5280
|
outfile = RemoveWindowsPath(outfile)
|
|
5264
5281
|
if(not compression or compression == formatspecs['format_magic']):
|
|
5265
5282
|
compression = "auto"
|
|
5266
|
-
if(compression not in
|
|
5283
|
+
if(compression not in compressionuselist and compression is None):
|
|
5267
5284
|
compression = "auto"
|
|
5268
5285
|
if(verbose):
|
|
5269
5286
|
logging.basicConfig(format="%(message)s", stream=sys.stdout, level=logging.DEBUG)
|
|
@@ -5338,7 +5355,7 @@ def PackFoxFileFromTarFile(infile, outfile, fmttype="auto", compression="auto",
|
|
|
5338
5355
|
if 'zstandard' in sys.modules:
|
|
5339
5356
|
infile = ZstdFile(fileobj=infile, mode="rb")
|
|
5340
5357
|
elif 'pyzstd' in sys.modules:
|
|
5341
|
-
|
|
5358
|
+
infile = pyzstd.zstdfile.ZstdFile(fileobj=infile, mode="rb")
|
|
5342
5359
|
tarfp = tarfile.open(fileobj=infile, mode="r")
|
|
5343
5360
|
else:
|
|
5344
5361
|
tarfp = tarfile.open(fileobj=infile, mode="r")
|
|
@@ -5350,7 +5367,7 @@ def PackFoxFileFromTarFile(infile, outfile, fmttype="auto", compression="auto",
|
|
|
5350
5367
|
if 'zstandard' in sys.modules:
|
|
5351
5368
|
infile = ZstdFile(fileobj=infile, mode="rb")
|
|
5352
5369
|
elif 'pyzstd' in sys.modules:
|
|
5353
|
-
|
|
5370
|
+
infile = pyzstd.zstdfile.ZstdFile(fileobj=infile, mode="rb")
|
|
5354
5371
|
tarfp = tarfile.open(fileobj=infile, mode="r")
|
|
5355
5372
|
else:
|
|
5356
5373
|
tarfp = tarfile.open(infile, "r")
|
|
@@ -5439,11 +5456,15 @@ def PackFoxFileFromTarFile(infile, outfile, fmttype="auto", compression="auto",
|
|
|
5439
5456
|
fcsize = format(int(0), 'x').lower()
|
|
5440
5457
|
fcontents = BytesIO()
|
|
5441
5458
|
fcencoding = "UTF-8"
|
|
5459
|
+
curcompression = "none"
|
|
5442
5460
|
if ftype in data_types:
|
|
5443
5461
|
fpc = tarfp.extractfile(member)
|
|
5462
|
+
fpc.close()
|
|
5444
5463
|
shutil.copyfileobj(fpc, fcontents)
|
|
5464
|
+
typechecktest = CheckCompressionType(fcontents, closefp=False)
|
|
5465
|
+
fcontents.seek(0, 0)
|
|
5445
5466
|
fcencoding = GetFileEncoding(fcontents, False)
|
|
5446
|
-
if(not compresswholefile):
|
|
5467
|
+
if(typechecktest is False and not compresswholefile):
|
|
5447
5468
|
fcontents.seek(0, 2)
|
|
5448
5469
|
ucfsize = fcontents.tell()
|
|
5449
5470
|
fcontents.seek(0, 0)
|
|
@@ -5458,16 +5479,13 @@ def PackFoxFileFromTarFile(infile, outfile, fmttype="auto", compression="auto",
|
|
|
5458
5479
|
fcontents.seek(0, 0)
|
|
5459
5480
|
cfcontents.seek(0, 0)
|
|
5460
5481
|
cfcontents = CompressOpenFileAlt(
|
|
5461
|
-
cfcontents, compressionuselist[ilmin], compressionlevel, formatspecs)
|
|
5482
|
+
cfcontents, compressionuselist[ilmin], compressionlevel, compressionuselist, formatspecs)
|
|
5462
5483
|
if(cfcontents):
|
|
5463
5484
|
cfcontents.seek(0, 2)
|
|
5464
5485
|
ilcsize.append(cfcontents.tell())
|
|
5465
5486
|
cfcontents.close()
|
|
5466
5487
|
else:
|
|
5467
|
-
|
|
5468
|
-
ilcsize.append(sys.maxint)
|
|
5469
|
-
except AttributeError:
|
|
5470
|
-
ilcsize.append(sys.maxsize)
|
|
5488
|
+
ilcsize.append(float("inf"))
|
|
5471
5489
|
ilmin = ilmin + 1
|
|
5472
5490
|
ilcmin = ilcsize.index(min(ilcsize))
|
|
5473
5491
|
curcompression = compressionuselist[ilcmin]
|
|
@@ -5476,7 +5494,7 @@ def PackFoxFileFromTarFile(infile, outfile, fmttype="auto", compression="auto",
|
|
|
5476
5494
|
shutil.copyfileobj(fcontents, cfcontents)
|
|
5477
5495
|
cfcontents.seek(0, 0)
|
|
5478
5496
|
cfcontents = CompressOpenFileAlt(
|
|
5479
|
-
cfcontents, curcompression, compressionlevel, formatspecs)
|
|
5497
|
+
cfcontents, curcompression, compressionlevel, compressionuselist, formatspecs)
|
|
5480
5498
|
cfcontents.seek(0, 2)
|
|
5481
5499
|
cfsize = cfcontents.tell()
|
|
5482
5500
|
if(ucfsize > cfsize):
|
|
@@ -5501,7 +5519,7 @@ def PackFoxFileFromTarFile(infile, outfile, fmttype="auto", compression="auto",
|
|
|
5501
5519
|
return False
|
|
5502
5520
|
if(outfile == "-" or outfile is None or hasattr(outfile, "read") or hasattr(outfile, "write")):
|
|
5503
5521
|
fp = CompressOpenFileAlt(
|
|
5504
|
-
fp, compression, compressionlevel, formatspecs)
|
|
5522
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
5505
5523
|
try:
|
|
5506
5524
|
fp.flush()
|
|
5507
5525
|
if(hasattr(os, "sync")):
|
|
@@ -5525,7 +5543,7 @@ def PackFoxFileFromTarFile(infile, outfile, fmttype="auto", compression="auto",
|
|
|
5525
5543
|
return outvar
|
|
5526
5544
|
elif((not hasattr(outfile, "read") and not hasattr(outfile, "write")) and re.findall("^(ftp|ftps|sftp):\\/\\/", outfile)):
|
|
5527
5545
|
fp = CompressOpenFileAlt(
|
|
5528
|
-
fp, compression, compressionlevel, formatspecs)
|
|
5546
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
5529
5547
|
fp.seek(0, 0)
|
|
5530
5548
|
upload_file_to_internet_file(fp, outfile)
|
|
5531
5549
|
if(returnfp):
|
|
@@ -5559,7 +5577,7 @@ def PackFoxFileFromZipFile(infile, outfile, fmttype="auto", compression="auto",
|
|
|
5559
5577
|
outfile = RemoveWindowsPath(outfile)
|
|
5560
5578
|
if(not compression or compression == formatspecs['format_magic']):
|
|
5561
5579
|
compression = "auto"
|
|
5562
|
-
if(compression not in
|
|
5580
|
+
if(compression not in compressionuselist and compression is None):
|
|
5563
5581
|
compression = "auto"
|
|
5564
5582
|
if(verbose):
|
|
5565
5583
|
logging.basicConfig(format="%(message)s", stream=sys.stdout, level=logging.DEBUG)
|
|
@@ -5737,10 +5755,13 @@ def PackFoxFileFromZipFile(infile, outfile, fmttype="auto", compression="auto",
|
|
|
5737
5755
|
fgname = ""
|
|
5738
5756
|
fcontents = BytesIO()
|
|
5739
5757
|
fcencoding = "UTF-8"
|
|
5740
|
-
|
|
5758
|
+
curcompression = "none"
|
|
5759
|
+
if ftype == 0:
|
|
5741
5760
|
fcontents.write(zipfp.read(member.filename))
|
|
5761
|
+
typechecktest = CheckCompressionType(fcontents, closefp=False)
|
|
5762
|
+
fcontents.seek(0, 0)
|
|
5742
5763
|
fcencoding = GetFileEncoding(fcontents, False)
|
|
5743
|
-
if(not compresswholefile):
|
|
5764
|
+
if(typechecktest is False and not compresswholefile):
|
|
5744
5765
|
fcontents.seek(0, 2)
|
|
5745
5766
|
ucfsize = fcontents.tell()
|
|
5746
5767
|
fcontents.seek(0, 0)
|
|
@@ -5755,7 +5776,7 @@ def PackFoxFileFromZipFile(infile, outfile, fmttype="auto", compression="auto",
|
|
|
5755
5776
|
fcontents.seek(0, 0)
|
|
5756
5777
|
cfcontents.seek(0, 0)
|
|
5757
5778
|
cfcontents = CompressOpenFileAlt(
|
|
5758
|
-
cfcontents, compressionuselist[ilmin], compressionlevel, formatspecs)
|
|
5779
|
+
cfcontents, compressionuselist[ilmin], compressionlevel, compressionuselist, formatspecs)
|
|
5759
5780
|
cfcontents.seek(0, 2)
|
|
5760
5781
|
ilcsize.append(cfcontents.tell())
|
|
5761
5782
|
cfcontents.close()
|
|
@@ -5767,7 +5788,7 @@ def PackFoxFileFromZipFile(infile, outfile, fmttype="auto", compression="auto",
|
|
|
5767
5788
|
shutil.copyfileobj(fcontents, cfcontents)
|
|
5768
5789
|
cfcontents.seek(0, 0)
|
|
5769
5790
|
cfcontents = CompressOpenFileAlt(
|
|
5770
|
-
cfcontents, curcompression, compressionlevel, formatspecs)
|
|
5791
|
+
cfcontents, curcompression, compressionlevel, compressionuselist, formatspecs)
|
|
5771
5792
|
cfcontents.seek(0, 2)
|
|
5772
5793
|
cfsize = cfcontents.tell()
|
|
5773
5794
|
if(ucfsize > cfsize):
|
|
@@ -5792,7 +5813,7 @@ def PackFoxFileFromZipFile(infile, outfile, fmttype="auto", compression="auto",
|
|
|
5792
5813
|
return False
|
|
5793
5814
|
if(outfile == "-" or outfile is None or hasattr(outfile, "read") or hasattr(outfile, "write")):
|
|
5794
5815
|
fp = CompressOpenFileAlt(
|
|
5795
|
-
fp, compression, compressionlevel, formatspecs)
|
|
5816
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
5796
5817
|
try:
|
|
5797
5818
|
fp.flush()
|
|
5798
5819
|
if(hasattr(os, "sync")):
|
|
@@ -5816,7 +5837,7 @@ def PackFoxFileFromZipFile(infile, outfile, fmttype="auto", compression="auto",
|
|
|
5816
5837
|
return outvar
|
|
5817
5838
|
elif((not hasattr(outfile, "read") and not hasattr(outfile, "write")) and re.findall("^(ftp|ftps|sftp):\\/\\/", outfile)):
|
|
5818
5839
|
fp = CompressOpenFileAlt(
|
|
5819
|
-
fp, compression, compressionlevel, formatspecs)
|
|
5840
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
5820
5841
|
fp.seek(0, 0)
|
|
5821
5842
|
upload_file_to_internet_file(fp, outfile)
|
|
5822
5843
|
if(returnfp):
|
|
@@ -5855,7 +5876,7 @@ if(rarfile_support):
|
|
|
5855
5876
|
outfile = RemoveWindowsPath(outfile)
|
|
5856
5877
|
if(not compression or compression == formatspecs['format_magic']):
|
|
5857
5878
|
compression = "auto"
|
|
5858
|
-
if(compression not in
|
|
5879
|
+
if(compression not in compressionuselist and compression is None):
|
|
5859
5880
|
compression = "auto"
|
|
5860
5881
|
if(verbose):
|
|
5861
5882
|
logging.basicConfig(format="%(message)s", stream=sys.stdout, level=logging.DEBUG)
|
|
@@ -6051,10 +6072,13 @@ if(rarfile_support):
|
|
|
6051
6072
|
fgname = ""
|
|
6052
6073
|
fcontents = BytesIO()
|
|
6053
6074
|
fcencoding = "UTF-8"
|
|
6054
|
-
|
|
6075
|
+
curcompression = "none"
|
|
6076
|
+
if ftype == 0:
|
|
6055
6077
|
fcontents.write(rarfp.read(member.filename))
|
|
6078
|
+
typechecktest = CheckCompressionType(fcontents, closefp=False)
|
|
6079
|
+
fcontents.seek(0, 0)
|
|
6056
6080
|
fcencoding = GetFileEncoding(fcontents, False)
|
|
6057
|
-
if(not compresswholefile):
|
|
6081
|
+
if(typechecktest is False and not compresswholefile):
|
|
6058
6082
|
fcontents.seek(0, 2)
|
|
6059
6083
|
ucfsize = fcontents.tell()
|
|
6060
6084
|
fcontents.seek(0, 0)
|
|
@@ -6069,16 +6093,13 @@ if(rarfile_support):
|
|
|
6069
6093
|
fcontents.seek(0, 0)
|
|
6070
6094
|
cfcontents.seek(0, 0)
|
|
6071
6095
|
cfcontents = CompressOpenFileAlt(
|
|
6072
|
-
cfcontents, compressionuselist[ilmin], compressionlevel, formatspecs)
|
|
6096
|
+
cfcontents, compressionuselist[ilmin], compressionlevel, compressionuselist, formatspecs)
|
|
6073
6097
|
if(cfcontents):
|
|
6074
6098
|
cfcontents.seek(0, 2)
|
|
6075
6099
|
ilcsize.append(cfcontents.tell())
|
|
6076
6100
|
cfcontents.close()
|
|
6077
6101
|
else:
|
|
6078
|
-
|
|
6079
|
-
ilcsize.append(sys.maxint)
|
|
6080
|
-
except AttributeError:
|
|
6081
|
-
ilcsize.append(sys.maxsize)
|
|
6102
|
+
ilcsize.append(float("inf"))
|
|
6082
6103
|
ilmin = ilmin + 1
|
|
6083
6104
|
ilcmin = ilcsize.index(min(ilcsize))
|
|
6084
6105
|
curcompression = compressionuselist[ilcmin]
|
|
@@ -6087,12 +6108,12 @@ if(rarfile_support):
|
|
|
6087
6108
|
shutil.copyfileobj(fcontents, cfcontents)
|
|
6088
6109
|
cfcontents.seek(0, 0)
|
|
6089
6110
|
cfcontents = CompressOpenFileAlt(
|
|
6090
|
-
cfcontents, curcompression, compressionlevel, formatspecs)
|
|
6111
|
+
cfcontents, curcompression, compressionlevel, compressionuselist, formatspecs)
|
|
6091
6112
|
cfcontents.seek(0, 2)
|
|
6092
6113
|
cfsize = cfcontents.tell()
|
|
6093
6114
|
if(ucfsize > cfsize):
|
|
6094
6115
|
fcsize = format(int(cfsize), 'x').lower()
|
|
6095
|
-
fcompression =
|
|
6116
|
+
fcompression = curcompression
|
|
6096
6117
|
fcontents.close()
|
|
6097
6118
|
fcontents = cfcontents
|
|
6098
6119
|
if(fcompression == "none"):
|
|
@@ -6112,7 +6133,7 @@ if(rarfile_support):
|
|
|
6112
6133
|
return False
|
|
6113
6134
|
if(outfile == "-" or outfile is None or hasattr(outfile, "read") or hasattr(outfile, "write")):
|
|
6114
6135
|
fp = CompressOpenFileAlt(
|
|
6115
|
-
fp, compression, compressionlevel, formatspecs)
|
|
6136
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
6116
6137
|
try:
|
|
6117
6138
|
fp.flush()
|
|
6118
6139
|
if(hasattr(os, "sync")):
|
|
@@ -6136,7 +6157,7 @@ if(rarfile_support):
|
|
|
6136
6157
|
return outvar
|
|
6137
6158
|
elif((not hasattr(outfile, "read") and not hasattr(outfile, "write")) and re.findall("^(ftp|ftps|sftp):\\/\\/", outfile)):
|
|
6138
6159
|
fp = CompressOpenFileAlt(
|
|
6139
|
-
fp, compression, compressionlevel, formatspecs)
|
|
6160
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
6140
6161
|
fp.seek(0, 0)
|
|
6141
6162
|
upload_file_to_internet_file(fp, outfile)
|
|
6142
6163
|
if(returnfp):
|
|
@@ -6175,7 +6196,7 @@ if(py7zr_support):
|
|
|
6175
6196
|
outfile = RemoveWindowsPath(outfile)
|
|
6176
6197
|
if(not compression or compression == formatspecs['format_magic']):
|
|
6177
6198
|
compression = "auto"
|
|
6178
|
-
if(compression not in
|
|
6199
|
+
if(compression not in compressionuselist and compression is None):
|
|
6179
6200
|
compression = "auto"
|
|
6180
6201
|
if(verbose):
|
|
6181
6202
|
logging.basicConfig(format="%(message)s", stream=sys.stdout, level=logging.DEBUG)
|
|
@@ -6302,12 +6323,16 @@ if(py7zr_support):
|
|
|
6302
6323
|
fgname = ""
|
|
6303
6324
|
fcontents = BytesIO()
|
|
6304
6325
|
fcencoding = "UTF-8"
|
|
6305
|
-
|
|
6326
|
+
curcompression = "none"
|
|
6327
|
+
if ftype == 0:
|
|
6306
6328
|
fcontents.write(file_content[member.filename].read())
|
|
6307
|
-
fcencoding = GetFileEncoding(fcontents, False)
|
|
6308
6329
|
fsize = format(fcontents.tell(), 'x').lower()
|
|
6330
|
+
fcontents.seek(0, 0)
|
|
6331
|
+
typechecktest = CheckCompressionType(fcontents, closefp=False)
|
|
6332
|
+
fcontents.seek(0, 0)
|
|
6333
|
+
fcencoding = GetFileEncoding(fcontents, False)
|
|
6309
6334
|
file_content[member.filename].close()
|
|
6310
|
-
if(not compresswholefile):
|
|
6335
|
+
if(typechecktest is False and not compresswholefile):
|
|
6311
6336
|
fcontents.seek(0, 2)
|
|
6312
6337
|
ucfsize = fcontents.tell()
|
|
6313
6338
|
fcontents.seek(0, 0)
|
|
@@ -6322,16 +6347,13 @@ if(py7zr_support):
|
|
|
6322
6347
|
fcontents.seek(0, 0)
|
|
6323
6348
|
cfcontents.seek(0, 0)
|
|
6324
6349
|
cfcontents = CompressOpenFileAlt(
|
|
6325
|
-
cfcontents, compressionuselist[ilmin], compressionlevel, formatspecs)
|
|
6350
|
+
cfcontents, compressionuselist[ilmin], compressionlevel, compressionuselist, formatspecs)
|
|
6326
6351
|
if(cfcontents):
|
|
6327
6352
|
cfcontents.seek(0, 2)
|
|
6328
6353
|
ilcsize.append(cfcontents.tell())
|
|
6329
6354
|
cfcontents.close()
|
|
6330
6355
|
else:
|
|
6331
|
-
|
|
6332
|
-
ilcsize.append(sys.maxint)
|
|
6333
|
-
except AttributeError:
|
|
6334
|
-
ilcsize.append(sys.maxsize)
|
|
6356
|
+
ilcsize.append(float("inf"))
|
|
6335
6357
|
ilmin = ilmin + 1
|
|
6336
6358
|
ilcmin = ilcsize.index(min(ilcsize))
|
|
6337
6359
|
curcompression = compressionuselist[ilcmin]
|
|
@@ -6340,7 +6362,7 @@ if(py7zr_support):
|
|
|
6340
6362
|
shutil.copyfileobj(fcontents, cfcontents)
|
|
6341
6363
|
cfcontents.seek(0, 0)
|
|
6342
6364
|
cfcontents = CompressOpenFileAlt(
|
|
6343
|
-
cfcontents, curcompression, compressionlevel, formatspecs)
|
|
6365
|
+
cfcontents, curcompression, compressionlevel, compressionuselist, formatspecs)
|
|
6344
6366
|
cfcontents.seek(0, 2)
|
|
6345
6367
|
cfsize = cfcontents.tell()
|
|
6346
6368
|
if(ucfsize > cfsize):
|
|
@@ -6365,7 +6387,7 @@ if(py7zr_support):
|
|
|
6365
6387
|
return False
|
|
6366
6388
|
if(outfile == "-" or outfile is None or hasattr(outfile, "read") or hasattr(outfile, "write")):
|
|
6367
6389
|
fp = CompressOpenFileAlt(
|
|
6368
|
-
fp, compression, compressionlevel, formatspecs)
|
|
6390
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
6369
6391
|
try:
|
|
6370
6392
|
fp.flush()
|
|
6371
6393
|
if(hasattr(os, "sync")):
|
|
@@ -6389,7 +6411,7 @@ if(py7zr_support):
|
|
|
6389
6411
|
return outvar
|
|
6390
6412
|
elif((not hasattr(outfile, "read") and not hasattr(outfile, "write")) and re.findall("^(ftp|ftps|sftp):\\/\\/", outfile)):
|
|
6391
6413
|
fp = CompressOpenFileAlt(
|
|
6392
|
-
fp, compression, compressionlevel, formatspecs)
|
|
6414
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
6393
6415
|
fp.seek(0, 0)
|
|
6394
6416
|
upload_file_to_internet_file(fp, outfile)
|
|
6395
6417
|
if(returnfp):
|
|
@@ -7586,11 +7608,11 @@ def FoxFileToArray(infile, fmttype="auto", seekstart=0, seekend=0, listonly=Fals
|
|
|
7586
7608
|
if(fcompresstype==formatspecs['format_magic']):
|
|
7587
7609
|
fcompresstype = ""
|
|
7588
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': []}
|
|
7589
|
-
if(seekstart < 0
|
|
7611
|
+
if (seekstart < 0) or (seekstart > fnumfiles):
|
|
7590
7612
|
seekstart = 0
|
|
7591
|
-
if(seekend == 0 or seekend > fnumfiles
|
|
7613
|
+
if (seekend == 0) or (seekend > fnumfiles) or (seekend < seekstart):
|
|
7592
7614
|
seekend = fnumfiles
|
|
7593
|
-
elif(seekend < 0 and abs(seekend) <= fnumfiles and abs(seekend) >= seekstart):
|
|
7615
|
+
elif (seekend < 0) and (abs(seekend) <= fnumfiles) and (abs(seekend) >= seekstart):
|
|
7594
7616
|
seekend = fnumfiles - abs(seekend)
|
|
7595
7617
|
if(seekstart > 0):
|
|
7596
7618
|
il = 0
|
|
@@ -7881,7 +7903,7 @@ def MultipleFoxFileToArray(infile, fmttype="auto", seekstart=0, seekend=0, listo
|
|
|
7881
7903
|
infile = [infile]
|
|
7882
7904
|
outretval = {}
|
|
7883
7905
|
for curfname in infile:
|
|
7884
|
-
curretfile =
|
|
7906
|
+
curretfile[curfname] = ArchiveFileToArray(curfname, fmttype, seekstart, seekend, listonly, contentasfile, uncompress, skipchecksum, formatspecs, seektoend, returnfp)
|
|
7885
7907
|
return outretval
|
|
7886
7908
|
|
|
7887
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):
|
|
@@ -8065,7 +8087,7 @@ def RePackFoxFile(infile, outfile, fmttype="auto", compression="auto", compressw
|
|
|
8065
8087
|
outfile = RemoveWindowsPath(outfile)
|
|
8066
8088
|
if(not compression or compression == formatspecs['format_magic']):
|
|
8067
8089
|
compression = "auto"
|
|
8068
|
-
if(compression not in
|
|
8090
|
+
if(compression not in compressionuselist and compression is None):
|
|
8069
8091
|
compression = "auto"
|
|
8070
8092
|
if(verbose):
|
|
8071
8093
|
logging.basicConfig(format="%(message)s", stream=sys.stdout, level=logging.DEBUG)
|
|
@@ -8172,10 +8194,13 @@ def RePackFoxFile(infile, outfile, fmttype="auto", compression="auto", compressw
|
|
|
8172
8194
|
fcontents = listfoxfiles['ffilelist'][reallcfi]['fcontents']
|
|
8173
8195
|
if(not listfoxfiles['ffilelist'][reallcfi]['fcontentasfile']):
|
|
8174
8196
|
fcontents = BytesIO(fcontents)
|
|
8197
|
+
typechecktest = CheckCompressionType(fcontents, closefp=False)
|
|
8198
|
+
fcontents.seek(0, 0)
|
|
8175
8199
|
fcencoding = GetFileEncoding(fcontents, False)
|
|
8176
8200
|
fcompression = ""
|
|
8177
8201
|
fcsize = format(int(0), 'x').lower()
|
|
8178
|
-
|
|
8202
|
+
curcompression = "none"
|
|
8203
|
+
if typechecktest is False and not compresswholefile:
|
|
8179
8204
|
fcontents.seek(0, 2)
|
|
8180
8205
|
ucfsize = fcontents.tell()
|
|
8181
8206
|
fcontents.seek(0, 0)
|
|
@@ -8190,16 +8215,13 @@ def RePackFoxFile(infile, outfile, fmttype="auto", compression="auto", compressw
|
|
|
8190
8215
|
fcontents.seek(0, 0)
|
|
8191
8216
|
cfcontents.seek(0, 0)
|
|
8192
8217
|
cfcontents = CompressOpenFileAlt(
|
|
8193
|
-
cfcontents, compressionuselist[ilmin], compressionlevel, formatspecs)
|
|
8218
|
+
cfcontents, compressionuselist[ilmin], compressionlevel, compressionuselist, formatspecs)
|
|
8194
8219
|
if(cfcontents):
|
|
8195
8220
|
cfcontents.seek(0, 2)
|
|
8196
8221
|
ilcsize.append(cfcontents.tell())
|
|
8197
8222
|
cfcontents.close()
|
|
8198
8223
|
else:
|
|
8199
|
-
|
|
8200
|
-
ilcsize.append(sys.maxint)
|
|
8201
|
-
except AttributeError:
|
|
8202
|
-
ilcsize.append(sys.maxsize)
|
|
8224
|
+
ilcsize.append(float("inf"))
|
|
8203
8225
|
ilmin = ilmin + 1
|
|
8204
8226
|
ilcmin = ilcsize.index(min(ilcsize))
|
|
8205
8227
|
curcompression = compressionuselist[ilcmin]
|
|
@@ -8208,7 +8230,7 @@ def RePackFoxFile(infile, outfile, fmttype="auto", compression="auto", compressw
|
|
|
8208
8230
|
shutil.copyfileobj(fcontents, cfcontents)
|
|
8209
8231
|
cfcontents.seek(0, 0)
|
|
8210
8232
|
cfcontents = CompressOpenFileAlt(
|
|
8211
|
-
cfcontents, curcompression, compressionlevel, formatspecs)
|
|
8233
|
+
cfcontents, curcompression, compressionlevel, compressionuselist, formatspecs)
|
|
8212
8234
|
cfcontents.seek(0, 2)
|
|
8213
8235
|
cfsize = cfcontents.tell()
|
|
8214
8236
|
if(ucfsize > cfsize):
|
|
@@ -8216,11 +8238,11 @@ def RePackFoxFile(infile, outfile, fmttype="auto", compression="auto", compressw
|
|
|
8216
8238
|
fcompression = curcompression
|
|
8217
8239
|
fcontents.close()
|
|
8218
8240
|
fcontents = cfcontents
|
|
8219
|
-
if
|
|
8220
|
-
if(
|
|
8221
|
-
getflinkpath =
|
|
8222
|
-
flinkid =
|
|
8223
|
-
flinkinfo =
|
|
8241
|
+
if followlink:
|
|
8242
|
+
if(listarchivefiles['ffilelist'][reallcfi]['ftype'] == 1 or listarchivefiles['ffilelist'][reallcfi]['ftype'] == 2):
|
|
8243
|
+
getflinkpath = listarchivefiles['ffilelist'][reallcfi]['flinkname']
|
|
8244
|
+
flinkid = prelistarchivefiles['filetoid'][getflinkpath]
|
|
8245
|
+
flinkinfo = listarchivefiles['ffilelist'][flinkid]
|
|
8224
8246
|
fheadersize = format(
|
|
8225
8247
|
int(flinkinfo['fheadersize']), 'x').lower()
|
|
8226
8248
|
fsize = format(int(flinkinfo['fsize']), 'x').lower()
|
|
@@ -8257,7 +8279,7 @@ def RePackFoxFile(infile, outfile, fmttype="auto", compression="auto", compressw
|
|
|
8257
8279
|
ftypehex = format(flinkinfo['ftype'], 'x').lower()
|
|
8258
8280
|
else:
|
|
8259
8281
|
ftypehex = format(
|
|
8260
|
-
|
|
8282
|
+
listarchivefiles['ffilelist'][reallcfi]['ftype'], 'x').lower()
|
|
8261
8283
|
fcurfid = format(curfid, 'x').lower()
|
|
8262
8284
|
if(not followlink and finode != 0):
|
|
8263
8285
|
if(listfoxfiles['ffilelist'][reallcfi]['ftype'] != 1):
|
|
@@ -8288,7 +8310,7 @@ def RePackFoxFile(infile, outfile, fmttype="auto", compression="auto", compressw
|
|
|
8288
8310
|
return False
|
|
8289
8311
|
if(outfile == "-" or outfile is None or hasattr(outfile, "read") or hasattr(outfile, "write")):
|
|
8290
8312
|
fp = CompressOpenFileAlt(
|
|
8291
|
-
fp, compression, compressionlevel, formatspecs)
|
|
8313
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
8292
8314
|
try:
|
|
8293
8315
|
fp.flush()
|
|
8294
8316
|
if(hasattr(os, "sync")):
|
|
@@ -8312,7 +8334,7 @@ def RePackFoxFile(infile, outfile, fmttype="auto", compression="auto", compressw
|
|
|
8312
8334
|
return outvar
|
|
8313
8335
|
elif((not hasattr(outfile, "read") and not hasattr(outfile, "write")) and re.findall("^(ftp|ftps|sftp):\\/\\/", outfile)):
|
|
8314
8336
|
fp = CompressOpenFileAlt(
|
|
8315
|
-
fp, compression, compressionlevel, formatspecs)
|
|
8337
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
8316
8338
|
fp.seek(0, 0)
|
|
8317
8339
|
upload_file_to_internet_file(fp, outfile)
|
|
8318
8340
|
if(returnfp):
|
|
@@ -8625,7 +8647,7 @@ def FoxFileListFiles(infile, fmttype="auto", seekstart=0, seekend=0, skipchecksu
|
|
|
8625
8647
|
else:
|
|
8626
8648
|
if(infile != "-" and not hasattr(infile, "read") and not hasattr(infile, "write") and not (sys.version_info[0] >= 3 and isinstance(infile, bytes))):
|
|
8627
8649
|
infile = RemoveWindowsPath(infile)
|
|
8628
|
-
listarchivefiles =
|
|
8650
|
+
listarchivefiles = FoxFileToArray(infile, fmttype, seekstart, seekend, True, False, False, skipchecksum, formatspecs, seektoend, returnfp)
|
|
8629
8651
|
if(not listarchivefiles):
|
|
8630
8652
|
return False
|
|
8631
8653
|
lenlist = len(listarchivefiles['ffilelist'])
|
|
@@ -8721,7 +8743,7 @@ def TarFileListFiles(infile, verbose=False, returnfp=False):
|
|
|
8721
8743
|
if 'zstandard' in sys.modules:
|
|
8722
8744
|
infile = ZstdFile(fileobj=infile, mode="rb")
|
|
8723
8745
|
elif 'pyzstd' in sys.modules:
|
|
8724
|
-
|
|
8746
|
+
infile = pyzstd.zstdfile.ZstdFile(fileobj=infile, mode="rb")
|
|
8725
8747
|
tarfp = tarfile.open(fileobj=infile, mode="r")
|
|
8726
8748
|
else:
|
|
8727
8749
|
tarfp = tarfile.open(fileobj=infile, mode="r")
|
|
@@ -8733,7 +8755,7 @@ def TarFileListFiles(infile, verbose=False, returnfp=False):
|
|
|
8733
8755
|
if 'zstandard' in sys.modules:
|
|
8734
8756
|
infile = ZstdFile(fileobj=infile, mode="rb")
|
|
8735
8757
|
elif 'pyzstd' in sys.modules:
|
|
8736
|
-
|
|
8758
|
+
infile = pyzstd.zstdfile.ZstdFile(fileobj=infile, mode="rb")
|
|
8737
8759
|
tarfp = tarfile.open(fileobj=infile, mode="r")
|
|
8738
8760
|
else:
|
|
8739
8761
|
tarfp = tarfile.open(infile, "r")
|
|
@@ -9213,37 +9235,37 @@ def ListDirListFiles(infiles, dirlistfromtxt=False, compression="auto", compress
|
|
|
9213
9235
|
PyNeoFile compatibility layer
|
|
9214
9236
|
"""
|
|
9215
9237
|
|
|
9216
|
-
def make_empty_file_pointer_neo(fp, fmttype=None, checksumtype='crc32', formatspecs=
|
|
9238
|
+
def make_empty_file_pointer_neo(fp, fmttype=None, checksumtype='crc32', formatspecs=__file_format_multi_dict__, encoding='UTF-8'):
|
|
9217
9239
|
return MakeEmptyFilePointer(fp, fmttype, checksumtype, formatspecs)
|
|
9218
9240
|
|
|
9219
|
-
def make_empty_archive_file_pointer_neo(fp, fmttype=None, checksumtype='crc32', formatspecs=
|
|
9241
|
+
def make_empty_archive_file_pointer_neo(fp, fmttype=None, checksumtype='crc32', formatspecs=__file_format_multi_dict__, encoding='UTF-8'):
|
|
9220
9242
|
return make_empty_file_pointer_neo(fp, fmttype, checksumtype, formatspecs, encoding)
|
|
9221
9243
|
|
|
9222
|
-
def make_empty_file_neo(outfile=None, fmttype=None, checksumtype='crc32', formatspecs=
|
|
9244
|
+
def make_empty_file_neo(outfile=None, fmttype=None, checksumtype='crc32', formatspecs=__file_format_multi_dict__, encoding='UTF-8', returnfp=False):
|
|
9223
9245
|
return MakeEmptyFile(outfile, fmttype, "auto", False, None, checksumtype, formatspecs, returnfp)
|
|
9224
9246
|
|
|
9225
|
-
def make_empty_archive_file_neo(outfile=None, fmttype=None, checksumtype='crc32', formatspecs=
|
|
9247
|
+
def make_empty_archive_file_neo(outfile=None, fmttype=None, checksumtype='crc32', formatspecs=__file_format_multi_dict__, encoding='UTF-8', returnfp=False):
|
|
9226
9248
|
return make_empty_file_neo(outfile, fmttype, checksumtype, formatspecs, encoding, returnfp)
|
|
9227
9249
|
|
|
9228
|
-
def pack_neo(infiles, outfile=None, formatspecs=
|
|
9250
|
+
def pack_neo(infiles, outfile=None, formatspecs=__file_format_multi_dict__, checksumtypes=["crc32", "crc32", "crc32", "crc32"], encoding="UTF-8", compression="auto", compression_level=None, returnfp=False):
|
|
9229
9251
|
return PackFoxFile(infiles, outfile, False, "auto", compression, False, compression_level, compressionlistalt, False, checksumtypes, [], {}, formatspecs, False, returnfp)
|
|
9230
9252
|
|
|
9231
|
-
def archive_to_array_neo(infile, formatspecs=
|
|
9253
|
+
def archive_to_array_neo(infile, formatspecs=__file_format_multi_dict__, listonly=False, skipchecksum=False, uncompress=True, returnfp=False):
|
|
9232
9254
|
return FoxFileToArray(infile, "auto", 0, 0, listonly, True, uncompress, skipchecksum, formatspecs, False, returnfp)
|
|
9233
9255
|
|
|
9234
|
-
def unpack_neo(infile, outdir='.', formatspecs=
|
|
9256
|
+
def unpack_neo(infile, outdir='.', formatspecs=__file_format_multi_dict__, skipchecksum=False, uncompress=True, returnfp=False):
|
|
9235
9257
|
return UnPackFoxFile(infile, outdir, False, 0, 0, skipchecksum, formatspecs, True, True, False, False, returnfp)
|
|
9236
9258
|
|
|
9237
|
-
def repack_neo(infile, outfile=None, formatspecs=
|
|
9259
|
+
def repack_neo(infile, outfile=None, formatspecs=__file_format_dict__, checksumtypes=["crc32", "crc32", "crc32", "crc32"], compression="auto", compression_level=None, returnfp=False):
|
|
9238
9260
|
return RePackFoxFile(infile, outfile, "auto", compression, False, compression_level, compressionlistalt, False, 0, 0, checksumtypes, False, [], {}, formatspecs, False, False, returnfp)
|
|
9239
9261
|
|
|
9240
|
-
def archivefilevalidate_neo(infile, formatspecs=
|
|
9262
|
+
def archivefilevalidate_neo(infile, formatspecs=__file_format_multi_dict__, verbose=False, return_details=False, returnfp=False):
|
|
9241
9263
|
return FoxFileValidate(infile, "auto", formatspecs, False, verbose, returnfp)
|
|
9242
9264
|
|
|
9243
|
-
def archivefilelistfiles_neo(infile, formatspecs=
|
|
9265
|
+
def archivefilelistfiles_neo(infile, formatspecs=__file_format_multi_dict__, advanced=False, include_dirs=True, returnfp=False):
|
|
9244
9266
|
return FoxFileListFiles(infile, "auto", 0, 0, False, formatspecs, False, True, advanced, returnfp)
|
|
9245
9267
|
|
|
9246
|
-
def convert_foreign_to_neo(infile, outfile=None, formatspecs=
|
|
9268
|
+
def convert_foreign_to_neo(infile, outfile=None, formatspecs=__file_format_multi_dict__, checksumtypes=["crc32", "crc32", "crc32", "crc32"], compression="auto", compression_level=None, returnfp=False):
|
|
9247
9269
|
intmp = InFileToArray(infile, 0, 0, False, True, False, formatspecs, False, False)
|
|
9248
9270
|
return RePackFoxFile(intmp, outfile, "auto", compression, False, compression_level, compressionlistalt, False, 0, 0, checksumtypes, False, [], {}, formatspecs, False, False, returnfp)
|
|
9249
9271
|
|
|
@@ -9767,9 +9789,9 @@ def upload_file_to_internet_file(ifp, url):
|
|
|
9767
9789
|
return False
|
|
9768
9790
|
|
|
9769
9791
|
|
|
9770
|
-
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__):
|
|
9771
9793
|
fp = CompressOpenFileAlt(
|
|
9772
|
-
fp, compression, compressionlevel, formatspecs)
|
|
9794
|
+
fp, compression, compressionlevel, compressionuselist, formatspecs)
|
|
9773
9795
|
if(not foxfileout):
|
|
9774
9796
|
return False
|
|
9775
9797
|
fp.seek(0, 0)
|
|
@@ -9793,9 +9815,9 @@ def upload_file_to_internet_string(ifp, url):
|
|
|
9793
9815
|
return False
|
|
9794
9816
|
|
|
9795
9817
|
|
|
9796
|
-
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__):
|
|
9797
9819
|
fp = CompressOpenFileAlt(
|
|
9798
|
-
BytesIO(ifp), compression, compressionlevel, formatspecs)
|
|
9820
|
+
BytesIO(ifp), compression, compressionlevel, compressionuselist, formatspecs)
|
|
9799
9821
|
if(not foxfileout):
|
|
9800
9822
|
return False
|
|
9801
9823
|
fp.seek(0, 0)
|