PyArchiveFile 0.20.8__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.
- {pyarchivefile-0.20.8 → pyarchivefile-0.21.0}/PKG-INFO +1 -1
- {pyarchivefile-0.20.8 → pyarchivefile-0.21.0}/PyArchiveFile.egg-info/PKG-INFO +1 -1
- {pyarchivefile-0.20.8 → pyarchivefile-0.21.0}/PyArchiveFile.egg-info/SOURCES.txt +1 -0
- pyarchivefile-0.21.0/archiveneofile.py +130 -0
- {pyarchivefile-0.20.8 → pyarchivefile-0.21.0}/pyarchivefile.py +69 -66
- {pyarchivefile-0.20.8 → pyarchivefile-0.21.0}/pyproject.toml +1 -1
- {pyarchivefile-0.20.8 → pyarchivefile-0.21.0}/setup.py +2 -2
- {pyarchivefile-0.20.8 → pyarchivefile-0.21.0}/LICENSE +0 -0
- {pyarchivefile-0.20.8 → pyarchivefile-0.21.0}/PyArchiveFile.egg-info/dependency_links.txt +0 -0
- {pyarchivefile-0.20.8 → pyarchivefile-0.21.0}/PyArchiveFile.egg-info/top_level.txt +0 -0
- {pyarchivefile-0.20.8 → pyarchivefile-0.21.0}/PyArchiveFile.egg-info/zip-safe +0 -0
- {pyarchivefile-0.20.8 → pyarchivefile-0.21.0}/README.md +0 -0
- {pyarchivefile-0.20.8 → pyarchivefile-0.21.0}/archivefile.py +0 -0
- {pyarchivefile-0.20.8 → pyarchivefile-0.21.0}/neoarchivefile.py +0 -0
- {pyarchivefile-0.20.8 → pyarchivefile-0.21.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: PyArchiveFile
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.21.0
|
|
4
4
|
Summary: A tar like file format name archivefile.
|
|
5
5
|
Home-page: https://github.com/GameMaker2k/PyArchiveFile
|
|
6
6
|
Download-URL: https://github.com/GameMaker2k/PyArchiveFile/archive/master.tar.gz
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: PyArchiveFile
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.21.0
|
|
4
4
|
Summary: A tar like file format name archivefile.
|
|
5
5
|
Home-page: https://github.com/GameMaker2k/PyArchiveFile
|
|
6
6
|
Download-URL: https://github.com/GameMaker2k/PyArchiveFile/archive/master.tar.gz
|
|
@@ -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 pycatfile as P # core must provide *_neo functions
|
|
9
|
+
except Exception as e:
|
|
10
|
+
sys.stderr.write("Failed to import core module 'pycatfile': %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 pycatfile 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: pyarchivefile.py - Last Update: 9/
|
|
17
|
+
$FileInfo: pyarchivefile.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
|
|
@@ -379,12 +379,12 @@ __file_format_extension__ = __file_format_multi_dict__[__file_format_default__][
|
|
|
379
379
|
__file_format_dict__ = __file_format_multi_dict__[__file_format_default__]
|
|
380
380
|
__project__ = __program_name__
|
|
381
381
|
__project_url__ = "https://github.com/GameMaker2k/PyArchiveFile"
|
|
382
|
-
__version_info__ = (0,
|
|
383
|
-
__version_date_info__ = (2025, 9,
|
|
382
|
+
__version_info__ = (0, 21, 0, "RC 1", 1)
|
|
383
|
+
__version_date_info__ = (2025, 9, 17, "RC 1", 1)
|
|
384
384
|
__version_date__ = str(__version_date_info__[0]) + "." + str(
|
|
385
385
|
__version_date_info__[1]).zfill(2) + "." + str(__version_date_info__[2]).zfill(2)
|
|
386
386
|
__revision__ = __version_info__[3]
|
|
387
|
-
__revision_id__ = "$Id:
|
|
387
|
+
__revision_id__ = "$Id: 40a5a37977e6917976fb60e9cd8b0fbd879c8bce $"
|
|
388
388
|
if(__version_info__[4] is not None):
|
|
389
389
|
__version_date_plusrc__ = __version_date__ + \
|
|
390
390
|
"-" + str(__version_date_info__[4])
|
|
@@ -3624,11 +3624,14 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, filevalues=[], ext
|
|
|
3624
3624
|
fcontents = BytesIO()
|
|
3625
3625
|
chunk_size = 1024
|
|
3626
3626
|
fcencoding = "UTF-8"
|
|
3627
|
-
|
|
3627
|
+
curcompression = "none"
|
|
3628
|
+
if not followlink and ftype in data_types:
|
|
3628
3629
|
with open(fname, "rb") as fpc:
|
|
3629
3630
|
shutil.copyfileobj(fpc, fcontents)
|
|
3631
|
+
typechecktest = CheckCompressionType(fcontents, closefp=False)
|
|
3632
|
+
fcontents.seek(0, 0)
|
|
3630
3633
|
fcencoding = GetFileEncoding(fcontents, False)
|
|
3631
|
-
if(not compresswholefile):
|
|
3634
|
+
if(typechecktest is False and not compresswholefile):
|
|
3632
3635
|
fcontents.seek(0, 2)
|
|
3633
3636
|
ucfsize = fcontents.tell()
|
|
3634
3637
|
fcontents.seek(0, 0)
|
|
@@ -3649,10 +3652,7 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, filevalues=[], ext
|
|
|
3649
3652
|
ilcsize.append(cfcontents.tell())
|
|
3650
3653
|
cfcontents.close()
|
|
3651
3654
|
else:
|
|
3652
|
-
|
|
3653
|
-
ilcsize.append(sys.maxint)
|
|
3654
|
-
except AttributeError:
|
|
3655
|
-
ilcsize.append(sys.maxsize)
|
|
3655
|
+
ilcsize.append(float("inf"))
|
|
3656
3656
|
ilmin = ilmin + 1
|
|
3657
3657
|
ilcmin = ilcsize.index(min(ilcsize))
|
|
3658
3658
|
curcompression = compressionuselist[ilcmin]
|
|
@@ -3669,13 +3669,16 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, filevalues=[], ext
|
|
|
3669
3669
|
fcompression = curcompression
|
|
3670
3670
|
fcontents.close()
|
|
3671
3671
|
fcontents = cfcontents
|
|
3672
|
-
|
|
3672
|
+
elif followlink and (ftype == 1 or ftype == 2):
|
|
3673
3673
|
if(not os.path.exists(flinkname)):
|
|
3674
3674
|
return False
|
|
3675
3675
|
flstatinfo = os.stat(flinkname)
|
|
3676
3676
|
with open(flinkname, "rb") as fpc:
|
|
3677
3677
|
shutil.copyfileobj(fpc, fcontents)
|
|
3678
|
-
|
|
3678
|
+
typechecktest = CheckCompressionType(fcontents, closefp=False)
|
|
3679
|
+
fcontents.seek(0, 0)
|
|
3680
|
+
fcencoding = GetFileEncoding(fcontents, False)
|
|
3681
|
+
if(typechecktest is False and not compresswholefile):
|
|
3679
3682
|
fcontents.seek(0, 2)
|
|
3680
3683
|
ucfsize = fcontents.tell()
|
|
3681
3684
|
fcontents.seek(0, 0)
|
|
@@ -3696,10 +3699,7 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, filevalues=[], ext
|
|
|
3696
3699
|
ilcsize.append(cfcontents.tell())
|
|
3697
3700
|
cfcontents.close()
|
|
3698
3701
|
else:
|
|
3699
|
-
|
|
3700
|
-
ilcsize.append(sys.maxint)
|
|
3701
|
-
except AttributeError:
|
|
3702
|
-
ilcsize.append(sys.maxsize)
|
|
3702
|
+
ilcsize.append(float("inf"))
|
|
3703
3703
|
ilmin = ilmin + 1
|
|
3704
3704
|
ilcmin = ilcsize.index(min(ilcsize))
|
|
3705
3705
|
curcompression = compressionuselist[ilcmin]
|
|
@@ -5086,11 +5086,14 @@ def PackArchiveFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", comp
|
|
|
5086
5086
|
fcsize = format(int(0), 'x').lower()
|
|
5087
5087
|
fcontents = BytesIO()
|
|
5088
5088
|
fcencoding = "UTF-8"
|
|
5089
|
-
|
|
5089
|
+
curcompression = "none"
|
|
5090
|
+
if not followlink and ftype in data_types:
|
|
5090
5091
|
with open(fname, "rb") as fpc:
|
|
5091
5092
|
shutil.copyfileobj(fpc, fcontents)
|
|
5093
|
+
typechecktest = CheckCompressionType(fcontents, closefp=False)
|
|
5094
|
+
fcontents.seek(0, 0)
|
|
5092
5095
|
fcencoding = GetFileEncoding(fcontents, False)
|
|
5093
|
-
if(not compresswholefile):
|
|
5096
|
+
if(typechecktest is False and not compresswholefile):
|
|
5094
5097
|
fcontents.seek(0, 2)
|
|
5095
5098
|
ucfsize = fcontents.tell()
|
|
5096
5099
|
fcontents.seek(0, 0)
|
|
@@ -5111,10 +5114,7 @@ def PackArchiveFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", comp
|
|
|
5111
5114
|
ilcsize.append(cfcontents.tell())
|
|
5112
5115
|
cfcontents.close()
|
|
5113
5116
|
else:
|
|
5114
|
-
|
|
5115
|
-
ilcsize.append(sys.maxint)
|
|
5116
|
-
except AttributeError:
|
|
5117
|
-
ilcsize.append(sys.maxsize)
|
|
5117
|
+
ilcsize.append(float("inf"))
|
|
5118
5118
|
ilmin = ilmin + 1
|
|
5119
5119
|
ilcmin = ilcsize.index(min(ilcsize))
|
|
5120
5120
|
curcompression = compressionuselist[ilcmin]
|
|
@@ -5131,15 +5131,16 @@ def PackArchiveFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", comp
|
|
|
5131
5131
|
fcompression = curcompression
|
|
5132
5132
|
fcontents.close()
|
|
5133
5133
|
fcontents = cfcontents
|
|
5134
|
-
|
|
5135
|
-
fcompression = ""
|
|
5136
|
-
if(followlink and (ftype == 1 or ftype == 2)):
|
|
5134
|
+
elif followlink and (ftype == 1 or ftype == 2):
|
|
5137
5135
|
if(not os.path.exists(flinkname)):
|
|
5138
5136
|
return False
|
|
5139
5137
|
flstatinfo = os.stat(flinkname)
|
|
5140
5138
|
with open(flinkname, "rb") as fpc:
|
|
5141
5139
|
shutil.copyfileobj(fpc, fcontents)
|
|
5142
|
-
|
|
5140
|
+
typechecktest = CheckCompressionType(fcontents, closefp=False)
|
|
5141
|
+
fcontents.seek(0, 0)
|
|
5142
|
+
fcencoding = GetFileEncoding(fcontents, False)
|
|
5143
|
+
if(typechecktest is False and not compresswholefile):
|
|
5143
5144
|
fcontents.seek(0, 2)
|
|
5144
5145
|
ucfsize = fcontents.tell()
|
|
5145
5146
|
fcontents.seek(0, 0)
|
|
@@ -5160,10 +5161,7 @@ def PackArchiveFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", comp
|
|
|
5160
5161
|
ilcsize.append(cfcontents.tell())
|
|
5161
5162
|
cfcontents.close()
|
|
5162
5163
|
else:
|
|
5163
|
-
|
|
5164
|
-
ilcsize.append(sys.maxint)
|
|
5165
|
-
except AttributeError:
|
|
5166
|
-
ilcsize.append(sys.maxsize)
|
|
5164
|
+
ilcsize.append(float("inf"))
|
|
5167
5165
|
ilmin = ilmin + 1
|
|
5168
5166
|
ilcmin = ilcsize.index(min(ilcsize))
|
|
5169
5167
|
curcompression = compressionuselist[ilcmin]
|
|
@@ -5180,6 +5178,8 @@ def PackArchiveFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", comp
|
|
|
5180
5178
|
fcompression = curcompression
|
|
5181
5179
|
fcontents.close()
|
|
5182
5180
|
fcontents = cfcontents
|
|
5181
|
+
if(fcompression == "none"):
|
|
5182
|
+
fcompression = ""
|
|
5183
5183
|
fcontents.seek(0, 0)
|
|
5184
5184
|
ftypehex = format(ftype, 'x').lower()
|
|
5185
5185
|
tmpoutlist = [ftypehex, fencoding, fcencoding, fname, flinkname, fsize, fatime, fmtime, fctime, fbtime, fmode, fwinattributes, fcompression,
|
|
@@ -5433,11 +5433,14 @@ def PackArchiveFileFromTarFile(infile, outfile, fmttype="auto", compression="aut
|
|
|
5433
5433
|
fcsize = format(int(0), 'x').lower()
|
|
5434
5434
|
fcontents = BytesIO()
|
|
5435
5435
|
fcencoding = "UTF-8"
|
|
5436
|
+
curcompression = "none"
|
|
5436
5437
|
if ftype in data_types:
|
|
5437
5438
|
fpc = tarfp.extractfile(member)
|
|
5438
5439
|
shutil.copyfileobj(fpc, fcontents)
|
|
5440
|
+
typechecktest = CheckCompressionType(fcontents, closefp=False)
|
|
5441
|
+
fcontents.seek(0, 0)
|
|
5439
5442
|
fcencoding = GetFileEncoding(fcontents, False)
|
|
5440
|
-
if(not compresswholefile):
|
|
5443
|
+
if(typechecktest is False and not compresswholefile):
|
|
5441
5444
|
fcontents.seek(0, 2)
|
|
5442
5445
|
ucfsize = fcontents.tell()
|
|
5443
5446
|
fcontents.seek(0, 0)
|
|
@@ -5458,10 +5461,7 @@ def PackArchiveFileFromTarFile(infile, outfile, fmttype="auto", compression="aut
|
|
|
5458
5461
|
ilcsize.append(cfcontents.tell())
|
|
5459
5462
|
cfcontents.close()
|
|
5460
5463
|
else:
|
|
5461
|
-
|
|
5462
|
-
ilcsize.append(sys.maxint)
|
|
5463
|
-
except AttributeError:
|
|
5464
|
-
ilcsize.append(sys.maxsize)
|
|
5464
|
+
ilcsize.append(float("inf"))
|
|
5465
5465
|
ilmin = ilmin + 1
|
|
5466
5466
|
ilcmin = ilcsize.index(min(ilcsize))
|
|
5467
5467
|
curcompression = compressionuselist[ilcmin]
|
|
@@ -5731,10 +5731,13 @@ def PackArchiveFileFromZipFile(infile, outfile, fmttype="auto", compression="aut
|
|
|
5731
5731
|
fgname = ""
|
|
5732
5732
|
fcontents = BytesIO()
|
|
5733
5733
|
fcencoding = "UTF-8"
|
|
5734
|
-
|
|
5734
|
+
curcompression = "none"
|
|
5735
|
+
if ftype == 0:
|
|
5735
5736
|
fcontents.write(zipfp.read(member.filename))
|
|
5737
|
+
typechecktest = CheckCompressionType(fcontents, closefp=False)
|
|
5738
|
+
fcontents.seek(0, 0)
|
|
5736
5739
|
fcencoding = GetFileEncoding(fcontents, False)
|
|
5737
|
-
if(not compresswholefile):
|
|
5740
|
+
if(typechecktest is False and not compresswholefile):
|
|
5738
5741
|
fcontents.seek(0, 2)
|
|
5739
5742
|
ucfsize = fcontents.tell()
|
|
5740
5743
|
fcontents.seek(0, 0)
|
|
@@ -6045,10 +6048,13 @@ if(rarfile_support):
|
|
|
6045
6048
|
fgname = ""
|
|
6046
6049
|
fcontents = BytesIO()
|
|
6047
6050
|
fcencoding = "UTF-8"
|
|
6048
|
-
|
|
6051
|
+
curcompression = "none"
|
|
6052
|
+
if ftype == 0:
|
|
6049
6053
|
fcontents.write(rarfp.read(member.filename))
|
|
6054
|
+
typechecktest = CheckCompressionType(fcontents, closefp=False)
|
|
6055
|
+
fcontents.seek(0, 0)
|
|
6050
6056
|
fcencoding = GetFileEncoding(fcontents, False)
|
|
6051
|
-
if(not compresswholefile):
|
|
6057
|
+
if(typechecktest is False and not compresswholefile):
|
|
6052
6058
|
fcontents.seek(0, 2)
|
|
6053
6059
|
ucfsize = fcontents.tell()
|
|
6054
6060
|
fcontents.seek(0, 0)
|
|
@@ -6069,10 +6075,7 @@ if(rarfile_support):
|
|
|
6069
6075
|
ilcsize.append(cfcontents.tell())
|
|
6070
6076
|
cfcontents.close()
|
|
6071
6077
|
else:
|
|
6072
|
-
|
|
6073
|
-
ilcsize.append(sys.maxint)
|
|
6074
|
-
except AttributeError:
|
|
6075
|
-
ilcsize.append(sys.maxsize)
|
|
6078
|
+
ilcsize.append(float("inf"))
|
|
6076
6079
|
ilmin = ilmin + 1
|
|
6077
6080
|
ilcmin = ilcsize.index(min(ilcsize))
|
|
6078
6081
|
curcompression = compressionuselist[ilcmin]
|
|
@@ -6296,12 +6299,15 @@ if(py7zr_support):
|
|
|
6296
6299
|
fgname = ""
|
|
6297
6300
|
fcontents = BytesIO()
|
|
6298
6301
|
fcencoding = "UTF-8"
|
|
6299
|
-
|
|
6302
|
+
curcompression = "none"
|
|
6303
|
+
if ftype == 0:
|
|
6300
6304
|
fcontents.write(file_content[member.filename].read())
|
|
6305
|
+
typechecktest = CheckCompressionType(fcontents, closefp=False)
|
|
6306
|
+
fcontents.seek(0, 0)
|
|
6301
6307
|
fcencoding = GetFileEncoding(fcontents, False)
|
|
6302
6308
|
fsize = format(fcontents.tell(), 'x').lower()
|
|
6303
6309
|
file_content[member.filename].close()
|
|
6304
|
-
if(not compresswholefile):
|
|
6310
|
+
if(typechecktest is False and not compresswholefile):
|
|
6305
6311
|
fcontents.seek(0, 2)
|
|
6306
6312
|
ucfsize = fcontents.tell()
|
|
6307
6313
|
fcontents.seek(0, 0)
|
|
@@ -6322,10 +6328,7 @@ if(py7zr_support):
|
|
|
6322
6328
|
ilcsize.append(cfcontents.tell())
|
|
6323
6329
|
cfcontents.close()
|
|
6324
6330
|
else:
|
|
6325
|
-
|
|
6326
|
-
ilcsize.append(sys.maxint)
|
|
6327
|
-
except AttributeError:
|
|
6328
|
-
ilcsize.append(sys.maxsize)
|
|
6331
|
+
ilcsize.append(float("inf"))
|
|
6329
6332
|
ilmin = ilmin + 1
|
|
6330
6333
|
ilcmin = ilcsize.index(min(ilcsize))
|
|
6331
6334
|
curcompression = compressionuselist[ilcmin]
|
|
@@ -8166,10 +8169,13 @@ def RePackArchiveFile(infile, outfile, fmttype="auto", compression="auto", compr
|
|
|
8166
8169
|
fcontents = listarchivefiles['ffilelist'][reallcfi]['fcontents']
|
|
8167
8170
|
if(not listarchivefiles['ffilelist'][reallcfi]['fcontentasfile']):
|
|
8168
8171
|
fcontents = BytesIO(fcontents)
|
|
8172
|
+
typechecktest = CheckCompressionType(fcontents, closefp=False)
|
|
8173
|
+
fcontents.seek(0, 0)
|
|
8169
8174
|
fcencoding = GetFileEncoding(fcontents, False)
|
|
8170
8175
|
fcompression = ""
|
|
8171
8176
|
fcsize = format(int(0), 'x').lower()
|
|
8172
|
-
|
|
8177
|
+
curcompression = "none"
|
|
8178
|
+
if typechecktest is False and not compresswholefile:
|
|
8173
8179
|
fcontents.seek(0, 2)
|
|
8174
8180
|
ucfsize = fcontents.tell()
|
|
8175
8181
|
fcontents.seek(0, 0)
|
|
@@ -8190,10 +8196,7 @@ def RePackArchiveFile(infile, outfile, fmttype="auto", compression="auto", compr
|
|
|
8190
8196
|
ilcsize.append(cfcontents.tell())
|
|
8191
8197
|
cfcontents.close()
|
|
8192
8198
|
else:
|
|
8193
|
-
|
|
8194
|
-
ilcsize.append(sys.maxint)
|
|
8195
|
-
except AttributeError:
|
|
8196
|
-
ilcsize.append(sys.maxsize)
|
|
8199
|
+
ilcsize.append(float("inf"))
|
|
8197
8200
|
ilmin = ilmin + 1
|
|
8198
8201
|
ilcmin = ilcsize.index(min(ilcsize))
|
|
8199
8202
|
curcompression = compressionuselist[ilcmin]
|
|
@@ -8210,7 +8213,7 @@ def RePackArchiveFile(infile, outfile, fmttype="auto", compression="auto", compr
|
|
|
8210
8213
|
fcompression = curcompression
|
|
8211
8214
|
fcontents.close()
|
|
8212
8215
|
fcontents = cfcontents
|
|
8213
|
-
if
|
|
8216
|
+
if followlink:
|
|
8214
8217
|
if(listarchivefiles['ffilelist'][reallcfi]['ftype'] == 1 or listarchivefiles['ffilelist'][reallcfi]['ftype'] == 2):
|
|
8215
8218
|
getflinkpath = listarchivefiles['ffilelist'][reallcfi]['flinkname']
|
|
8216
8219
|
flinkid = prelistarchivefiles['filetoid'][getflinkpath]
|
|
@@ -9207,37 +9210,37 @@ def ListDirListFiles(infiles, dirlistfromtxt=False, compression="auto", compress
|
|
|
9207
9210
|
PyNeoFile compatibility layer
|
|
9208
9211
|
"""
|
|
9209
9212
|
|
|
9210
|
-
def make_empty_file_pointer_neo(fp, fmttype=None, checksumtype='crc32', formatspecs=
|
|
9213
|
+
def make_empty_file_pointer_neo(fp, fmttype=None, checksumtype='crc32', formatspecs=__file_format_multi_dict__, encoding='UTF-8'):
|
|
9211
9214
|
return MakeEmptyFilePointer(fp, fmttype, checksumtype, formatspecs)
|
|
9212
9215
|
|
|
9213
|
-
def make_empty_archive_file_pointer_neo(fp, fmttype=None, checksumtype='crc32', formatspecs=
|
|
9216
|
+
def make_empty_archive_file_pointer_neo(fp, fmttype=None, checksumtype='crc32', formatspecs=__file_format_multi_dict__, encoding='UTF-8'):
|
|
9214
9217
|
return make_empty_file_pointer_neo(fp, fmttype, checksumtype, formatspecs, encoding)
|
|
9215
9218
|
|
|
9216
|
-
def make_empty_file_neo(outfile=None, fmttype=None, checksumtype='crc32', formatspecs=
|
|
9219
|
+
def make_empty_file_neo(outfile=None, fmttype=None, checksumtype='crc32', formatspecs=__file_format_multi_dict__, encoding='UTF-8', returnfp=False):
|
|
9217
9220
|
return MakeEmptyFile(outfile, fmttype, "auto", False, None, checksumtype, formatspecs, returnfp)
|
|
9218
9221
|
|
|
9219
|
-
def make_empty_archive_file_neo(outfile=None, fmttype=None, checksumtype='crc32', formatspecs=
|
|
9222
|
+
def make_empty_archive_file_neo(outfile=None, fmttype=None, checksumtype='crc32', formatspecs=__file_format_multi_dict__, encoding='UTF-8', returnfp=False):
|
|
9220
9223
|
return make_empty_file_neo(outfile, fmttype, checksumtype, formatspecs, encoding, returnfp)
|
|
9221
9224
|
|
|
9222
|
-
def pack_neo(infiles, outfile=None, formatspecs=
|
|
9225
|
+
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):
|
|
9223
9226
|
return PackArchiveFile(infiles, outfile, False, "auto", compression, False, compression_level, compressionlistalt, False, checksumtypes, [], {}, formatspecs, False, returnfp)
|
|
9224
9227
|
|
|
9225
|
-
def archive_to_array_neo(infile, formatspecs=
|
|
9228
|
+
def archive_to_array_neo(infile, formatspecs=__file_format_multi_dict__, listonly=False, skipchecksum=False, uncompress=True, returnfp=False):
|
|
9226
9229
|
return ArchiveFileToArray(infile, "auto", 0, 0, listonly, True, uncompress, skipchecksum, formatspecs, False, returnfp)
|
|
9227
9230
|
|
|
9228
|
-
def unpack_neo(infile, outdir='.', formatspecs=
|
|
9231
|
+
def unpack_neo(infile, outdir='.', formatspecs=__file_format_multi_dict__, skipchecksum=False, uncompress=True, returnfp=False):
|
|
9229
9232
|
return UnPackArchiveFile(infile, outdir, False, 0, 0, skipchecksum, formatspecs, True, True, False, False, returnfp)
|
|
9230
9233
|
|
|
9231
|
-
def repack_neo(infile, outfile=None, formatspecs=
|
|
9234
|
+
def repack_neo(infile, outfile=None, formatspecs=__file_format_dict__, checksumtypes=["crc32", "crc32", "crc32", "crc32"], compression="auto", compression_level=None, returnfp=False):
|
|
9232
9235
|
return RePackArchiveFile(infile, outfile, "auto", compression, False, compression_level, compressionlistalt, False, 0, 0, checksumtypes, False, [], {}, formatspecs, False, False, returnfp)
|
|
9233
9236
|
|
|
9234
|
-
def archivefilevalidate_neo(infile, formatspecs=
|
|
9237
|
+
def archivefilevalidate_neo(infile, formatspecs=__file_format_multi_dict__, verbose=False, return_details=False, returnfp=False):
|
|
9235
9238
|
return ArchiveFileValidate(infile, "auto", formatspecs, False, verbose, returnfp)
|
|
9236
9239
|
|
|
9237
|
-
def archivefilelistfiles_neo(infile, formatspecs=
|
|
9240
|
+
def archivefilelistfiles_neo(infile, formatspecs=__file_format_multi_dict__, advanced=False, include_dirs=True, returnfp=False):
|
|
9238
9241
|
return ArchiveFileListFiles(infile, "auto", 0, 0, False, formatspecs, False, True, advanced, returnfp)
|
|
9239
9242
|
|
|
9240
|
-
def convert_foreign_to_neo(infile, outfile=None, formatspecs=
|
|
9243
|
+
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):
|
|
9241
9244
|
intmp = InFileToArray(infile, 0, 0, False, True, False, formatspecs, False, False)
|
|
9242
9245
|
return RePackArchiveFile(intmp, outfile, "auto", compression, False, compression_level, compressionlistalt, False, 0, 0, checksumtypes, False, [], {}, formatspecs, False, False, returnfp)
|
|
9243
9246
|
|
|
@@ -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'] = ['pyarchivefile']
|
|
82
|
-
pymodule['scripts'] = ['archivefile.py', 'neoarchivefile.py']
|
|
82
|
+
pymodule['scripts'] = ['archivefile.py', 'neoarchivefile.py', 'archiveneofile.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
|