PyFoxFile 0.20.8__py3-none-any.whl → 0.21.0__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.21.0.data/scripts/foxneofile.py +130 -0
- {pyfoxfile-0.20.8.dist-info → pyfoxfile-0.21.0.dist-info}/METADATA +1 -1
- pyfoxfile-0.21.0.dist-info/RECORD +10 -0
- pyfoxfile.py +79 -72
- pyfoxfile-0.20.8.dist-info/RECORD +0 -9
- {pyfoxfile-0.20.8.data → pyfoxfile-0.21.0.data}/scripts/foxfile.py +0 -0
- {pyfoxfile-0.20.8.data → pyfoxfile-0.21.0.data}/scripts/neofoxfile.py +0 -0
- {pyfoxfile-0.20.8.dist-info → pyfoxfile-0.21.0.dist-info}/WHEEL +0 -0
- {pyfoxfile-0.20.8.dist-info → pyfoxfile-0.21.0.dist-info}/licenses/LICENSE +0 -0
- {pyfoxfile-0.20.8.dist-info → pyfoxfile-0.21.0.dist-info}/top_level.txt +0 -0
- {pyfoxfile-0.20.8.dist-info → pyfoxfile-0.21.0.dist-info}/zip-safe +0 -0
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
#!python
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
from __future__ import absolute_import, division, print_function, unicode_literals
|
|
4
|
+
|
|
5
|
+
import sys, os, io, argparse
|
|
6
|
+
|
|
7
|
+
try:
|
|
8
|
+
import pyfoxfile as P # core must provide *_neo functions
|
|
9
|
+
except Exception as e:
|
|
10
|
+
sys.stderr.write("Failed to import core module 'pyfoxfile': %s\n" % (e,))
|
|
11
|
+
sys.exit(2)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def _expand_combined_short_opts(argv):
|
|
15
|
+
out = [argv[0]]
|
|
16
|
+
i = 1
|
|
17
|
+
while i < len(argv):
|
|
18
|
+
a = argv[i]
|
|
19
|
+
if a.startswith("--") or not (a.startswith("-") and len(a) > 2):
|
|
20
|
+
out.append(a); i += 1; continue
|
|
21
|
+
for ch in a[1:]:
|
|
22
|
+
out.append("-" + ch)
|
|
23
|
+
i += 1
|
|
24
|
+
return out
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def main():
|
|
28
|
+
argv = _expand_combined_short_opts(sys.argv)
|
|
29
|
+
|
|
30
|
+
p = argparse.ArgumentParser(
|
|
31
|
+
description="PyNeoFile CLI (uses pyfoxfile core)")
|
|
32
|
+
g = p.add_mutually_exclusive_group(required=True)
|
|
33
|
+
g.add_argument("-l", "--list", action="store_true", help="List archive")
|
|
34
|
+
g.add_argument("-e", "--extract", action="store_true", help="Extract archive")
|
|
35
|
+
g.add_argument("-c", "--create", action="store_true", help="Create archive from path")
|
|
36
|
+
g.add_argument("-r", "--repack", action="store_true", help="Repack (recompress) an archive")
|
|
37
|
+
g.add_argument("-E", "--empty", action="store_true", help="Create an empty archive")
|
|
38
|
+
|
|
39
|
+
p.add_argument("-i", "--input", help="Input file/path", nargs="*")
|
|
40
|
+
p.add_argument("-o", "--output", help="Output file/dir (or '-' for stdout)")
|
|
41
|
+
p.add_argument("-d", "--verbose", action="store_true", help="Verbose/detailed listing")
|
|
42
|
+
p.add_argument("-P", "--compression", default="auto", help="Compression algo (auto, none, zlib, gzip, bz2, lzma)")
|
|
43
|
+
p.add_argument("-L", "--level", type=int, default=None, help="Compression level/preset")
|
|
44
|
+
p.add_argument("--checksum", default="crc32", help="Checksum type for header/content/json (default: crc32)")
|
|
45
|
+
|
|
46
|
+
args = p.parse_args(argv[1:])
|
|
47
|
+
|
|
48
|
+
src = None
|
|
49
|
+
if args.input:
|
|
50
|
+
if isinstance(args.input, list) and len(args.input) == 1:
|
|
51
|
+
src = args.input[0]
|
|
52
|
+
elif isinstance(args.input, list) and len(args.input) > 1:
|
|
53
|
+
src = args.input[0]
|
|
54
|
+
else:
|
|
55
|
+
src = args.input
|
|
56
|
+
|
|
57
|
+
if args.empty:
|
|
58
|
+
dst = args.output or "-"
|
|
59
|
+
blob_or_true = P.make_empty_file_neo(dst, fmttype="auto", checksumtype=args.checksum, encoding="UTF-8", returnfp=False)
|
|
60
|
+
if dst in (None, "-"):
|
|
61
|
+
data = blob_or_true if isinstance(blob_or_true, (bytes, bytearray)) else b""
|
|
62
|
+
if hasattr(sys.stdout, "buffer"):
|
|
63
|
+
sys.stdout.buffer.write(data)
|
|
64
|
+
else:
|
|
65
|
+
sys.stdout.write(data.decode("latin1"))
|
|
66
|
+
return 0
|
|
67
|
+
|
|
68
|
+
if args.list:
|
|
69
|
+
if not src:
|
|
70
|
+
p.error("list requires -i <archive>")
|
|
71
|
+
P.archivefilelistfiles_neo(src, advanced=args.verbose, include_dirs=True)
|
|
72
|
+
return 0
|
|
73
|
+
|
|
74
|
+
if args.extract:
|
|
75
|
+
if not src:
|
|
76
|
+
p.error("extract requires -i <archive>")
|
|
77
|
+
outdir = args.output or "."
|
|
78
|
+
ok = P.unpack_neo(src, outdir, skipchecksum=False, uncompress=True)
|
|
79
|
+
return 0 if ok else 1
|
|
80
|
+
|
|
81
|
+
if args.create:
|
|
82
|
+
if not src:
|
|
83
|
+
p.error("create requires -i <path>")
|
|
84
|
+
if args.verbose:
|
|
85
|
+
walkroot = src
|
|
86
|
+
if os.path.isdir(walkroot):
|
|
87
|
+
print(walkroot)
|
|
88
|
+
for root, dirs, files in os.walk(walkroot):
|
|
89
|
+
relroot = root if root.startswith("./") else "./" + root.replace("\\", "/")
|
|
90
|
+
if root != walkroot:
|
|
91
|
+
print(relroot)
|
|
92
|
+
for name in sorted(files):
|
|
93
|
+
path = os.path.join(root, name).replace("\\", "/")
|
|
94
|
+
if not path.startswith("./"):
|
|
95
|
+
path = "./" + path
|
|
96
|
+
print(path)
|
|
97
|
+
else:
|
|
98
|
+
path = src if src.startswith("./") else "./" + src
|
|
99
|
+
print(path)
|
|
100
|
+
|
|
101
|
+
outpath = args.output or "-"
|
|
102
|
+
ok = P.pack_neo(src, outpath, checksumtypes=(args.checksum,args.checksum,args.checksum,args.checksum),
|
|
103
|
+
encoding="UTF-8", compression=args.compression, compression_level=args.level)
|
|
104
|
+
if outpath in (None, "-") and isinstance(ok, (bytes, bytearray)):
|
|
105
|
+
if hasattr(sys.stdout, "buffer"):
|
|
106
|
+
sys.stdout.buffer.write(ok)
|
|
107
|
+
else:
|
|
108
|
+
sys.stdout.write(ok.decode("latin1"))
|
|
109
|
+
return 0
|
|
110
|
+
return 0 if ok else 1
|
|
111
|
+
|
|
112
|
+
if args.repack:
|
|
113
|
+
if not src:
|
|
114
|
+
p.error("repack requires -i <archive>")
|
|
115
|
+
outpath = args.output or "-"
|
|
116
|
+
ok = P.repack_neo(src, outpath, checksumtypes=(args.checksum,args.checksum,args.checksum,args.checksum),
|
|
117
|
+
compression=args.compression, compression_level=args.level)
|
|
118
|
+
if outpath in (None, "-") and isinstance(ok, (bytes, bytearray)):
|
|
119
|
+
if hasattr(sys.stdout, "buffer"):
|
|
120
|
+
sys.stdout.buffer.write(ok)
|
|
121
|
+
else:
|
|
122
|
+
sys.stdout.write(ok.decode("latin1"))
|
|
123
|
+
return 0
|
|
124
|
+
return 0 if ok else 1
|
|
125
|
+
|
|
126
|
+
return 0
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
if __name__ == "__main__":
|
|
130
|
+
sys.exit(main())
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
pyfoxfile.py,sha256=oIhDTp0KQS3IPVe31EYOaFiV8KJ6f2wcajf5yHoXqJI,438678
|
|
2
|
+
pyfoxfile-0.21.0.data/scripts/foxfile.py,sha256=jVbflioQQRu6dy85bt8QW9OfXr5rzfmmQ75qM-Q31u4,13994
|
|
3
|
+
pyfoxfile-0.21.0.data/scripts/foxneofile.py,sha256=vrQsZFkSyq5TqQmakzz3AtvxAqQTECTcb9JTzWYDzng,5128
|
|
4
|
+
pyfoxfile-0.21.0.data/scripts/neofoxfile.py,sha256=5_A2OgXuV7Yj0SAb5F2PysPneIBrqfuM8REjClRquN4,7113
|
|
5
|
+
pyfoxfile-0.21.0.dist-info/licenses/LICENSE,sha256=WM1VWxTUVrQbvEa-LC7cKTaBHXiqSTyYPoJvsZSbd7E,1513
|
|
6
|
+
pyfoxfile-0.21.0.dist-info/METADATA,sha256=1ih5Mo2bfBGsLzDCMVW8u1aUj3lVcNxy3hnK7raC6o0,715
|
|
7
|
+
pyfoxfile-0.21.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
8
|
+
pyfoxfile-0.21.0.dist-info/top_level.txt,sha256=VTOkpGfBWHNht7FKfnbccd32n_Jgk8Df5NKKfzaliTc,10
|
|
9
|
+
pyfoxfile-0.21.0.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
10
|
+
pyfoxfile-0.21.0.dist-info/RECORD,,
|
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: 9/
|
|
17
|
+
$FileInfo: pyfoxfile.py - Last Update: 9/17/2025 Ver. 0.21.0 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, 0, "RC 1", 1)
|
|
393
|
+
__version_date_info__ = (2025, 9, 17, "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: 6208d3cb66a43a7e1047211a926f92f6aecfff08 $"
|
|
394
398
|
if(__version_info__[4] is not None):
|
|
395
399
|
__version_date_plusrc__ = __version_date__ + \
|
|
396
400
|
"-" + str(__version_date_info__[4])
|
|
@@ -3630,11 +3634,14 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, filevalues=[], ext
|
|
|
3630
3634
|
fcontents = BytesIO()
|
|
3631
3635
|
chunk_size = 1024
|
|
3632
3636
|
fcencoding = "UTF-8"
|
|
3633
|
-
|
|
3637
|
+
curcompression = "none"
|
|
3638
|
+
if not followlink and ftype in data_types:
|
|
3634
3639
|
with open(fname, "rb") as fpc:
|
|
3635
3640
|
shutil.copyfileobj(fpc, fcontents)
|
|
3641
|
+
typechecktest = CheckCompressionType(fcontents, closefp=False)
|
|
3642
|
+
fcontents.seek(0, 0)
|
|
3636
3643
|
fcencoding = GetFileEncoding(fcontents, False)
|
|
3637
|
-
if(not compresswholefile):
|
|
3644
|
+
if(typechecktest is False and not compresswholefile):
|
|
3638
3645
|
fcontents.seek(0, 2)
|
|
3639
3646
|
ucfsize = fcontents.tell()
|
|
3640
3647
|
fcontents.seek(0, 0)
|
|
@@ -3655,10 +3662,7 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, filevalues=[], ext
|
|
|
3655
3662
|
ilcsize.append(cfcontents.tell())
|
|
3656
3663
|
cfcontents.close()
|
|
3657
3664
|
else:
|
|
3658
|
-
|
|
3659
|
-
ilcsize.append(sys.maxint)
|
|
3660
|
-
except AttributeError:
|
|
3661
|
-
ilcsize.append(sys.maxsize)
|
|
3665
|
+
ilcsize.append(float("inf"))
|
|
3662
3666
|
ilmin = ilmin + 1
|
|
3663
3667
|
ilcmin = ilcsize.index(min(ilcsize))
|
|
3664
3668
|
curcompression = compressionuselist[ilcmin]
|
|
@@ -3675,13 +3679,16 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, filevalues=[], ext
|
|
|
3675
3679
|
fcompression = curcompression
|
|
3676
3680
|
fcontents.close()
|
|
3677
3681
|
fcontents = cfcontents
|
|
3678
|
-
|
|
3682
|
+
elif followlink and (ftype == 1 or ftype == 2):
|
|
3679
3683
|
if(not os.path.exists(flinkname)):
|
|
3680
3684
|
return False
|
|
3681
3685
|
flstatinfo = os.stat(flinkname)
|
|
3682
3686
|
with open(flinkname, "rb") as fpc:
|
|
3683
3687
|
shutil.copyfileobj(fpc, fcontents)
|
|
3684
|
-
|
|
3688
|
+
typechecktest = CheckCompressionType(fcontents, closefp=False)
|
|
3689
|
+
fcontents.seek(0, 0)
|
|
3690
|
+
fcencoding = GetFileEncoding(fcontents, False)
|
|
3691
|
+
if(typechecktest is False and not compresswholefile):
|
|
3685
3692
|
fcontents.seek(0, 2)
|
|
3686
3693
|
ucfsize = fcontents.tell()
|
|
3687
3694
|
fcontents.seek(0, 0)
|
|
@@ -3702,10 +3709,7 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, filevalues=[], ext
|
|
|
3702
3709
|
ilcsize.append(cfcontents.tell())
|
|
3703
3710
|
cfcontents.close()
|
|
3704
3711
|
else:
|
|
3705
|
-
|
|
3706
|
-
ilcsize.append(sys.maxint)
|
|
3707
|
-
except AttributeError:
|
|
3708
|
-
ilcsize.append(sys.maxsize)
|
|
3712
|
+
ilcsize.append(float("inf"))
|
|
3709
3713
|
ilmin = ilmin + 1
|
|
3710
3714
|
ilcmin = ilcsize.index(min(ilcsize))
|
|
3711
3715
|
curcompression = compressionuselist[ilcmin]
|
|
@@ -5092,11 +5096,14 @@ def PackFoxFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", compress
|
|
|
5092
5096
|
fcsize = format(int(0), 'x').lower()
|
|
5093
5097
|
fcontents = BytesIO()
|
|
5094
5098
|
fcencoding = "UTF-8"
|
|
5095
|
-
|
|
5099
|
+
curcompression = "none"
|
|
5100
|
+
if not followlink and ftype in data_types:
|
|
5096
5101
|
with open(fname, "rb") as fpc:
|
|
5097
5102
|
shutil.copyfileobj(fpc, fcontents)
|
|
5103
|
+
typechecktest = CheckCompressionType(fcontents, closefp=False)
|
|
5104
|
+
fcontents.seek(0, 0)
|
|
5098
5105
|
fcencoding = GetFileEncoding(fcontents, False)
|
|
5099
|
-
if(not compresswholefile):
|
|
5106
|
+
if(typechecktest is False and not compresswholefile):
|
|
5100
5107
|
fcontents.seek(0, 2)
|
|
5101
5108
|
ucfsize = fcontents.tell()
|
|
5102
5109
|
fcontents.seek(0, 0)
|
|
@@ -5117,10 +5124,7 @@ def PackFoxFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", compress
|
|
|
5117
5124
|
ilcsize.append(cfcontents.tell())
|
|
5118
5125
|
cfcontents.close()
|
|
5119
5126
|
else:
|
|
5120
|
-
|
|
5121
|
-
ilcsize.append(sys.maxint)
|
|
5122
|
-
except AttributeError:
|
|
5123
|
-
ilcsize.append(sys.maxsize)
|
|
5127
|
+
ilcsize.append(float("inf"))
|
|
5124
5128
|
ilmin = ilmin + 1
|
|
5125
5129
|
ilcmin = ilcsize.index(min(ilcsize))
|
|
5126
5130
|
curcompression = compressionuselist[ilcmin]
|
|
@@ -5137,15 +5141,16 @@ def PackFoxFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", compress
|
|
|
5137
5141
|
fcompression = curcompression
|
|
5138
5142
|
fcontents.close()
|
|
5139
5143
|
fcontents = cfcontents
|
|
5140
|
-
|
|
5141
|
-
fcompression = ""
|
|
5142
|
-
if(followlink and (ftype == 1 or ftype == 2)):
|
|
5144
|
+
elif followlink and (ftype == 1 or ftype == 2):
|
|
5143
5145
|
if(not os.path.exists(flinkname)):
|
|
5144
5146
|
return False
|
|
5145
5147
|
flstatinfo = os.stat(flinkname)
|
|
5146
5148
|
with open(flinkname, "rb") as fpc:
|
|
5147
5149
|
shutil.copyfileobj(fpc, fcontents)
|
|
5148
|
-
|
|
5150
|
+
typechecktest = CheckCompressionType(fcontents, closefp=False)
|
|
5151
|
+
fcontents.seek(0, 0)
|
|
5152
|
+
fcencoding = GetFileEncoding(fcontents, False)
|
|
5153
|
+
if(typechecktest is False and not compresswholefile):
|
|
5149
5154
|
fcontents.seek(0, 2)
|
|
5150
5155
|
ucfsize = fcontents.tell()
|
|
5151
5156
|
fcontents.seek(0, 0)
|
|
@@ -5166,10 +5171,7 @@ def PackFoxFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", compress
|
|
|
5166
5171
|
ilcsize.append(cfcontents.tell())
|
|
5167
5172
|
cfcontents.close()
|
|
5168
5173
|
else:
|
|
5169
|
-
|
|
5170
|
-
ilcsize.append(sys.maxint)
|
|
5171
|
-
except AttributeError:
|
|
5172
|
-
ilcsize.append(sys.maxsize)
|
|
5174
|
+
ilcsize.append(float("inf"))
|
|
5173
5175
|
ilmin = ilmin + 1
|
|
5174
5176
|
ilcmin = ilcsize.index(min(ilcsize))
|
|
5175
5177
|
curcompression = compressionuselist[ilcmin]
|
|
@@ -5186,6 +5188,8 @@ def PackFoxFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", compress
|
|
|
5186
5188
|
fcompression = curcompression
|
|
5187
5189
|
fcontents.close()
|
|
5188
5190
|
fcontents = cfcontents
|
|
5191
|
+
if(fcompression == "none"):
|
|
5192
|
+
fcompression = ""
|
|
5189
5193
|
fcontents.seek(0, 0)
|
|
5190
5194
|
ftypehex = format(ftype, 'x').lower()
|
|
5191
5195
|
tmpoutlist = [ftypehex, fencoding, fcencoding, fname, flinkname, fsize, fatime, fmtime, fctime, fbtime, fmode, fwinattributes, fcompression,
|
|
@@ -5439,11 +5443,14 @@ def PackFoxFileFromTarFile(infile, outfile, fmttype="auto", compression="auto",
|
|
|
5439
5443
|
fcsize = format(int(0), 'x').lower()
|
|
5440
5444
|
fcontents = BytesIO()
|
|
5441
5445
|
fcencoding = "UTF-8"
|
|
5446
|
+
curcompression = "none"
|
|
5442
5447
|
if ftype in data_types:
|
|
5443
5448
|
fpc = tarfp.extractfile(member)
|
|
5444
5449
|
shutil.copyfileobj(fpc, fcontents)
|
|
5450
|
+
typechecktest = CheckCompressionType(fcontents, closefp=False)
|
|
5451
|
+
fcontents.seek(0, 0)
|
|
5445
5452
|
fcencoding = GetFileEncoding(fcontents, False)
|
|
5446
|
-
if(not compresswholefile):
|
|
5453
|
+
if(typechecktest is False and not compresswholefile):
|
|
5447
5454
|
fcontents.seek(0, 2)
|
|
5448
5455
|
ucfsize = fcontents.tell()
|
|
5449
5456
|
fcontents.seek(0, 0)
|
|
@@ -5464,10 +5471,7 @@ def PackFoxFileFromTarFile(infile, outfile, fmttype="auto", compression="auto",
|
|
|
5464
5471
|
ilcsize.append(cfcontents.tell())
|
|
5465
5472
|
cfcontents.close()
|
|
5466
5473
|
else:
|
|
5467
|
-
|
|
5468
|
-
ilcsize.append(sys.maxint)
|
|
5469
|
-
except AttributeError:
|
|
5470
|
-
ilcsize.append(sys.maxsize)
|
|
5474
|
+
ilcsize.append(float("inf"))
|
|
5471
5475
|
ilmin = ilmin + 1
|
|
5472
5476
|
ilcmin = ilcsize.index(min(ilcsize))
|
|
5473
5477
|
curcompression = compressionuselist[ilcmin]
|
|
@@ -5737,10 +5741,13 @@ def PackFoxFileFromZipFile(infile, outfile, fmttype="auto", compression="auto",
|
|
|
5737
5741
|
fgname = ""
|
|
5738
5742
|
fcontents = BytesIO()
|
|
5739
5743
|
fcencoding = "UTF-8"
|
|
5740
|
-
|
|
5744
|
+
curcompression = "none"
|
|
5745
|
+
if ftype == 0:
|
|
5741
5746
|
fcontents.write(zipfp.read(member.filename))
|
|
5747
|
+
typechecktest = CheckCompressionType(fcontents, closefp=False)
|
|
5748
|
+
fcontents.seek(0, 0)
|
|
5742
5749
|
fcencoding = GetFileEncoding(fcontents, False)
|
|
5743
|
-
if(not compresswholefile):
|
|
5750
|
+
if(typechecktest is False and not compresswholefile):
|
|
5744
5751
|
fcontents.seek(0, 2)
|
|
5745
5752
|
ucfsize = fcontents.tell()
|
|
5746
5753
|
fcontents.seek(0, 0)
|
|
@@ -6051,10 +6058,13 @@ if(rarfile_support):
|
|
|
6051
6058
|
fgname = ""
|
|
6052
6059
|
fcontents = BytesIO()
|
|
6053
6060
|
fcencoding = "UTF-8"
|
|
6054
|
-
|
|
6061
|
+
curcompression = "none"
|
|
6062
|
+
if ftype == 0:
|
|
6055
6063
|
fcontents.write(rarfp.read(member.filename))
|
|
6064
|
+
typechecktest = CheckCompressionType(fcontents, closefp=False)
|
|
6065
|
+
fcontents.seek(0, 0)
|
|
6056
6066
|
fcencoding = GetFileEncoding(fcontents, False)
|
|
6057
|
-
if(not compresswholefile):
|
|
6067
|
+
if(typechecktest is False and not compresswholefile):
|
|
6058
6068
|
fcontents.seek(0, 2)
|
|
6059
6069
|
ucfsize = fcontents.tell()
|
|
6060
6070
|
fcontents.seek(0, 0)
|
|
@@ -6075,10 +6085,7 @@ if(rarfile_support):
|
|
|
6075
6085
|
ilcsize.append(cfcontents.tell())
|
|
6076
6086
|
cfcontents.close()
|
|
6077
6087
|
else:
|
|
6078
|
-
|
|
6079
|
-
ilcsize.append(sys.maxint)
|
|
6080
|
-
except AttributeError:
|
|
6081
|
-
ilcsize.append(sys.maxsize)
|
|
6088
|
+
ilcsize.append(float("inf"))
|
|
6082
6089
|
ilmin = ilmin + 1
|
|
6083
6090
|
ilcmin = ilcsize.index(min(ilcsize))
|
|
6084
6091
|
curcompression = compressionuselist[ilcmin]
|
|
@@ -6302,12 +6309,15 @@ if(py7zr_support):
|
|
|
6302
6309
|
fgname = ""
|
|
6303
6310
|
fcontents = BytesIO()
|
|
6304
6311
|
fcencoding = "UTF-8"
|
|
6305
|
-
|
|
6312
|
+
curcompression = "none"
|
|
6313
|
+
if ftype == 0:
|
|
6306
6314
|
fcontents.write(file_content[member.filename].read())
|
|
6315
|
+
typechecktest = CheckCompressionType(fcontents, closefp=False)
|
|
6316
|
+
fcontents.seek(0, 0)
|
|
6307
6317
|
fcencoding = GetFileEncoding(fcontents, False)
|
|
6308
6318
|
fsize = format(fcontents.tell(), 'x').lower()
|
|
6309
6319
|
file_content[member.filename].close()
|
|
6310
|
-
if(not compresswholefile):
|
|
6320
|
+
if(typechecktest is False and not compresswholefile):
|
|
6311
6321
|
fcontents.seek(0, 2)
|
|
6312
6322
|
ucfsize = fcontents.tell()
|
|
6313
6323
|
fcontents.seek(0, 0)
|
|
@@ -6328,10 +6338,7 @@ if(py7zr_support):
|
|
|
6328
6338
|
ilcsize.append(cfcontents.tell())
|
|
6329
6339
|
cfcontents.close()
|
|
6330
6340
|
else:
|
|
6331
|
-
|
|
6332
|
-
ilcsize.append(sys.maxint)
|
|
6333
|
-
except AttributeError:
|
|
6334
|
-
ilcsize.append(sys.maxsize)
|
|
6341
|
+
ilcsize.append(float("inf"))
|
|
6335
6342
|
ilmin = ilmin + 1
|
|
6336
6343
|
ilcmin = ilcsize.index(min(ilcsize))
|
|
6337
6344
|
curcompression = compressionuselist[ilcmin]
|
|
@@ -8172,10 +8179,13 @@ def RePackFoxFile(infile, outfile, fmttype="auto", compression="auto", compressw
|
|
|
8172
8179
|
fcontents = listfoxfiles['ffilelist'][reallcfi]['fcontents']
|
|
8173
8180
|
if(not listfoxfiles['ffilelist'][reallcfi]['fcontentasfile']):
|
|
8174
8181
|
fcontents = BytesIO(fcontents)
|
|
8182
|
+
typechecktest = CheckCompressionType(fcontents, closefp=False)
|
|
8183
|
+
fcontents.seek(0, 0)
|
|
8175
8184
|
fcencoding = GetFileEncoding(fcontents, False)
|
|
8176
8185
|
fcompression = ""
|
|
8177
8186
|
fcsize = format(int(0), 'x').lower()
|
|
8178
|
-
|
|
8187
|
+
curcompression = "none"
|
|
8188
|
+
if typechecktest is False and not compresswholefile:
|
|
8179
8189
|
fcontents.seek(0, 2)
|
|
8180
8190
|
ucfsize = fcontents.tell()
|
|
8181
8191
|
fcontents.seek(0, 0)
|
|
@@ -8196,10 +8206,7 @@ def RePackFoxFile(infile, outfile, fmttype="auto", compression="auto", compressw
|
|
|
8196
8206
|
ilcsize.append(cfcontents.tell())
|
|
8197
8207
|
cfcontents.close()
|
|
8198
8208
|
else:
|
|
8199
|
-
|
|
8200
|
-
ilcsize.append(sys.maxint)
|
|
8201
|
-
except AttributeError:
|
|
8202
|
-
ilcsize.append(sys.maxsize)
|
|
8209
|
+
ilcsize.append(float("inf"))
|
|
8203
8210
|
ilmin = ilmin + 1
|
|
8204
8211
|
ilcmin = ilcsize.index(min(ilcsize))
|
|
8205
8212
|
curcompression = compressionuselist[ilcmin]
|
|
@@ -8216,11 +8223,11 @@ def RePackFoxFile(infile, outfile, fmttype="auto", compression="auto", compressw
|
|
|
8216
8223
|
fcompression = curcompression
|
|
8217
8224
|
fcontents.close()
|
|
8218
8225
|
fcontents = cfcontents
|
|
8219
|
-
if
|
|
8220
|
-
if(
|
|
8221
|
-
getflinkpath =
|
|
8222
|
-
flinkid =
|
|
8223
|
-
flinkinfo =
|
|
8226
|
+
if followlink:
|
|
8227
|
+
if(listarchivefiles['ffilelist'][reallcfi]['ftype'] == 1 or listarchivefiles['ffilelist'][reallcfi]['ftype'] == 2):
|
|
8228
|
+
getflinkpath = listarchivefiles['ffilelist'][reallcfi]['flinkname']
|
|
8229
|
+
flinkid = prelistarchivefiles['filetoid'][getflinkpath]
|
|
8230
|
+
flinkinfo = listarchivefiles['ffilelist'][flinkid]
|
|
8224
8231
|
fheadersize = format(
|
|
8225
8232
|
int(flinkinfo['fheadersize']), 'x').lower()
|
|
8226
8233
|
fsize = format(int(flinkinfo['fsize']), 'x').lower()
|
|
@@ -8257,7 +8264,7 @@ def RePackFoxFile(infile, outfile, fmttype="auto", compression="auto", compressw
|
|
|
8257
8264
|
ftypehex = format(flinkinfo['ftype'], 'x').lower()
|
|
8258
8265
|
else:
|
|
8259
8266
|
ftypehex = format(
|
|
8260
|
-
|
|
8267
|
+
listarchivefiles['ffilelist'][reallcfi]['ftype'], 'x').lower()
|
|
8261
8268
|
fcurfid = format(curfid, 'x').lower()
|
|
8262
8269
|
if(not followlink and finode != 0):
|
|
8263
8270
|
if(listfoxfiles['ffilelist'][reallcfi]['ftype'] != 1):
|
|
@@ -8625,7 +8632,7 @@ def FoxFileListFiles(infile, fmttype="auto", seekstart=0, seekend=0, skipchecksu
|
|
|
8625
8632
|
else:
|
|
8626
8633
|
if(infile != "-" and not hasattr(infile, "read") and not hasattr(infile, "write") and not (sys.version_info[0] >= 3 and isinstance(infile, bytes))):
|
|
8627
8634
|
infile = RemoveWindowsPath(infile)
|
|
8628
|
-
listarchivefiles =
|
|
8635
|
+
listarchivefiles = FoxFileToArray(infile, fmttype, seekstart, seekend, True, False, False, skipchecksum, formatspecs, seektoend, returnfp)
|
|
8629
8636
|
if(not listarchivefiles):
|
|
8630
8637
|
return False
|
|
8631
8638
|
lenlist = len(listarchivefiles['ffilelist'])
|
|
@@ -9213,37 +9220,37 @@ def ListDirListFiles(infiles, dirlistfromtxt=False, compression="auto", compress
|
|
|
9213
9220
|
PyNeoFile compatibility layer
|
|
9214
9221
|
"""
|
|
9215
9222
|
|
|
9216
|
-
def make_empty_file_pointer_neo(fp, fmttype=None, checksumtype='crc32', formatspecs=
|
|
9223
|
+
def make_empty_file_pointer_neo(fp, fmttype=None, checksumtype='crc32', formatspecs=__file_format_multi_dict__, encoding='UTF-8'):
|
|
9217
9224
|
return MakeEmptyFilePointer(fp, fmttype, checksumtype, formatspecs)
|
|
9218
9225
|
|
|
9219
|
-
def make_empty_archive_file_pointer_neo(fp, fmttype=None, checksumtype='crc32', formatspecs=
|
|
9226
|
+
def make_empty_archive_file_pointer_neo(fp, fmttype=None, checksumtype='crc32', formatspecs=__file_format_multi_dict__, encoding='UTF-8'):
|
|
9220
9227
|
return make_empty_file_pointer_neo(fp, fmttype, checksumtype, formatspecs, encoding)
|
|
9221
9228
|
|
|
9222
|
-
def make_empty_file_neo(outfile=None, fmttype=None, checksumtype='crc32', formatspecs=
|
|
9229
|
+
def make_empty_file_neo(outfile=None, fmttype=None, checksumtype='crc32', formatspecs=__file_format_multi_dict__, encoding='UTF-8', returnfp=False):
|
|
9223
9230
|
return MakeEmptyFile(outfile, fmttype, "auto", False, None, checksumtype, formatspecs, returnfp)
|
|
9224
9231
|
|
|
9225
|
-
def make_empty_archive_file_neo(outfile=None, fmttype=None, checksumtype='crc32', formatspecs=
|
|
9232
|
+
def make_empty_archive_file_neo(outfile=None, fmttype=None, checksumtype='crc32', formatspecs=__file_format_multi_dict__, encoding='UTF-8', returnfp=False):
|
|
9226
9233
|
return make_empty_file_neo(outfile, fmttype, checksumtype, formatspecs, encoding, returnfp)
|
|
9227
9234
|
|
|
9228
|
-
def pack_neo(infiles, outfile=None, formatspecs=
|
|
9235
|
+
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
9236
|
return PackFoxFile(infiles, outfile, False, "auto", compression, False, compression_level, compressionlistalt, False, checksumtypes, [], {}, formatspecs, False, returnfp)
|
|
9230
9237
|
|
|
9231
|
-
def archive_to_array_neo(infile, formatspecs=
|
|
9238
|
+
def archive_to_array_neo(infile, formatspecs=__file_format_multi_dict__, listonly=False, skipchecksum=False, uncompress=True, returnfp=False):
|
|
9232
9239
|
return FoxFileToArray(infile, "auto", 0, 0, listonly, True, uncompress, skipchecksum, formatspecs, False, returnfp)
|
|
9233
9240
|
|
|
9234
|
-
def unpack_neo(infile, outdir='.', formatspecs=
|
|
9241
|
+
def unpack_neo(infile, outdir='.', formatspecs=__file_format_multi_dict__, skipchecksum=False, uncompress=True, returnfp=False):
|
|
9235
9242
|
return UnPackFoxFile(infile, outdir, False, 0, 0, skipchecksum, formatspecs, True, True, False, False, returnfp)
|
|
9236
9243
|
|
|
9237
|
-
def repack_neo(infile, outfile=None, formatspecs=
|
|
9244
|
+
def repack_neo(infile, outfile=None, formatspecs=__file_format_dict__, checksumtypes=["crc32", "crc32", "crc32", "crc32"], compression="auto", compression_level=None, returnfp=False):
|
|
9238
9245
|
return RePackFoxFile(infile, outfile, "auto", compression, False, compression_level, compressionlistalt, False, 0, 0, checksumtypes, False, [], {}, formatspecs, False, False, returnfp)
|
|
9239
9246
|
|
|
9240
|
-
def archivefilevalidate_neo(infile, formatspecs=
|
|
9247
|
+
def archivefilevalidate_neo(infile, formatspecs=__file_format_multi_dict__, verbose=False, return_details=False, returnfp=False):
|
|
9241
9248
|
return FoxFileValidate(infile, "auto", formatspecs, False, verbose, returnfp)
|
|
9242
9249
|
|
|
9243
|
-
def archivefilelistfiles_neo(infile, formatspecs=
|
|
9250
|
+
def archivefilelistfiles_neo(infile, formatspecs=__file_format_multi_dict__, advanced=False, include_dirs=True, returnfp=False):
|
|
9244
9251
|
return FoxFileListFiles(infile, "auto", 0, 0, False, formatspecs, False, True, advanced, returnfp)
|
|
9245
9252
|
|
|
9246
|
-
def convert_foreign_to_neo(infile, outfile=None, formatspecs=
|
|
9253
|
+
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
9254
|
intmp = InFileToArray(infile, 0, 0, False, True, False, formatspecs, False, False)
|
|
9248
9255
|
return RePackFoxFile(intmp, outfile, "auto", compression, False, compression_level, compressionlistalt, False, 0, 0, checksumtypes, False, [], {}, formatspecs, False, False, returnfp)
|
|
9249
9256
|
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
pyfoxfile.py,sha256=tl_qySFcwKLuUaH7m2VGn0QUYbxnjw4hCE1BIRMOR6s,437205
|
|
2
|
-
pyfoxfile-0.20.8.data/scripts/foxfile.py,sha256=jVbflioQQRu6dy85bt8QW9OfXr5rzfmmQ75qM-Q31u4,13994
|
|
3
|
-
pyfoxfile-0.20.8.data/scripts/neofoxfile.py,sha256=5_A2OgXuV7Yj0SAb5F2PysPneIBrqfuM8REjClRquN4,7113
|
|
4
|
-
pyfoxfile-0.20.8.dist-info/licenses/LICENSE,sha256=WM1VWxTUVrQbvEa-LC7cKTaBHXiqSTyYPoJvsZSbd7E,1513
|
|
5
|
-
pyfoxfile-0.20.8.dist-info/METADATA,sha256=_dImShhjCo_SXSLkkeKP7eCgZ3VNq_ijMY-w6t-E10E,715
|
|
6
|
-
pyfoxfile-0.20.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
7
|
-
pyfoxfile-0.20.8.dist-info/top_level.txt,sha256=VTOkpGfBWHNht7FKfnbccd32n_Jgk8Df5NKKfzaliTc,10
|
|
8
|
-
pyfoxfile-0.20.8.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
9
|
-
pyfoxfile-0.20.8.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|