PyCatFile 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.
- pycatfile-0.21.0.data/scripts/catneofile.py +130 -0
- {pycatfile-0.20.8.dist-info → pycatfile-0.21.0.dist-info}/METADATA +1 -1
- pycatfile-0.21.0.dist-info/RECORD +10 -0
- pycatfile.py +70 -67
- pycatfile-0.20.8.dist-info/RECORD +0 -9
- {pycatfile-0.20.8.data → pycatfile-0.21.0.data}/scripts/catfile.py +0 -0
- {pycatfile-0.20.8.data → pycatfile-0.21.0.data}/scripts/neocatfile.py +0 -0
- {pycatfile-0.20.8.dist-info → pycatfile-0.21.0.dist-info}/WHEEL +0 -0
- {pycatfile-0.20.8.dist-info → pycatfile-0.21.0.dist-info}/licenses/LICENSE +0 -0
- {pycatfile-0.20.8.dist-info → pycatfile-0.21.0.dist-info}/top_level.txt +0 -0
- {pycatfile-0.20.8.dist-info → pycatfile-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 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())
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: PyCatFile
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.21.0
|
|
4
4
|
Summary: A tar like file format name catfile after unix cat command (concatenate files) .
|
|
5
5
|
Home-page: https://github.com/GameMaker2k/PyCatFile
|
|
6
6
|
Download-URL: https://github.com/GameMaker2k/PyCatFile/archive/master.tar.gz
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
pycatfile.py,sha256=elBSNllKuYMpbyFbaAJPgAQPuMc-XQkQ_ryXJB48bNU,439739
|
|
2
|
+
pycatfile-0.21.0.data/scripts/catfile.py,sha256=eJYvkqx5F5V1CKnxQyLQUMvIBOUZYWF4MAlpvqsjBPc,14020
|
|
3
|
+
pycatfile-0.21.0.data/scripts/catneofile.py,sha256=b0sJBb-o6Rx5TO_dqXnJz3fCf-yPbEul1_6uX2CRS0Q,5128
|
|
4
|
+
pycatfile-0.21.0.data/scripts/neocatfile.py,sha256=YIehBXLtZdFN6_3vrCM3qw1vfAiqJZJWdjOGFStg3D4,7148
|
|
5
|
+
pycatfile-0.21.0.dist-info/licenses/LICENSE,sha256=WM1VWxTUVrQbvEa-LC7cKTaBHXiqSTyYPoJvsZSbd7E,1513
|
|
6
|
+
pycatfile-0.21.0.dist-info/METADATA,sha256=g4mW7KSwek34P3ONlOosBN9vS0Zk515Pdf3F5euv83c,802
|
|
7
|
+
pycatfile-0.21.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
8
|
+
pycatfile-0.21.0.dist-info/top_level.txt,sha256=ZnSwEHU_60RLIvmFhsATaAaEYjErDQgUymWwoXZ724c,10
|
|
9
|
+
pycatfile-0.21.0.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
10
|
+
pycatfile-0.21.0.dist-info/RECORD,,
|
pycatfile.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: pycatfile.py - Last Update: 9/
|
|
17
|
+
$FileInfo: pycatfile.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
|
|
@@ -391,12 +391,12 @@ __file_format_extension__ = __file_format_multi_dict__[__file_format_default__][
|
|
|
391
391
|
__file_format_dict__ = __file_format_multi_dict__[__file_format_default__]
|
|
392
392
|
__project__ = __program_name__
|
|
393
393
|
__project_url__ = "https://github.com/GameMaker2k/PyCatFile"
|
|
394
|
-
__version_info__ = (0,
|
|
395
|
-
__version_date_info__ = (2025, 9,
|
|
394
|
+
__version_info__ = (0, 21, 0, "RC 1", 1)
|
|
395
|
+
__version_date_info__ = (2025, 9, 17, "RC 1", 1)
|
|
396
396
|
__version_date__ = str(__version_date_info__[0]) + "." + str(
|
|
397
397
|
__version_date_info__[1]).zfill(2) + "." + str(__version_date_info__[2]).zfill(2)
|
|
398
398
|
__revision__ = __version_info__[3]
|
|
399
|
-
__revision_id__ = "$Id:
|
|
399
|
+
__revision_id__ = "$Id: b2575bb19f97aab82c71ff7641b170a308e0be5e $"
|
|
400
400
|
if(__version_info__[4] is not None):
|
|
401
401
|
__version_date_plusrc__ = __version_date__ + \
|
|
402
402
|
"-" + str(__version_date_info__[4])
|
|
@@ -3636,11 +3636,14 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, filevalues=[], ext
|
|
|
3636
3636
|
fcontents = BytesIO()
|
|
3637
3637
|
chunk_size = 1024
|
|
3638
3638
|
fcencoding = "UTF-8"
|
|
3639
|
-
|
|
3639
|
+
curcompression = "none"
|
|
3640
|
+
if not followlink and ftype in data_types:
|
|
3640
3641
|
with open(fname, "rb") as fpc:
|
|
3641
3642
|
shutil.copyfileobj(fpc, fcontents)
|
|
3643
|
+
typechecktest = CheckCompressionType(fcontents, closefp=False)
|
|
3644
|
+
fcontents.seek(0, 0)
|
|
3642
3645
|
fcencoding = GetFileEncoding(fcontents, False)
|
|
3643
|
-
if(not compresswholefile):
|
|
3646
|
+
if(typechecktest is False and not compresswholefile):
|
|
3644
3647
|
fcontents.seek(0, 2)
|
|
3645
3648
|
ucfsize = fcontents.tell()
|
|
3646
3649
|
fcontents.seek(0, 0)
|
|
@@ -3661,10 +3664,7 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, filevalues=[], ext
|
|
|
3661
3664
|
ilcsize.append(cfcontents.tell())
|
|
3662
3665
|
cfcontents.close()
|
|
3663
3666
|
else:
|
|
3664
|
-
|
|
3665
|
-
ilcsize.append(sys.maxint)
|
|
3666
|
-
except AttributeError:
|
|
3667
|
-
ilcsize.append(sys.maxsize)
|
|
3667
|
+
ilcsize.append(float("inf"))
|
|
3668
3668
|
ilmin = ilmin + 1
|
|
3669
3669
|
ilcmin = ilcsize.index(min(ilcsize))
|
|
3670
3670
|
curcompression = compressionuselist[ilcmin]
|
|
@@ -3681,13 +3681,16 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, filevalues=[], ext
|
|
|
3681
3681
|
fcompression = curcompression
|
|
3682
3682
|
fcontents.close()
|
|
3683
3683
|
fcontents = cfcontents
|
|
3684
|
-
|
|
3684
|
+
elif followlink and (ftype == 1 or ftype == 2):
|
|
3685
3685
|
if(not os.path.exists(flinkname)):
|
|
3686
3686
|
return False
|
|
3687
3687
|
flstatinfo = os.stat(flinkname)
|
|
3688
3688
|
with open(flinkname, "rb") as fpc:
|
|
3689
3689
|
shutil.copyfileobj(fpc, fcontents)
|
|
3690
|
-
|
|
3690
|
+
typechecktest = CheckCompressionType(fcontents, closefp=False)
|
|
3691
|
+
fcontents.seek(0, 0)
|
|
3692
|
+
fcencoding = GetFileEncoding(fcontents, False)
|
|
3693
|
+
if(typechecktest is False and not compresswholefile):
|
|
3691
3694
|
fcontents.seek(0, 2)
|
|
3692
3695
|
ucfsize = fcontents.tell()
|
|
3693
3696
|
fcontents.seek(0, 0)
|
|
@@ -3708,10 +3711,7 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, filevalues=[], ext
|
|
|
3708
3711
|
ilcsize.append(cfcontents.tell())
|
|
3709
3712
|
cfcontents.close()
|
|
3710
3713
|
else:
|
|
3711
|
-
|
|
3712
|
-
ilcsize.append(sys.maxint)
|
|
3713
|
-
except AttributeError:
|
|
3714
|
-
ilcsize.append(sys.maxsize)
|
|
3714
|
+
ilcsize.append(float("inf"))
|
|
3715
3715
|
ilmin = ilmin + 1
|
|
3716
3716
|
ilcmin = ilcsize.index(min(ilcsize))
|
|
3717
3717
|
curcompression = compressionuselist[ilcmin]
|
|
@@ -5098,11 +5098,14 @@ def PackCatFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", compress
|
|
|
5098
5098
|
fcsize = format(int(0), 'x').lower()
|
|
5099
5099
|
fcontents = BytesIO()
|
|
5100
5100
|
fcencoding = "UTF-8"
|
|
5101
|
-
|
|
5101
|
+
curcompression = "none"
|
|
5102
|
+
if not followlink and ftype in data_types:
|
|
5102
5103
|
with open(fname, "rb") as fpc:
|
|
5103
5104
|
shutil.copyfileobj(fpc, fcontents)
|
|
5105
|
+
typechecktest = CheckCompressionType(fcontents, closefp=False)
|
|
5106
|
+
fcontents.seek(0, 0)
|
|
5104
5107
|
fcencoding = GetFileEncoding(fcontents, False)
|
|
5105
|
-
if(not compresswholefile):
|
|
5108
|
+
if(typechecktest is False and not compresswholefile):
|
|
5106
5109
|
fcontents.seek(0, 2)
|
|
5107
5110
|
ucfsize = fcontents.tell()
|
|
5108
5111
|
fcontents.seek(0, 0)
|
|
@@ -5123,10 +5126,7 @@ def PackCatFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", compress
|
|
|
5123
5126
|
ilcsize.append(cfcontents.tell())
|
|
5124
5127
|
cfcontents.close()
|
|
5125
5128
|
else:
|
|
5126
|
-
|
|
5127
|
-
ilcsize.append(sys.maxint)
|
|
5128
|
-
except AttributeError:
|
|
5129
|
-
ilcsize.append(sys.maxsize)
|
|
5129
|
+
ilcsize.append(float("inf"))
|
|
5130
5130
|
ilmin = ilmin + 1
|
|
5131
5131
|
ilcmin = ilcsize.index(min(ilcsize))
|
|
5132
5132
|
curcompression = compressionuselist[ilcmin]
|
|
@@ -5143,15 +5143,16 @@ def PackCatFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", compress
|
|
|
5143
5143
|
fcompression = curcompression
|
|
5144
5144
|
fcontents.close()
|
|
5145
5145
|
fcontents = cfcontents
|
|
5146
|
-
|
|
5147
|
-
fcompression = ""
|
|
5148
|
-
if(followlink and (ftype == 1 or ftype == 2)):
|
|
5146
|
+
elif followlink and (ftype == 1 or ftype == 2):
|
|
5149
5147
|
if(not os.path.exists(flinkname)):
|
|
5150
5148
|
return False
|
|
5151
5149
|
flstatinfo = os.stat(flinkname)
|
|
5152
5150
|
with open(flinkname, "rb") as fpc:
|
|
5153
5151
|
shutil.copyfileobj(fpc, fcontents)
|
|
5154
|
-
|
|
5152
|
+
typechecktest = CheckCompressionType(fcontents, closefp=False)
|
|
5153
|
+
fcontents.seek(0, 0)
|
|
5154
|
+
fcencoding = GetFileEncoding(fcontents, False)
|
|
5155
|
+
if(typechecktest is False and not compresswholefile):
|
|
5155
5156
|
fcontents.seek(0, 2)
|
|
5156
5157
|
ucfsize = fcontents.tell()
|
|
5157
5158
|
fcontents.seek(0, 0)
|
|
@@ -5172,10 +5173,7 @@ def PackCatFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", compress
|
|
|
5172
5173
|
ilcsize.append(cfcontents.tell())
|
|
5173
5174
|
cfcontents.close()
|
|
5174
5175
|
else:
|
|
5175
|
-
|
|
5176
|
-
ilcsize.append(sys.maxint)
|
|
5177
|
-
except AttributeError:
|
|
5178
|
-
ilcsize.append(sys.maxsize)
|
|
5176
|
+
ilcsize.append(float("inf"))
|
|
5179
5177
|
ilmin = ilmin + 1
|
|
5180
5178
|
ilcmin = ilcsize.index(min(ilcsize))
|
|
5181
5179
|
curcompression = compressionuselist[ilcmin]
|
|
@@ -5192,6 +5190,8 @@ def PackCatFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", compress
|
|
|
5192
5190
|
fcompression = curcompression
|
|
5193
5191
|
fcontents.close()
|
|
5194
5192
|
fcontents = cfcontents
|
|
5193
|
+
if(fcompression == "none"):
|
|
5194
|
+
fcompression = ""
|
|
5195
5195
|
fcontents.seek(0, 0)
|
|
5196
5196
|
ftypehex = format(ftype, 'x').lower()
|
|
5197
5197
|
tmpoutlist = [ftypehex, fencoding, fcencoding, fname, flinkname, fsize, fatime, fmtime, fctime, fbtime, fmode, fwinattributes, fcompression,
|
|
@@ -5445,11 +5445,14 @@ def PackCatFileFromTarFile(infile, outfile, fmttype="auto", compression="auto",
|
|
|
5445
5445
|
fcsize = format(int(0), 'x').lower()
|
|
5446
5446
|
fcontents = BytesIO()
|
|
5447
5447
|
fcencoding = "UTF-8"
|
|
5448
|
+
curcompression = "none"
|
|
5448
5449
|
if ftype in data_types:
|
|
5449
5450
|
fpc = tarfp.extractfile(member)
|
|
5450
5451
|
shutil.copyfileobj(fpc, fcontents)
|
|
5452
|
+
typechecktest = CheckCompressionType(fcontents, closefp=False)
|
|
5453
|
+
fcontents.seek(0, 0)
|
|
5451
5454
|
fcencoding = GetFileEncoding(fcontents, False)
|
|
5452
|
-
if(not compresswholefile):
|
|
5455
|
+
if(typechecktest is False and not compresswholefile):
|
|
5453
5456
|
fcontents.seek(0, 2)
|
|
5454
5457
|
ucfsize = fcontents.tell()
|
|
5455
5458
|
fcontents.seek(0, 0)
|
|
@@ -5470,10 +5473,7 @@ def PackCatFileFromTarFile(infile, outfile, fmttype="auto", compression="auto",
|
|
|
5470
5473
|
ilcsize.append(cfcontents.tell())
|
|
5471
5474
|
cfcontents.close()
|
|
5472
5475
|
else:
|
|
5473
|
-
|
|
5474
|
-
ilcsize.append(sys.maxint)
|
|
5475
|
-
except AttributeError:
|
|
5476
|
-
ilcsize.append(sys.maxsize)
|
|
5476
|
+
ilcsize.append(float("inf"))
|
|
5477
5477
|
ilmin = ilmin + 1
|
|
5478
5478
|
ilcmin = ilcsize.index(min(ilcsize))
|
|
5479
5479
|
curcompression = compressionuselist[ilcmin]
|
|
@@ -5743,10 +5743,13 @@ def PackCatFileFromZipFile(infile, outfile, fmttype="auto", compression="auto",
|
|
|
5743
5743
|
fgname = ""
|
|
5744
5744
|
fcontents = BytesIO()
|
|
5745
5745
|
fcencoding = "UTF-8"
|
|
5746
|
-
|
|
5746
|
+
curcompression = "none"
|
|
5747
|
+
if ftype == 0:
|
|
5747
5748
|
fcontents.write(zipfp.read(member.filename))
|
|
5749
|
+
typechecktest = CheckCompressionType(fcontents, closefp=False)
|
|
5750
|
+
fcontents.seek(0, 0)
|
|
5748
5751
|
fcencoding = GetFileEncoding(fcontents, False)
|
|
5749
|
-
if(not compresswholefile):
|
|
5752
|
+
if(typechecktest is False and not compresswholefile):
|
|
5750
5753
|
fcontents.seek(0, 2)
|
|
5751
5754
|
ucfsize = fcontents.tell()
|
|
5752
5755
|
fcontents.seek(0, 0)
|
|
@@ -6057,10 +6060,13 @@ if(rarfile_support):
|
|
|
6057
6060
|
fgname = ""
|
|
6058
6061
|
fcontents = BytesIO()
|
|
6059
6062
|
fcencoding = "UTF-8"
|
|
6060
|
-
|
|
6063
|
+
curcompression = "none"
|
|
6064
|
+
if ftype == 0:
|
|
6061
6065
|
fcontents.write(rarfp.read(member.filename))
|
|
6066
|
+
typechecktest = CheckCompressionType(fcontents, closefp=False)
|
|
6067
|
+
fcontents.seek(0, 0)
|
|
6062
6068
|
fcencoding = GetFileEncoding(fcontents, False)
|
|
6063
|
-
if(not compresswholefile):
|
|
6069
|
+
if(typechecktest is False and not compresswholefile):
|
|
6064
6070
|
fcontents.seek(0, 2)
|
|
6065
6071
|
ucfsize = fcontents.tell()
|
|
6066
6072
|
fcontents.seek(0, 0)
|
|
@@ -6081,10 +6087,7 @@ if(rarfile_support):
|
|
|
6081
6087
|
ilcsize.append(cfcontents.tell())
|
|
6082
6088
|
cfcontents.close()
|
|
6083
6089
|
else:
|
|
6084
|
-
|
|
6085
|
-
ilcsize.append(sys.maxint)
|
|
6086
|
-
except AttributeError:
|
|
6087
|
-
ilcsize.append(sys.maxsize)
|
|
6090
|
+
ilcsize.append(float("inf"))
|
|
6088
6091
|
ilmin = ilmin + 1
|
|
6089
6092
|
ilcmin = ilcsize.index(min(ilcsize))
|
|
6090
6093
|
curcompression = compressionuselist[ilcmin]
|
|
@@ -6308,12 +6311,15 @@ if(py7zr_support):
|
|
|
6308
6311
|
fgname = ""
|
|
6309
6312
|
fcontents = BytesIO()
|
|
6310
6313
|
fcencoding = "UTF-8"
|
|
6311
|
-
|
|
6314
|
+
curcompression = "none"
|
|
6315
|
+
if ftype == 0:
|
|
6312
6316
|
fcontents.write(file_content[member.filename].read())
|
|
6317
|
+
typechecktest = CheckCompressionType(fcontents, closefp=False)
|
|
6318
|
+
fcontents.seek(0, 0)
|
|
6313
6319
|
fcencoding = GetFileEncoding(fcontents, False)
|
|
6314
6320
|
fsize = format(fcontents.tell(), 'x').lower()
|
|
6315
6321
|
file_content[member.filename].close()
|
|
6316
|
-
if(not compresswholefile):
|
|
6322
|
+
if(typechecktest is False and not compresswholefile):
|
|
6317
6323
|
fcontents.seek(0, 2)
|
|
6318
6324
|
ucfsize = fcontents.tell()
|
|
6319
6325
|
fcontents.seek(0, 0)
|
|
@@ -6334,10 +6340,7 @@ if(py7zr_support):
|
|
|
6334
6340
|
ilcsize.append(cfcontents.tell())
|
|
6335
6341
|
cfcontents.close()
|
|
6336
6342
|
else:
|
|
6337
|
-
|
|
6338
|
-
ilcsize.append(sys.maxint)
|
|
6339
|
-
except AttributeError:
|
|
6340
|
-
ilcsize.append(sys.maxsize)
|
|
6343
|
+
ilcsize.append(float("inf"))
|
|
6341
6344
|
ilmin = ilmin + 1
|
|
6342
6345
|
ilcmin = ilcsize.index(min(ilcsize))
|
|
6343
6346
|
curcompression = compressionuselist[ilcmin]
|
|
@@ -8178,10 +8181,13 @@ def RePackCatFile(infile, outfile, fmttype="auto", compression="auto", compressw
|
|
|
8178
8181
|
fcontents = listarchivefiles['ffilelist'][reallcfi]['fcontents']
|
|
8179
8182
|
if(not listarchivefiles['ffilelist'][reallcfi]['fcontentasfile']):
|
|
8180
8183
|
fcontents = BytesIO(fcontents)
|
|
8184
|
+
typechecktest = CheckCompressionType(fcontents, closefp=False)
|
|
8185
|
+
fcontents.seek(0, 0)
|
|
8181
8186
|
fcencoding = GetFileEncoding(fcontents, False)
|
|
8182
8187
|
fcompression = ""
|
|
8183
8188
|
fcsize = format(int(0), 'x').lower()
|
|
8184
|
-
|
|
8189
|
+
curcompression = "none"
|
|
8190
|
+
if typechecktest is False and not compresswholefile:
|
|
8185
8191
|
fcontents.seek(0, 2)
|
|
8186
8192
|
ucfsize = fcontents.tell()
|
|
8187
8193
|
fcontents.seek(0, 0)
|
|
@@ -8202,10 +8208,7 @@ def RePackCatFile(infile, outfile, fmttype="auto", compression="auto", compressw
|
|
|
8202
8208
|
ilcsize.append(cfcontents.tell())
|
|
8203
8209
|
cfcontents.close()
|
|
8204
8210
|
else:
|
|
8205
|
-
|
|
8206
|
-
ilcsize.append(sys.maxint)
|
|
8207
|
-
except AttributeError:
|
|
8208
|
-
ilcsize.append(sys.maxsize)
|
|
8211
|
+
ilcsize.append(float("inf"))
|
|
8209
8212
|
ilmin = ilmin + 1
|
|
8210
8213
|
ilcmin = ilcsize.index(min(ilcsize))
|
|
8211
8214
|
curcompression = compressionuselist[ilcmin]
|
|
@@ -8222,7 +8225,7 @@ def RePackCatFile(infile, outfile, fmttype="auto", compression="auto", compressw
|
|
|
8222
8225
|
fcompression = curcompression
|
|
8223
8226
|
fcontents.close()
|
|
8224
8227
|
fcontents = cfcontents
|
|
8225
|
-
if
|
|
8228
|
+
if followlink:
|
|
8226
8229
|
if(listarchivefiles['ffilelist'][reallcfi]['ftype'] == 1 or listarchivefiles['ffilelist'][reallcfi]['ftype'] == 2):
|
|
8227
8230
|
getflinkpath = listarchivefiles['ffilelist'][reallcfi]['flinkname']
|
|
8228
8231
|
flinkid = prelistarchivefiles['filetoid'][getflinkpath]
|
|
@@ -8631,7 +8634,7 @@ def CatFileListFiles(infile, fmttype="auto", seekstart=0, seekend=0, skipchecksu
|
|
|
8631
8634
|
else:
|
|
8632
8635
|
if(infile != "-" and not hasattr(infile, "read") and not hasattr(infile, "write") and not (sys.version_info[0] >= 3 and isinstance(infile, bytes))):
|
|
8633
8636
|
infile = RemoveWindowsPath(infile)
|
|
8634
|
-
listarchivefiles =
|
|
8637
|
+
listarchivefiles = CatFileToArray(infile, fmttype, seekstart, seekend, True, False, False, skipchecksum, formatspecs, seektoend, returnfp)
|
|
8635
8638
|
if(not listarchivefiles):
|
|
8636
8639
|
return False
|
|
8637
8640
|
lenlist = len(listarchivefiles['ffilelist'])
|
|
@@ -9219,37 +9222,37 @@ def ListDirListFiles(infiles, dirlistfromtxt=False, compression="auto", compress
|
|
|
9219
9222
|
PyNeoFile compatibility layer
|
|
9220
9223
|
"""
|
|
9221
9224
|
|
|
9222
|
-
def make_empty_file_pointer_neo(fp, fmttype=None, checksumtype='crc32', formatspecs=
|
|
9225
|
+
def make_empty_file_pointer_neo(fp, fmttype=None, checksumtype='crc32', formatspecs=__file_format_multi_dict__, encoding='UTF-8'):
|
|
9223
9226
|
return MakeEmptyFilePointer(fp, fmttype, checksumtype, formatspecs)
|
|
9224
9227
|
|
|
9225
|
-
def make_empty_archive_file_pointer_neo(fp, fmttype=None, checksumtype='crc32', formatspecs=
|
|
9228
|
+
def make_empty_archive_file_pointer_neo(fp, fmttype=None, checksumtype='crc32', formatspecs=__file_format_multi_dict__, encoding='UTF-8'):
|
|
9226
9229
|
return make_empty_file_pointer_neo(fp, fmttype, checksumtype, formatspecs, encoding)
|
|
9227
9230
|
|
|
9228
|
-
def make_empty_file_neo(outfile=None, fmttype=None, checksumtype='crc32', formatspecs=
|
|
9231
|
+
def make_empty_file_neo(outfile=None, fmttype=None, checksumtype='crc32', formatspecs=__file_format_multi_dict__, encoding='UTF-8', returnfp=False):
|
|
9229
9232
|
return MakeEmptyFile(outfile, fmttype, "auto", False, None, checksumtype, formatspecs, returnfp)
|
|
9230
9233
|
|
|
9231
|
-
def make_empty_archive_file_neo(outfile=None, fmttype=None, checksumtype='crc32', formatspecs=
|
|
9234
|
+
def make_empty_archive_file_neo(outfile=None, fmttype=None, checksumtype='crc32', formatspecs=__file_format_multi_dict__, encoding='UTF-8', returnfp=False):
|
|
9232
9235
|
return make_empty_file_neo(outfile, fmttype, checksumtype, formatspecs, encoding, returnfp)
|
|
9233
9236
|
|
|
9234
|
-
def pack_neo(infiles, outfile=None, formatspecs=
|
|
9237
|
+
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):
|
|
9235
9238
|
return PackCatFile(infiles, outfile, False, "auto", compression, False, compression_level, compressionlistalt, False, checksumtypes, [], {}, formatspecs, False, returnfp)
|
|
9236
9239
|
|
|
9237
|
-
def archive_to_array_neo(infile, formatspecs=
|
|
9240
|
+
def archive_to_array_neo(infile, formatspecs=__file_format_multi_dict__, listonly=False, skipchecksum=False, uncompress=True, returnfp=False):
|
|
9238
9241
|
return CatFileToArray(infile, "auto", 0, 0, listonly, True, uncompress, skipchecksum, formatspecs, False, returnfp)
|
|
9239
9242
|
|
|
9240
|
-
def unpack_neo(infile, outdir='.', formatspecs=
|
|
9243
|
+
def unpack_neo(infile, outdir='.', formatspecs=__file_format_multi_dict__, skipchecksum=False, uncompress=True, returnfp=False):
|
|
9241
9244
|
return UnPackCatFile(infile, outdir, False, 0, 0, skipchecksum, formatspecs, True, True, False, False, returnfp)
|
|
9242
9245
|
|
|
9243
|
-
def repack_neo(infile, outfile=None, formatspecs=
|
|
9246
|
+
def repack_neo(infile, outfile=None, formatspecs=__file_format_dict__, checksumtypes=["crc32", "crc32", "crc32", "crc32"], compression="auto", compression_level=None, returnfp=False):
|
|
9244
9247
|
return RePackCatFile(infile, outfile, "auto", compression, False, compression_level, compressionlistalt, False, 0, 0, checksumtypes, False, [], {}, formatspecs, False, False, returnfp)
|
|
9245
9248
|
|
|
9246
|
-
def archivefilevalidate_neo(infile, formatspecs=
|
|
9249
|
+
def archivefilevalidate_neo(infile, formatspecs=__file_format_multi_dict__, verbose=False, return_details=False, returnfp=False):
|
|
9247
9250
|
return CatFileValidate(infile, "auto", formatspecs, False, verbose, returnfp)
|
|
9248
9251
|
|
|
9249
|
-
def archivefilelistfiles_neo(infile, formatspecs=
|
|
9252
|
+
def archivefilelistfiles_neo(infile, formatspecs=__file_format_multi_dict__, advanced=False, include_dirs=True, returnfp=False):
|
|
9250
9253
|
return CatFileListFiles(infile, "auto", 0, 0, False, formatspecs, False, True, advanced, returnfp)
|
|
9251
9254
|
|
|
9252
|
-
def convert_foreign_to_neo(infile, outfile=None, formatspecs=
|
|
9255
|
+
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):
|
|
9253
9256
|
intmp = InFileToArray(infile, 0, 0, False, True, False, formatspecs, False, False)
|
|
9254
9257
|
return RePackCatFile(intmp, outfile, "auto", compression, False, compression_level, compressionlistalt, False, 0, 0, checksumtypes, False, [], {}, formatspecs, False, False, returnfp)
|
|
9255
9258
|
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
pycatfile.py,sha256=wN6D39Pz0O3TaOrjsiXYFzDosPDtQKcmNFgyrL7Iuus,439087
|
|
2
|
-
pycatfile-0.20.8.data/scripts/catfile.py,sha256=eJYvkqx5F5V1CKnxQyLQUMvIBOUZYWF4MAlpvqsjBPc,14020
|
|
3
|
-
pycatfile-0.20.8.data/scripts/neocatfile.py,sha256=YIehBXLtZdFN6_3vrCM3qw1vfAiqJZJWdjOGFStg3D4,7148
|
|
4
|
-
pycatfile-0.20.8.dist-info/licenses/LICENSE,sha256=WM1VWxTUVrQbvEa-LC7cKTaBHXiqSTyYPoJvsZSbd7E,1513
|
|
5
|
-
pycatfile-0.20.8.dist-info/METADATA,sha256=FkmLEj0I0lJ-kNH1BgsDlSFnOI8nT8sGvJAnUMLT6O8,802
|
|
6
|
-
pycatfile-0.20.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
7
|
-
pycatfile-0.20.8.dist-info/top_level.txt,sha256=ZnSwEHU_60RLIvmFhsATaAaEYjErDQgUymWwoXZ724c,10
|
|
8
|
-
pycatfile-0.20.8.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
9
|
-
pycatfile-0.20.8.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|