PyFoxFile 0.20.6__tar.gz → 0.21.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pyfoxfile-0.20.6 → pyfoxfile-0.21.0}/PKG-INFO +1 -1
- {pyfoxfile-0.20.6 → pyfoxfile-0.21.0}/PyFoxFile.egg-info/PKG-INFO +1 -1
- {pyfoxfile-0.20.6 → pyfoxfile-0.21.0}/PyFoxFile.egg-info/SOURCES.txt +1 -0
- pyfoxfile-0.21.0/foxneofile.py +130 -0
- {pyfoxfile-0.20.6 → pyfoxfile-0.21.0}/pyfoxfile.py +109 -61
- {pyfoxfile-0.20.6 → pyfoxfile-0.21.0}/pyproject.toml +1 -1
- {pyfoxfile-0.20.6 → pyfoxfile-0.21.0}/setup.py +2 -2
- {pyfoxfile-0.20.6 → pyfoxfile-0.21.0}/LICENSE +0 -0
- {pyfoxfile-0.20.6 → pyfoxfile-0.21.0}/PyFoxFile.egg-info/dependency_links.txt +0 -0
- {pyfoxfile-0.20.6 → pyfoxfile-0.21.0}/PyFoxFile.egg-info/top_level.txt +0 -0
- {pyfoxfile-0.20.6 → pyfoxfile-0.21.0}/PyFoxFile.egg-info/zip-safe +0 -0
- {pyfoxfile-0.20.6 → pyfoxfile-0.21.0}/README.md +0 -0
- {pyfoxfile-0.20.6 → pyfoxfile-0.21.0}/foxfile.py +0 -0
- {pyfoxfile-0.20.6 → pyfoxfile-0.21.0}/neofoxfile.py +0 -0
- {pyfoxfile-0.20.6 → pyfoxfile-0.21.0}/setup.cfg +0 -0
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
#!/usr/bin/env 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())
|
|
@@ -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
|
|
@@ -366,6 +366,14 @@ if(__include_defaults__):
|
|
|
366
366
|
__file_format_multi_dict__.update( { 'KitsuneFile': {'format_name': "KitsuneFile", 'format_magic': "KitsuneFile", 'format_len': 11, 'format_hex': "4b697473756e6546696c65", 'format_delimiter': "\x00", 'format_ver': "001", 'new_style': True, 'use_advanced_list': True, 'use_alt_inode': False, 'format_extension': ".kitsune" } } )
|
|
367
367
|
if("キツネファイル" not in __file_format_multi_dict__):
|
|
368
368
|
__file_format_multi_dict__.update( { 'キツネファイル': {'format_name': "KitsuneFairu", 'format_magic': "キツネファイル", 'format_len': 21, 'format_hex': "e382ade38384e3838de38395e382a1e382a4e383ab", 'format_delimiter': "\x00", 'format_ver': "001", 'new_style': True, 'use_advanced_list': True, 'use_alt_inode': False, 'format_extension': ".キツネ" } } )
|
|
369
|
+
if("きつねファイル" not in __file_format_multi_dict__):
|
|
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
|
+
if("狐ファイル" not in __file_format_multi_dict__):
|
|
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': ".여우" } } )
|
|
369
377
|
if(__file_format_default__ not in __file_format_multi_dict__):
|
|
370
378
|
__file_format_default__ = next(iter(__file_format_multi_dict__))
|
|
371
379
|
__file_format_name__ = __file_format_multi_dict__[__file_format_default__]['format_name']
|
|
@@ -381,12 +389,12 @@ __file_format_extension__ = __file_format_multi_dict__[__file_format_default__][
|
|
|
381
389
|
__file_format_dict__ = __file_format_multi_dict__[__file_format_default__]
|
|
382
390
|
__project__ = __program_name__
|
|
383
391
|
__project_url__ = "https://github.com/GameMaker2k/PyFoxFile"
|
|
384
|
-
__version_info__ = (0,
|
|
385
|
-
__version_date_info__ = (2025, 9,
|
|
392
|
+
__version_info__ = (0, 21, 0, "RC 1", 1)
|
|
393
|
+
__version_date_info__ = (2025, 9, 17, "RC 1", 1)
|
|
386
394
|
__version_date__ = str(__version_date_info__[0]) + "." + str(
|
|
387
395
|
__version_date_info__[1]).zfill(2) + "." + str(__version_date_info__[2]).zfill(2)
|
|
388
396
|
__revision__ = __version_info__[3]
|
|
389
|
-
__revision_id__ = "$Id:
|
|
397
|
+
__revision_id__ = "$Id: 6208d3cb66a43a7e1047211a926f92f6aecfff08 $"
|
|
390
398
|
if(__version_info__[4] is not None):
|
|
391
399
|
__version_date_plusrc__ = __version_date__ + \
|
|
392
400
|
"-" + str(__version_date_info__[4])
|
|
@@ -3626,11 +3634,14 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, filevalues=[], ext
|
|
|
3626
3634
|
fcontents = BytesIO()
|
|
3627
3635
|
chunk_size = 1024
|
|
3628
3636
|
fcencoding = "UTF-8"
|
|
3629
|
-
|
|
3637
|
+
curcompression = "none"
|
|
3638
|
+
if not followlink and ftype in data_types:
|
|
3630
3639
|
with open(fname, "rb") as fpc:
|
|
3631
3640
|
shutil.copyfileobj(fpc, fcontents)
|
|
3641
|
+
typechecktest = CheckCompressionType(fcontents, closefp=False)
|
|
3642
|
+
fcontents.seek(0, 0)
|
|
3632
3643
|
fcencoding = GetFileEncoding(fcontents, False)
|
|
3633
|
-
if(not compresswholefile):
|
|
3644
|
+
if(typechecktest is False and not compresswholefile):
|
|
3634
3645
|
fcontents.seek(0, 2)
|
|
3635
3646
|
ucfsize = fcontents.tell()
|
|
3636
3647
|
fcontents.seek(0, 0)
|
|
@@ -3651,10 +3662,7 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, filevalues=[], ext
|
|
|
3651
3662
|
ilcsize.append(cfcontents.tell())
|
|
3652
3663
|
cfcontents.close()
|
|
3653
3664
|
else:
|
|
3654
|
-
|
|
3655
|
-
ilcsize.append(sys.maxint)
|
|
3656
|
-
except AttributeError:
|
|
3657
|
-
ilcsize.append(sys.maxsize)
|
|
3665
|
+
ilcsize.append(float("inf"))
|
|
3658
3666
|
ilmin = ilmin + 1
|
|
3659
3667
|
ilcmin = ilcsize.index(min(ilcsize))
|
|
3660
3668
|
curcompression = compressionuselist[ilcmin]
|
|
@@ -3671,13 +3679,16 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, filevalues=[], ext
|
|
|
3671
3679
|
fcompression = curcompression
|
|
3672
3680
|
fcontents.close()
|
|
3673
3681
|
fcontents = cfcontents
|
|
3674
|
-
|
|
3682
|
+
elif followlink and (ftype == 1 or ftype == 2):
|
|
3675
3683
|
if(not os.path.exists(flinkname)):
|
|
3676
3684
|
return False
|
|
3677
3685
|
flstatinfo = os.stat(flinkname)
|
|
3678
3686
|
with open(flinkname, "rb") as fpc:
|
|
3679
3687
|
shutil.copyfileobj(fpc, fcontents)
|
|
3680
|
-
|
|
3688
|
+
typechecktest = CheckCompressionType(fcontents, closefp=False)
|
|
3689
|
+
fcontents.seek(0, 0)
|
|
3690
|
+
fcencoding = GetFileEncoding(fcontents, False)
|
|
3691
|
+
if(typechecktest is False and not compresswholefile):
|
|
3681
3692
|
fcontents.seek(0, 2)
|
|
3682
3693
|
ucfsize = fcontents.tell()
|
|
3683
3694
|
fcontents.seek(0, 0)
|
|
@@ -3698,10 +3709,7 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, filevalues=[], ext
|
|
|
3698
3709
|
ilcsize.append(cfcontents.tell())
|
|
3699
3710
|
cfcontents.close()
|
|
3700
3711
|
else:
|
|
3701
|
-
|
|
3702
|
-
ilcsize.append(sys.maxint)
|
|
3703
|
-
except AttributeError:
|
|
3704
|
-
ilcsize.append(sys.maxsize)
|
|
3712
|
+
ilcsize.append(float("inf"))
|
|
3705
3713
|
ilmin = ilmin + 1
|
|
3706
3714
|
ilcmin = ilcsize.index(min(ilcsize))
|
|
3707
3715
|
curcompression = compressionuselist[ilcmin]
|
|
@@ -5088,11 +5096,14 @@ def PackFoxFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", compress
|
|
|
5088
5096
|
fcsize = format(int(0), 'x').lower()
|
|
5089
5097
|
fcontents = BytesIO()
|
|
5090
5098
|
fcencoding = "UTF-8"
|
|
5091
|
-
|
|
5099
|
+
curcompression = "none"
|
|
5100
|
+
if not followlink and ftype in data_types:
|
|
5092
5101
|
with open(fname, "rb") as fpc:
|
|
5093
5102
|
shutil.copyfileobj(fpc, fcontents)
|
|
5103
|
+
typechecktest = CheckCompressionType(fcontents, closefp=False)
|
|
5104
|
+
fcontents.seek(0, 0)
|
|
5094
5105
|
fcencoding = GetFileEncoding(fcontents, False)
|
|
5095
|
-
if(not compresswholefile):
|
|
5106
|
+
if(typechecktest is False and not compresswholefile):
|
|
5096
5107
|
fcontents.seek(0, 2)
|
|
5097
5108
|
ucfsize = fcontents.tell()
|
|
5098
5109
|
fcontents.seek(0, 0)
|
|
@@ -5113,10 +5124,7 @@ def PackFoxFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", compress
|
|
|
5113
5124
|
ilcsize.append(cfcontents.tell())
|
|
5114
5125
|
cfcontents.close()
|
|
5115
5126
|
else:
|
|
5116
|
-
|
|
5117
|
-
ilcsize.append(sys.maxint)
|
|
5118
|
-
except AttributeError:
|
|
5119
|
-
ilcsize.append(sys.maxsize)
|
|
5127
|
+
ilcsize.append(float("inf"))
|
|
5120
5128
|
ilmin = ilmin + 1
|
|
5121
5129
|
ilcmin = ilcsize.index(min(ilcsize))
|
|
5122
5130
|
curcompression = compressionuselist[ilcmin]
|
|
@@ -5133,15 +5141,16 @@ def PackFoxFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", compress
|
|
|
5133
5141
|
fcompression = curcompression
|
|
5134
5142
|
fcontents.close()
|
|
5135
5143
|
fcontents = cfcontents
|
|
5136
|
-
|
|
5137
|
-
fcompression = ""
|
|
5138
|
-
if(followlink and (ftype == 1 or ftype == 2)):
|
|
5144
|
+
elif followlink and (ftype == 1 or ftype == 2):
|
|
5139
5145
|
if(not os.path.exists(flinkname)):
|
|
5140
5146
|
return False
|
|
5141
5147
|
flstatinfo = os.stat(flinkname)
|
|
5142
5148
|
with open(flinkname, "rb") as fpc:
|
|
5143
5149
|
shutil.copyfileobj(fpc, fcontents)
|
|
5144
|
-
|
|
5150
|
+
typechecktest = CheckCompressionType(fcontents, closefp=False)
|
|
5151
|
+
fcontents.seek(0, 0)
|
|
5152
|
+
fcencoding = GetFileEncoding(fcontents, False)
|
|
5153
|
+
if(typechecktest is False and not compresswholefile):
|
|
5145
5154
|
fcontents.seek(0, 2)
|
|
5146
5155
|
ucfsize = fcontents.tell()
|
|
5147
5156
|
fcontents.seek(0, 0)
|
|
@@ -5162,10 +5171,7 @@ def PackFoxFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", compress
|
|
|
5162
5171
|
ilcsize.append(cfcontents.tell())
|
|
5163
5172
|
cfcontents.close()
|
|
5164
5173
|
else:
|
|
5165
|
-
|
|
5166
|
-
ilcsize.append(sys.maxint)
|
|
5167
|
-
except AttributeError:
|
|
5168
|
-
ilcsize.append(sys.maxsize)
|
|
5174
|
+
ilcsize.append(float("inf"))
|
|
5169
5175
|
ilmin = ilmin + 1
|
|
5170
5176
|
ilcmin = ilcsize.index(min(ilcsize))
|
|
5171
5177
|
curcompression = compressionuselist[ilcmin]
|
|
@@ -5182,6 +5188,8 @@ def PackFoxFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", compress
|
|
|
5182
5188
|
fcompression = curcompression
|
|
5183
5189
|
fcontents.close()
|
|
5184
5190
|
fcontents = cfcontents
|
|
5191
|
+
if(fcompression == "none"):
|
|
5192
|
+
fcompression = ""
|
|
5185
5193
|
fcontents.seek(0, 0)
|
|
5186
5194
|
ftypehex = format(ftype, 'x').lower()
|
|
5187
5195
|
tmpoutlist = [ftypehex, fencoding, fcencoding, fname, flinkname, fsize, fatime, fmtime, fctime, fbtime, fmode, fwinattributes, fcompression,
|
|
@@ -5435,11 +5443,14 @@ def PackFoxFileFromTarFile(infile, outfile, fmttype="auto", compression="auto",
|
|
|
5435
5443
|
fcsize = format(int(0), 'x').lower()
|
|
5436
5444
|
fcontents = BytesIO()
|
|
5437
5445
|
fcencoding = "UTF-8"
|
|
5446
|
+
curcompression = "none"
|
|
5438
5447
|
if ftype in data_types:
|
|
5439
5448
|
fpc = tarfp.extractfile(member)
|
|
5440
5449
|
shutil.copyfileobj(fpc, fcontents)
|
|
5450
|
+
typechecktest = CheckCompressionType(fcontents, closefp=False)
|
|
5451
|
+
fcontents.seek(0, 0)
|
|
5441
5452
|
fcencoding = GetFileEncoding(fcontents, False)
|
|
5442
|
-
if(not compresswholefile):
|
|
5453
|
+
if(typechecktest is False and not compresswholefile):
|
|
5443
5454
|
fcontents.seek(0, 2)
|
|
5444
5455
|
ucfsize = fcontents.tell()
|
|
5445
5456
|
fcontents.seek(0, 0)
|
|
@@ -5460,10 +5471,7 @@ def PackFoxFileFromTarFile(infile, outfile, fmttype="auto", compression="auto",
|
|
|
5460
5471
|
ilcsize.append(cfcontents.tell())
|
|
5461
5472
|
cfcontents.close()
|
|
5462
5473
|
else:
|
|
5463
|
-
|
|
5464
|
-
ilcsize.append(sys.maxint)
|
|
5465
|
-
except AttributeError:
|
|
5466
|
-
ilcsize.append(sys.maxsize)
|
|
5474
|
+
ilcsize.append(float("inf"))
|
|
5467
5475
|
ilmin = ilmin + 1
|
|
5468
5476
|
ilcmin = ilcsize.index(min(ilcsize))
|
|
5469
5477
|
curcompression = compressionuselist[ilcmin]
|
|
@@ -5733,10 +5741,13 @@ def PackFoxFileFromZipFile(infile, outfile, fmttype="auto", compression="auto",
|
|
|
5733
5741
|
fgname = ""
|
|
5734
5742
|
fcontents = BytesIO()
|
|
5735
5743
|
fcencoding = "UTF-8"
|
|
5736
|
-
|
|
5744
|
+
curcompression = "none"
|
|
5745
|
+
if ftype == 0:
|
|
5737
5746
|
fcontents.write(zipfp.read(member.filename))
|
|
5747
|
+
typechecktest = CheckCompressionType(fcontents, closefp=False)
|
|
5748
|
+
fcontents.seek(0, 0)
|
|
5738
5749
|
fcencoding = GetFileEncoding(fcontents, False)
|
|
5739
|
-
if(not compresswholefile):
|
|
5750
|
+
if(typechecktest is False and not compresswholefile):
|
|
5740
5751
|
fcontents.seek(0, 2)
|
|
5741
5752
|
ucfsize = fcontents.tell()
|
|
5742
5753
|
fcontents.seek(0, 0)
|
|
@@ -6047,10 +6058,13 @@ if(rarfile_support):
|
|
|
6047
6058
|
fgname = ""
|
|
6048
6059
|
fcontents = BytesIO()
|
|
6049
6060
|
fcencoding = "UTF-8"
|
|
6050
|
-
|
|
6061
|
+
curcompression = "none"
|
|
6062
|
+
if ftype == 0:
|
|
6051
6063
|
fcontents.write(rarfp.read(member.filename))
|
|
6064
|
+
typechecktest = CheckCompressionType(fcontents, closefp=False)
|
|
6065
|
+
fcontents.seek(0, 0)
|
|
6052
6066
|
fcencoding = GetFileEncoding(fcontents, False)
|
|
6053
|
-
if(not compresswholefile):
|
|
6067
|
+
if(typechecktest is False and not compresswholefile):
|
|
6054
6068
|
fcontents.seek(0, 2)
|
|
6055
6069
|
ucfsize = fcontents.tell()
|
|
6056
6070
|
fcontents.seek(0, 0)
|
|
@@ -6071,10 +6085,7 @@ if(rarfile_support):
|
|
|
6071
6085
|
ilcsize.append(cfcontents.tell())
|
|
6072
6086
|
cfcontents.close()
|
|
6073
6087
|
else:
|
|
6074
|
-
|
|
6075
|
-
ilcsize.append(sys.maxint)
|
|
6076
|
-
except AttributeError:
|
|
6077
|
-
ilcsize.append(sys.maxsize)
|
|
6088
|
+
ilcsize.append(float("inf"))
|
|
6078
6089
|
ilmin = ilmin + 1
|
|
6079
6090
|
ilcmin = ilcsize.index(min(ilcsize))
|
|
6080
6091
|
curcompression = compressionuselist[ilcmin]
|
|
@@ -6298,12 +6309,15 @@ if(py7zr_support):
|
|
|
6298
6309
|
fgname = ""
|
|
6299
6310
|
fcontents = BytesIO()
|
|
6300
6311
|
fcencoding = "UTF-8"
|
|
6301
|
-
|
|
6312
|
+
curcompression = "none"
|
|
6313
|
+
if ftype == 0:
|
|
6302
6314
|
fcontents.write(file_content[member.filename].read())
|
|
6315
|
+
typechecktest = CheckCompressionType(fcontents, closefp=False)
|
|
6316
|
+
fcontents.seek(0, 0)
|
|
6303
6317
|
fcencoding = GetFileEncoding(fcontents, False)
|
|
6304
6318
|
fsize = format(fcontents.tell(), 'x').lower()
|
|
6305
6319
|
file_content[member.filename].close()
|
|
6306
|
-
if(not compresswholefile):
|
|
6320
|
+
if(typechecktest is False and not compresswholefile):
|
|
6307
6321
|
fcontents.seek(0, 2)
|
|
6308
6322
|
ucfsize = fcontents.tell()
|
|
6309
6323
|
fcontents.seek(0, 0)
|
|
@@ -6324,10 +6338,7 @@ if(py7zr_support):
|
|
|
6324
6338
|
ilcsize.append(cfcontents.tell())
|
|
6325
6339
|
cfcontents.close()
|
|
6326
6340
|
else:
|
|
6327
|
-
|
|
6328
|
-
ilcsize.append(sys.maxint)
|
|
6329
|
-
except AttributeError:
|
|
6330
|
-
ilcsize.append(sys.maxsize)
|
|
6341
|
+
ilcsize.append(float("inf"))
|
|
6331
6342
|
ilmin = ilmin + 1
|
|
6332
6343
|
ilcmin = ilcsize.index(min(ilcsize))
|
|
6333
6344
|
curcompression = compressionuselist[ilcmin]
|
|
@@ -8168,10 +8179,13 @@ def RePackFoxFile(infile, outfile, fmttype="auto", compression="auto", compressw
|
|
|
8168
8179
|
fcontents = listfoxfiles['ffilelist'][reallcfi]['fcontents']
|
|
8169
8180
|
if(not listfoxfiles['ffilelist'][reallcfi]['fcontentasfile']):
|
|
8170
8181
|
fcontents = BytesIO(fcontents)
|
|
8182
|
+
typechecktest = CheckCompressionType(fcontents, closefp=False)
|
|
8183
|
+
fcontents.seek(0, 0)
|
|
8171
8184
|
fcencoding = GetFileEncoding(fcontents, False)
|
|
8172
8185
|
fcompression = ""
|
|
8173
8186
|
fcsize = format(int(0), 'x').lower()
|
|
8174
|
-
|
|
8187
|
+
curcompression = "none"
|
|
8188
|
+
if typechecktest is False and not compresswholefile:
|
|
8175
8189
|
fcontents.seek(0, 2)
|
|
8176
8190
|
ucfsize = fcontents.tell()
|
|
8177
8191
|
fcontents.seek(0, 0)
|
|
@@ -8192,10 +8206,7 @@ def RePackFoxFile(infile, outfile, fmttype="auto", compression="auto", compressw
|
|
|
8192
8206
|
ilcsize.append(cfcontents.tell())
|
|
8193
8207
|
cfcontents.close()
|
|
8194
8208
|
else:
|
|
8195
|
-
|
|
8196
|
-
ilcsize.append(sys.maxint)
|
|
8197
|
-
except AttributeError:
|
|
8198
|
-
ilcsize.append(sys.maxsize)
|
|
8209
|
+
ilcsize.append(float("inf"))
|
|
8199
8210
|
ilmin = ilmin + 1
|
|
8200
8211
|
ilcmin = ilcsize.index(min(ilcsize))
|
|
8201
8212
|
curcompression = compressionuselist[ilcmin]
|
|
@@ -8212,11 +8223,11 @@ def RePackFoxFile(infile, outfile, fmttype="auto", compression="auto", compressw
|
|
|
8212
8223
|
fcompression = curcompression
|
|
8213
8224
|
fcontents.close()
|
|
8214
8225
|
fcontents = cfcontents
|
|
8215
|
-
if
|
|
8216
|
-
if(
|
|
8217
|
-
getflinkpath =
|
|
8218
|
-
flinkid =
|
|
8219
|
-
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]
|
|
8220
8231
|
fheadersize = format(
|
|
8221
8232
|
int(flinkinfo['fheadersize']), 'x').lower()
|
|
8222
8233
|
fsize = format(int(flinkinfo['fsize']), 'x').lower()
|
|
@@ -8253,7 +8264,7 @@ def RePackFoxFile(infile, outfile, fmttype="auto", compression="auto", compressw
|
|
|
8253
8264
|
ftypehex = format(flinkinfo['ftype'], 'x').lower()
|
|
8254
8265
|
else:
|
|
8255
8266
|
ftypehex = format(
|
|
8256
|
-
|
|
8267
|
+
listarchivefiles['ffilelist'][reallcfi]['ftype'], 'x').lower()
|
|
8257
8268
|
fcurfid = format(curfid, 'x').lower()
|
|
8258
8269
|
if(not followlink and finode != 0):
|
|
8259
8270
|
if(listfoxfiles['ffilelist'][reallcfi]['ftype'] != 1):
|
|
@@ -8621,7 +8632,7 @@ def FoxFileListFiles(infile, fmttype="auto", seekstart=0, seekend=0, skipchecksu
|
|
|
8621
8632
|
else:
|
|
8622
8633
|
if(infile != "-" and not hasattr(infile, "read") and not hasattr(infile, "write") and not (sys.version_info[0] >= 3 and isinstance(infile, bytes))):
|
|
8623
8634
|
infile = RemoveWindowsPath(infile)
|
|
8624
|
-
listarchivefiles =
|
|
8635
|
+
listarchivefiles = FoxFileToArray(infile, fmttype, seekstart, seekend, True, False, False, skipchecksum, formatspecs, seektoend, returnfp)
|
|
8625
8636
|
if(not listarchivefiles):
|
|
8626
8637
|
return False
|
|
8627
8638
|
lenlist = len(listarchivefiles['ffilelist'])
|
|
@@ -9205,6 +9216,43 @@ def ListDirListFiles(infiles, dirlistfromtxt=False, compression="auto", compress
|
|
|
9205
9216
|
outarray, seekstart, seekend, skipchecksum, formatspecs, seektoend, verbose, returnfp)
|
|
9206
9217
|
return listfoxfiles
|
|
9207
9218
|
|
|
9219
|
+
"""
|
|
9220
|
+
PyNeoFile compatibility layer
|
|
9221
|
+
"""
|
|
9222
|
+
|
|
9223
|
+
def make_empty_file_pointer_neo(fp, fmttype=None, checksumtype='crc32', formatspecs=__file_format_multi_dict__, encoding='UTF-8'):
|
|
9224
|
+
return MakeEmptyFilePointer(fp, fmttype, checksumtype, formatspecs)
|
|
9225
|
+
|
|
9226
|
+
def make_empty_archive_file_pointer_neo(fp, fmttype=None, checksumtype='crc32', formatspecs=__file_format_multi_dict__, encoding='UTF-8'):
|
|
9227
|
+
return make_empty_file_pointer_neo(fp, fmttype, checksumtype, formatspecs, encoding)
|
|
9228
|
+
|
|
9229
|
+
def make_empty_file_neo(outfile=None, fmttype=None, checksumtype='crc32', formatspecs=__file_format_multi_dict__, encoding='UTF-8', returnfp=False):
|
|
9230
|
+
return MakeEmptyFile(outfile, fmttype, "auto", False, None, checksumtype, formatspecs, returnfp)
|
|
9231
|
+
|
|
9232
|
+
def make_empty_archive_file_neo(outfile=None, fmttype=None, checksumtype='crc32', formatspecs=__file_format_multi_dict__, encoding='UTF-8', returnfp=False):
|
|
9233
|
+
return make_empty_file_neo(outfile, fmttype, checksumtype, formatspecs, encoding, returnfp)
|
|
9234
|
+
|
|
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):
|
|
9236
|
+
return PackFoxFile(infiles, outfile, False, "auto", compression, False, compression_level, compressionlistalt, False, checksumtypes, [], {}, formatspecs, False, returnfp)
|
|
9237
|
+
|
|
9238
|
+
def archive_to_array_neo(infile, formatspecs=__file_format_multi_dict__, listonly=False, skipchecksum=False, uncompress=True, returnfp=False):
|
|
9239
|
+
return FoxFileToArray(infile, "auto", 0, 0, listonly, True, uncompress, skipchecksum, formatspecs, False, returnfp)
|
|
9240
|
+
|
|
9241
|
+
def unpack_neo(infile, outdir='.', formatspecs=__file_format_multi_dict__, skipchecksum=False, uncompress=True, returnfp=False):
|
|
9242
|
+
return UnPackFoxFile(infile, outdir, False, 0, 0, skipchecksum, formatspecs, True, True, False, False, returnfp)
|
|
9243
|
+
|
|
9244
|
+
def repack_neo(infile, outfile=None, formatspecs=__file_format_dict__, checksumtypes=["crc32", "crc32", "crc32", "crc32"], compression="auto", compression_level=None, returnfp=False):
|
|
9245
|
+
return RePackFoxFile(infile, outfile, "auto", compression, False, compression_level, compressionlistalt, False, 0, 0, checksumtypes, False, [], {}, formatspecs, False, False, returnfp)
|
|
9246
|
+
|
|
9247
|
+
def archivefilevalidate_neo(infile, formatspecs=__file_format_multi_dict__, verbose=False, return_details=False, returnfp=False):
|
|
9248
|
+
return FoxFileValidate(infile, "auto", formatspecs, False, verbose, returnfp)
|
|
9249
|
+
|
|
9250
|
+
def archivefilelistfiles_neo(infile, formatspecs=__file_format_multi_dict__, advanced=False, include_dirs=True, returnfp=False):
|
|
9251
|
+
return FoxFileListFiles(infile, "auto", 0, 0, False, formatspecs, False, True, advanced, returnfp)
|
|
9252
|
+
|
|
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):
|
|
9254
|
+
intmp = InFileToArray(infile, 0, 0, False, True, False, formatspecs, False, False)
|
|
9255
|
+
return RePackFoxFile(intmp, outfile, "auto", compression, False, compression_level, compressionlistalt, False, 0, 0, checksumtypes, False, [], {}, formatspecs, False, False, returnfp)
|
|
9208
9256
|
|
|
9209
9257
|
def download_file_from_ftp_file(url):
|
|
9210
9258
|
urlparts = urlparse(url)
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
Copyright 2016-2024 Game Maker 2k - http://intdb.sourceforge.net/
|
|
14
14
|
Copyright 2016-2024 Kazuki Przyborowski - https://github.com/KazukiPrzyborowski
|
|
15
15
|
|
|
16
|
-
$FileInfo: setup.py - Last Update:
|
|
16
|
+
$FileInfo: setup.py - Last Update: 9/17/2025 Ver. 0.21.0 RC 1 - Author: cooldude2k $
|
|
17
17
|
'''
|
|
18
18
|
|
|
19
19
|
import os
|
|
@@ -79,7 +79,7 @@ pymodule[
|
|
|
79
79
|
pymodule['platforms'] = 'OS Independent'
|
|
80
80
|
pymodule['zipsafe'] = True
|
|
81
81
|
pymodule['pymodules'] = ['pyfoxfile']
|
|
82
|
-
pymodule['scripts'] = ['foxfile.py', 'neofoxfile.py']
|
|
82
|
+
pymodule['scripts'] = ['foxfile.py', 'neofoxfile.py', 'foxneofile.py']
|
|
83
83
|
pymodule['classifiers'] = [
|
|
84
84
|
'Development Status :: 5 - Production/Stable',
|
|
85
85
|
'Intended Audience :: Developers',
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|