PyCatFile 0.8.6__tar.gz → 0.9.2__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.
- {pycatfile-0.8.6 → pycatfile-0.9.2}/PKG-INFO +1 -1
- {pycatfile-0.8.6 → pycatfile-0.9.2}/PyCatFile.egg-info/PKG-INFO +1 -1
- pycatfile-0.9.2/catfile.py +190 -0
- {pycatfile-0.8.6 → pycatfile-0.9.2}/neocatfile.py +1 -1
- {pycatfile-0.8.6 → pycatfile-0.9.2}/pycatfile.py +68 -69
- {pycatfile-0.8.6 → pycatfile-0.9.2}/setup.py +1 -1
- pycatfile-0.8.6/catfile.py +0 -215
- {pycatfile-0.8.6 → pycatfile-0.9.2}/LICENSE +0 -0
- {pycatfile-0.8.6 → pycatfile-0.9.2}/PyCatFile.egg-info/SOURCES.txt +0 -0
- {pycatfile-0.8.6 → pycatfile-0.9.2}/PyCatFile.egg-info/dependency_links.txt +0 -0
- {pycatfile-0.8.6 → pycatfile-0.9.2}/PyCatFile.egg-info/top_level.txt +0 -0
- {pycatfile-0.8.6 → pycatfile-0.9.2}/PyCatFile.egg-info/zip-safe +0 -0
- {pycatfile-0.8.6 → pycatfile-0.9.2}/README.md +0 -0
- {pycatfile-0.8.6 → pycatfile-0.9.2}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: PyCatFile
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.9.2
|
|
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
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: PyCatFile
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.9.2
|
|
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,190 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
|
|
4
|
+
'''
|
|
5
|
+
This program is free software; you can redistribute it and/or modify
|
|
6
|
+
it under the terms of the Revised BSD License.
|
|
7
|
+
|
|
8
|
+
This program is distributed in the hope that it will be useful,
|
|
9
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
11
|
+
Revised BSD License for more details.
|
|
12
|
+
|
|
13
|
+
Copyright 2018-2024 Cool Dude 2k - http://idb.berlios.de/
|
|
14
|
+
Copyright 2018-2024 Game Maker 2k - http://intdb.sourceforge.net/
|
|
15
|
+
Copyright 2018-2024 Kazuki Przyborowski - https://github.com/KazukiPrzyborowski
|
|
16
|
+
|
|
17
|
+
$FileInfo: catfile.py - Last Update: 4/30/2024 Ver. 0.9.2 RC 1 - Author: cooldude2k $
|
|
18
|
+
'''
|
|
19
|
+
|
|
20
|
+
from __future__ import absolute_import, division, print_function, unicode_literals;
|
|
21
|
+
import sys, argparse, pycatfile, binascii;
|
|
22
|
+
|
|
23
|
+
rarfile_support = pycatfile.rarfile_support;
|
|
24
|
+
py7zr_support = pycatfile.py7zr_support;
|
|
25
|
+
|
|
26
|
+
if(sys.version[0]=="2"):
|
|
27
|
+
try:
|
|
28
|
+
from io import StringIO, BytesIO;
|
|
29
|
+
except ImportError:
|
|
30
|
+
try:
|
|
31
|
+
from cStringIO import StringIO;
|
|
32
|
+
from cStringIO import StringIO as BytesIO;
|
|
33
|
+
except ImportError:
|
|
34
|
+
from StringIO import StringIO;
|
|
35
|
+
from StringIO import StringIO as BytesIO;
|
|
36
|
+
elif(sys.version[0]>="3"):
|
|
37
|
+
from io import StringIO, BytesIO;
|
|
38
|
+
else:
|
|
39
|
+
teststringio = 0;
|
|
40
|
+
if(teststringio<=0):
|
|
41
|
+
try:
|
|
42
|
+
from cStringIO import StringIO as BytesIO;
|
|
43
|
+
teststringio = 1;
|
|
44
|
+
except ImportError:
|
|
45
|
+
teststringio = 0;
|
|
46
|
+
if(teststringio<=0):
|
|
47
|
+
try:
|
|
48
|
+
from StringIO import StringIO as BytesIO;
|
|
49
|
+
teststringio = 2;
|
|
50
|
+
except ImportError:
|
|
51
|
+
teststringio = 0;
|
|
52
|
+
if(teststringio<=0):
|
|
53
|
+
try:
|
|
54
|
+
from io import BytesIO;
|
|
55
|
+
teststringio = 3;
|
|
56
|
+
except ImportError:
|
|
57
|
+
teststringio = 0;
|
|
58
|
+
|
|
59
|
+
__project__ = pycatfile.__project__;
|
|
60
|
+
__program_name__ = pycatfile.__program_name__;
|
|
61
|
+
__file_format_name__ = pycatfile.__file_format_name__;
|
|
62
|
+
__file_format_lower__ = pycatfile.__file_format_lower__;
|
|
63
|
+
__file_format_magic__ = pycatfile.__file_format_magic__;
|
|
64
|
+
__file_format_len__ = pycatfile.__file_format_len__;
|
|
65
|
+
__file_format_hex__ = pycatfile.__file_format_hex__;
|
|
66
|
+
__file_format_delimiter__ = pycatfile.__file_format_delimiter__;
|
|
67
|
+
__file_format_list__ = pycatfile.__file_format_list__;
|
|
68
|
+
__use_new_style__ = pycatfile.__use_new_style__;
|
|
69
|
+
__use_advanced_list__ = pycatfile.__use_advanced_list__;
|
|
70
|
+
__use_alt_inode__ = pycatfile.__use_alt_inode__;
|
|
71
|
+
__project_url__ = pycatfile.__project_url__;
|
|
72
|
+
__version_info__ = pycatfile.__version_info__;
|
|
73
|
+
__version_date_info__ = pycatfile.__version_date_info__;
|
|
74
|
+
__version_date__ = pycatfile.__version_date__;
|
|
75
|
+
__version_date_plusrc__ = pycatfile.__version_date_plusrc__;
|
|
76
|
+
__version__ = pycatfile.__version__;
|
|
77
|
+
|
|
78
|
+
# Initialize the argument parser
|
|
79
|
+
argparser = argparse.ArgumentParser(description="Manipulate concatenated files.", conflict_handler="resolve", add_help=True);
|
|
80
|
+
|
|
81
|
+
# Version information
|
|
82
|
+
argparser.add_argument("-V", "--version", action="version", version=__program_name__ + " " + __version__);
|
|
83
|
+
# Input and output specifications
|
|
84
|
+
argparser.add_argument("-i", "--input", help="Specify the file(s) to concatenate or the concatenated file to extract.", required=True);
|
|
85
|
+
argparser.add_argument("-o", "--output", default=None, help="Specify the name for the extracted or output concatenated files.");
|
|
86
|
+
# Operations
|
|
87
|
+
argparser.add_argument("-c", "--create", action="store_true", help="Perform only the concatenation operation.");
|
|
88
|
+
argparser.add_argument("-e", "--extract", action="store_true", help="Perform only the extraction operation.");
|
|
89
|
+
argparser.add_argument("-t", "--convert", action="store_true", help="Convert a tar/zip/rar/7zip file to a concatenated file.");
|
|
90
|
+
argparser.add_argument("-r", "--repack", action="store_true", help="Re-concatenate files, fixing checksum errors if any.");
|
|
91
|
+
# File manipulation options
|
|
92
|
+
argparser.add_argument("-F", "--format", default=__file_format_list__[0], help="Specify the format to use.");
|
|
93
|
+
argparser.add_argument("-D", "--delimiter", default=__file_format_list__[5], help="Specify the delimiter to use.");
|
|
94
|
+
argparser.add_argument("-m", "--formatver", default=__file_format_list__[6], help="Specify the format version.");
|
|
95
|
+
argparser.add_argument("-l", "--list", action="store_true", help="List files included in the concatenated file.");
|
|
96
|
+
# Compression options
|
|
97
|
+
argparser.add_argument("-P", "--compression", default="auto", help="Specify the compression method to use for concatenation.");
|
|
98
|
+
argparser.add_argument("-L", "--level", default=None, help="Specify the compression level for concatenation.");
|
|
99
|
+
# Checksum and validation
|
|
100
|
+
argparser.add_argument("-v", "--validate", action="store_true", help="Validate concatenated file checksums.");
|
|
101
|
+
argparser.add_argument("-C", "--checksum", default="crc32", help="Specify the type of checksum to use. The default is crc32.");
|
|
102
|
+
argparser.add_argument("-s", "--skipchecksum", action="store_true", help="Skip the checksum check of files.");
|
|
103
|
+
# Permissions and metadata
|
|
104
|
+
argparser.add_argument("-p", "--preserve", action="store_false", help="Do not preserve permissions and timestamps of files.");
|
|
105
|
+
# Miscellaneous
|
|
106
|
+
argparser.add_argument("-d", "--verbose", action="store_true", help="Enable verbose mode to display various debugging information.");
|
|
107
|
+
argparser.add_argument("-T", "--text", action="store_true", help="Read file locations from a text file.");
|
|
108
|
+
# Parse the arguments
|
|
109
|
+
getargs = argparser.parse_args();
|
|
110
|
+
|
|
111
|
+
fname = getargs.format;
|
|
112
|
+
fnamelower = fname.lower();
|
|
113
|
+
fnamemagic = fname;
|
|
114
|
+
fnamelen = len(fname);
|
|
115
|
+
fnamehex = binascii.hexlify(fname.encode("UTF-8")).decode("UTF-8");
|
|
116
|
+
fnamesty = __use_new_style__;
|
|
117
|
+
fnamelst = __use_advanced_list__;
|
|
118
|
+
fnameino = __use_alt_inode__;
|
|
119
|
+
fnamelist = [fname, fnamemagic, fnamelower, fnamelen, fnamehex, getargs.delimiter, getargs.formatver, fnamesty, fnamelst, fnameino];
|
|
120
|
+
|
|
121
|
+
# Determine the primary action based on user input
|
|
122
|
+
actions = ['create', 'extract', 'list', 'repack', 'validate'];
|
|
123
|
+
active_action = next((action for action in actions if getattr(getargs, action)), None);
|
|
124
|
+
|
|
125
|
+
# Execute the appropriate functions based on determined actions and arguments
|
|
126
|
+
if active_action:
|
|
127
|
+
if active_action=='create':
|
|
128
|
+
if getargs.convert:
|
|
129
|
+
checkcompressfile = pycatfile.CheckCompressionSubType(getargs.input, fnamelist, True);
|
|
130
|
+
if(checkcompressfile=="catfile"):
|
|
131
|
+
tmpout = pycatfile.RePackArchiveFile(getargs.input, getargs.output, getargs.compression, getargs.level, False, 0, 0, getargs.checksum, getargs.skipchecksum, [], fnamelist, getargs.verbose, False);
|
|
132
|
+
else:
|
|
133
|
+
tmpout = pycatfile.PackArchiveFileFromInFile(getargs.input, getargs.output, getargs.compression, getargs.level, getargs.checksum, [], fnamelist, getargs.verbose, False);
|
|
134
|
+
if(not tmpout):
|
|
135
|
+
sys.exit(1);
|
|
136
|
+
else:
|
|
137
|
+
pycatfile.PackArchiveFile(getargs.input, getargs.output, getargs.text, getargs.compression, getargs.level, False, getargs.checksum, [], fnamelist, getargs.verbose, False);
|
|
138
|
+
elif active_action=='repack':
|
|
139
|
+
if getargs.convert:
|
|
140
|
+
checkcompressfile = pycatfile.CheckCompressionSubType(getargs.input, fnamelist, True);
|
|
141
|
+
if(checkcompressfile=="catfile"):
|
|
142
|
+
pycatfile.RePackArchiveFile(getargs.input, getargs.output, getargs.compression, getargs.level, False, 0, 0, getargs.checksum, getargs.skipchecksum, [], fnamelist, getargs.verbose, False);
|
|
143
|
+
else:
|
|
144
|
+
pycatfile.PackArchiveFileFromInFile(getargs.input, getargs.output, getargs.compression, getargs.level, getargs.checksum, [], fnamelist, getargs.verbose, False);
|
|
145
|
+
if(not tmpout):
|
|
146
|
+
sys.exit(1);
|
|
147
|
+
else:
|
|
148
|
+
pycatfile.RePackArchiveFile(getargs.input, getargs.output, getargs.compression, getargs.level, False, 0, 0, getargs.checksum, getargs.skipchecksum, [], fnamelist, getargs.verbose, False);
|
|
149
|
+
elif active_action=='extract':
|
|
150
|
+
if getargs.convert:
|
|
151
|
+
checkcompressfile = pycatfile.CheckCompressionSubType(getargs.input, fnamelist, True);
|
|
152
|
+
tempout = BytesIO();
|
|
153
|
+
if(checkcompressfile=="catfile"):
|
|
154
|
+
tmpout = pycatfile.RePackArchiveFile(getargs.input, tempout, getargs.compression, getargs.level, False, 0, 0, getargs.checksum, getargs.skipchecksum, [], fnamelist, getargs.verbose, False);
|
|
155
|
+
else:
|
|
156
|
+
tmpout = pycatfile.PackArchiveFileFromInFile(getargs.input, tempout, getargs.compression, getargs.level, getargs.checksum, [], fnamelist, getargs.verbose, False);
|
|
157
|
+
if(not tmpout):
|
|
158
|
+
sys.exit(1);
|
|
159
|
+
getargs.input = tempout;
|
|
160
|
+
pycatfile.UnPackArchiveFile(getargs.input, getargs.output, False, 0, 0, getargs.skipchecksum, fnamelist, getargs.verbose, getargs.preserve, getargs.preserve, False);
|
|
161
|
+
elif active_action=='list':
|
|
162
|
+
if getargs.convert:
|
|
163
|
+
checkcompressfile = pycatfile.CheckCompressionSubType(getargs.input, fnamelist, True);
|
|
164
|
+
if(checkcompressfile=="catfile"):
|
|
165
|
+
tmpout = pycatfile.ArchiveFileListFiles(getargs.input, 0, 0, getargs.skipchecksum, fnamelist, getargs.verbose, False);
|
|
166
|
+
else:
|
|
167
|
+
tmpout = pycatfile.InFileListFiles(getargs.input, getargs.verbose, fnamelist, False);
|
|
168
|
+
if(not tmpout):
|
|
169
|
+
sys.exit(1);
|
|
170
|
+
else:
|
|
171
|
+
pycatfile.ArchiveFileListFiles(getargs.input, 0, 0, getargs.skipchecksum, fnamelist, getargs.verbose, False);
|
|
172
|
+
elif active_action=='validate':
|
|
173
|
+
if getargs.convert:
|
|
174
|
+
checkcompressfile = pycatfile.CheckCompressionSubType(getargs.input, fnamelist, True);
|
|
175
|
+
tempout = BytesIO();
|
|
176
|
+
if(checkcompressfile=="catfile"):
|
|
177
|
+
tmpout = pycatfile.RePackArchiveFile(getargs.input, tempout, getargs.compression, getargs.level, False, 0, 0, getargs.checksum, getargs.skipchecksum, [], fnamelist, getargs.verbose, False);
|
|
178
|
+
else:
|
|
179
|
+
tmpout = pycatfile.PackArchiveFileFromInFile(getargs.input, tempout, getargs.compression, getargs.level, getargs.checksum, [], fnamelist, getargs.verbose, False);
|
|
180
|
+
getargs.input = tempout;
|
|
181
|
+
if(not tmpout):
|
|
182
|
+
sys.exit(1);
|
|
183
|
+
fvalid = pycatfile.ArchiveFileValidate(getargs.input, fnamelist, getargs.verbose, False);
|
|
184
|
+
if(not getargs.verbose):
|
|
185
|
+
import sys, logging;
|
|
186
|
+
logging.basicConfig(format="%(message)s", stream=sys.stdout, level=logging.DEBUG);
|
|
187
|
+
if(fvalid):
|
|
188
|
+
pycatfile.VerbosePrintOut("File is valid: \n" + str(getargs.input));
|
|
189
|
+
else:
|
|
190
|
+
pycatfile.VerbosePrintOut("File is invalid: \n" + str(getargs.input));
|
|
@@ -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: neocatfile.py - Last Update: 4/
|
|
17
|
+
$FileInfo: neocatfile.py - Last Update: 4/30/2024 Ver. 0.9.2 RC 1 - Author: cooldude2k $
|
|
18
18
|
'''
|
|
19
19
|
|
|
20
20
|
from __future__ import absolute_import, division, print_function, unicode_literals
|
|
@@ -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: 4/
|
|
17
|
+
$FileInfo: pycatfile.py - Last Update: 4/30/2024 Ver. 0.9.2 RC 1 - Author: cooldude2k $
|
|
18
18
|
'''
|
|
19
19
|
|
|
20
20
|
from __future__ import absolute_import, division, print_function, unicode_literals;
|
|
@@ -171,11 +171,11 @@ __use_alt_inode__ = False;
|
|
|
171
171
|
__file_format_list__ = [__file_format_name__, __file_format_magic__, __file_format_lower__, __file_format_len__, __file_format_hex__, __file_format_delimiter__, __file_format_ver__, __use_new_style__, __use_advanced_list__, __use_alt_inode__];
|
|
172
172
|
__project__ = __program_name__;
|
|
173
173
|
__project_url__ = "https://github.com/GameMaker2k/PyCatFile";
|
|
174
|
-
__version_info__ = (0,
|
|
175
|
-
__version_date_info__ = (2024, 4,
|
|
174
|
+
__version_info__ = (0, 9, 2, "RC 1", 1);
|
|
175
|
+
__version_date_info__ = (2024, 4, 30, "RC 1", 1);
|
|
176
176
|
__version_date__ = str(__version_date_info__[0]) + "." + str(__version_date_info__[1]).zfill(2) + "." + str(__version_date_info__[2]).zfill(2);
|
|
177
177
|
__revision__ = __version_info__[3];
|
|
178
|
-
__revision_id__ = "$Id:
|
|
178
|
+
__revision_id__ = "$Id: 1370407de88baf5ecc6c9eec303cd9952947e081 $";
|
|
179
179
|
if(__version_info__[4] is not None):
|
|
180
180
|
__version_date_plusrc__ = __version_date__ + "-" + str(__version_date_info__[4]);
|
|
181
181
|
if(__version_info__[4] is None):
|
|
@@ -1199,6 +1199,52 @@ def AppendFileHeader(fp, numfiles, checksumtype="crc32", formatspecs=__file_form
|
|
|
1199
1199
|
pass;
|
|
1200
1200
|
return fp;
|
|
1201
1201
|
|
|
1202
|
+
def MakeEmptyFilePointer(fp, checksumtype="crc32", formatspecs=__file_format_list__):
|
|
1203
|
+
AppendFileHeader(fp, 0, checksumtype, formatspecs);
|
|
1204
|
+
return fp;
|
|
1205
|
+
|
|
1206
|
+
def MakeEmptyFile(outfile, compression="auto", compressionlevel=None, checksumtype="crc32", formatspecs=__file_format_list__, returnfp=False):
|
|
1207
|
+
if(outfile!="-" and not hasattr(outfile, "read") and not hasattr(outfile, "write")):
|
|
1208
|
+
if(os.path.exists(outfile)):
|
|
1209
|
+
os.unlink(outfile);
|
|
1210
|
+
if(outfile=="-"):
|
|
1211
|
+
verbose = False;
|
|
1212
|
+
catfpfp = BytesIO();
|
|
1213
|
+
elif(hasattr(outfile, "read") or hasattr(outfile, "write")):
|
|
1214
|
+
catfp = outfile;
|
|
1215
|
+
elif(re.findall(r"^(ftp|ftps|sftp)\:\/\/", str(outfile))):
|
|
1216
|
+
catfp = BytesIO();
|
|
1217
|
+
else:
|
|
1218
|
+
fbasename = os.path.splitext(outfile)[0];
|
|
1219
|
+
fextname = os.path.splitext(outfile)[1];
|
|
1220
|
+
catfp = CompressOpenFile(outfile, compressionlevel);
|
|
1221
|
+
catfp = AppendFileHeader(catfp, 0, checksumtype, formatspecs);
|
|
1222
|
+
if(outfile=="-" or hasattr(outfile, "read") or hasattr(outfile, "write")):
|
|
1223
|
+
catfp = CompressArchiveFile(catfp, compression, formatspecs);
|
|
1224
|
+
try:
|
|
1225
|
+
catfp.flush();
|
|
1226
|
+
os.fsync(catfp.fileno());
|
|
1227
|
+
except io.UnsupportedOperation:
|
|
1228
|
+
pass;
|
|
1229
|
+
except AttributeError:
|
|
1230
|
+
pass;
|
|
1231
|
+
if(outfile=="-"):
|
|
1232
|
+
catfp.seek(0, 0);
|
|
1233
|
+
if(hasattr(sys.stdout, "buffer")):
|
|
1234
|
+
shutil.copyfileobj(catfp, sys.stdout.buffer);
|
|
1235
|
+
else:
|
|
1236
|
+
shutil.copyfileobj(catfp, sys.stdout);
|
|
1237
|
+
elif(re.findall(r"^(ftp|ftps|sftp)\:\/\/", str(outfile))):
|
|
1238
|
+
catfp = CompressArchiveFile(catfp, compression, formatspecs);
|
|
1239
|
+
catfp.seek(0, 0);
|
|
1240
|
+
upload_file_to_internet_file(catfp, outfile);
|
|
1241
|
+
if(returnfp):
|
|
1242
|
+
catfp.seek(0, 0);
|
|
1243
|
+
return catfp;
|
|
1244
|
+
else:
|
|
1245
|
+
catfp.close();
|
|
1246
|
+
return True;
|
|
1247
|
+
|
|
1202
1248
|
def AppendFileHeaderWithContent(fp, filevalues=[], extradata=[], filecontent="", checksumtype="crc32", formatspecs=__file_format_list__):
|
|
1203
1249
|
extrafields = format(len(extradata), 'x').lower();
|
|
1204
1250
|
extrasizestr = AppendNullByte(extrafields, formatspecs[5]);
|
|
@@ -2615,6 +2661,8 @@ if(hasattr(shutil, "register_archive_format")):
|
|
|
2615
2661
|
def PackArchiveFileFromDirList(infiles, outfile, dirlistfromtxt=False, compression="auto", compressionlevel=None, followlink=False, checksumtype="crc32", extradata=[], formatspecs=__file_format_list__, verbose=False, returnfp=False):
|
|
2616
2662
|
return PackArchiveFile(infiles, outfile, dirlistfromtxt, compression, compressionlevel, followlink, checksumtype, extradata, formatspecs, verbose, returnfp);
|
|
2617
2663
|
|
|
2664
|
+
create_alias_function("Pack", __file_format_name__, "FromDirList", PackArchiveFileFromDirList);
|
|
2665
|
+
|
|
2618
2666
|
def PackArchiveFileFromTarFile(infile, outfile, compression="auto", compressionlevel=None, checksumtype="crc32", extradata=[], formatspecs=__file_format_list__, verbose=False, returnfp=False):
|
|
2619
2667
|
if(outfile!="-" and not hasattr(outfile, "read") and not hasattr(outfile, "write")):
|
|
2620
2668
|
outfile = RemoveWindowsPath(outfile);
|
|
@@ -2902,7 +2950,7 @@ def PackArchiveFileFromTarFile(infile, outfile, compression="auto", compressionl
|
|
|
2902
2950
|
elif(re.findall(r"^(ftp|ftps|sftp)\:\/\/", str(outfile))):
|
|
2903
2951
|
catfp = CompressArchiveFile(catfp, compression, formatspecs);
|
|
2904
2952
|
catfp.seek(0, 0);
|
|
2905
|
-
|
|
2953
|
+
upload_file_to_internet_file(catfp, outfile);
|
|
2906
2954
|
if(returnfp):
|
|
2907
2955
|
catfp.seek(0, 0);
|
|
2908
2956
|
return catfp;
|
|
@@ -3833,6 +3881,8 @@ create_alias_function("Pack", __file_format_name__, "FromSevenZipFile", PackArch
|
|
|
3833
3881
|
|
|
3834
3882
|
def PackArchiveFileFromInFile(infile, outfile, compression="auto", compressionlevel=None, checksumtype="crc32", extradata=[], formatspecs=__file_format_list__, verbose=False, returnfp=False):
|
|
3835
3883
|
checkcompressfile = CheckCompressionSubType(infile, formatspecs, True);
|
|
3884
|
+
if(verbose):
|
|
3885
|
+
logging.basicConfig(format="%(message)s", stream=sys.stdout, level=logging.DEBUG);
|
|
3836
3886
|
if(checkcompressfile=="tarfile"):
|
|
3837
3887
|
return PackArchiveFileFromTarFile(infile, outfile, compression, compressionlevel, checksumtype, extradata, formatspecs, verbose, returnfp);
|
|
3838
3888
|
elif(checkcompressfile=="zipfile"):
|
|
@@ -7241,59 +7291,7 @@ def ArchiveFileStringListFiles(catstr, seekstart=0, seekend=0, skipchecksum=Fals
|
|
|
7241
7291
|
listcatfiles = ArchiveFileListFiles(catstr, seekstart, seekend, skipchecksum, formatspecs, verbose, returnfp);
|
|
7242
7292
|
return listcatfiles;
|
|
7243
7293
|
|
|
7244
|
-
create_alias_function("", __file_format_name__, "StringListFiles",
|
|
7245
|
-
|
|
7246
|
-
def ArchiveFileListFilesAlt(infile, seekstart=0, seekend=0, skipchecksum=False, formatspecs=__file_format_list__, verbose=False, returnfp=False):
|
|
7247
|
-
logging.basicConfig(format="%(message)s", stream=sys.stdout, level=logging.DEBUG);
|
|
7248
|
-
if(isinstance(infile, dict)):
|
|
7249
|
-
listcatfiles = infile;
|
|
7250
|
-
else:
|
|
7251
|
-
if(infile!="-" and not hasattr(infile, "read") and not hasattr(infile, "write")):
|
|
7252
|
-
infile = RemoveWindowsPath(infile);
|
|
7253
|
-
listcatfiles = ArchiveFileToArray(infile, seekstart, seekend, True, skipchecksum, formatspecs, returnfp);
|
|
7254
|
-
if(not listcatfiles):
|
|
7255
|
-
return False;
|
|
7256
|
-
lenlist = len(listcatfiles['ffilelist']);
|
|
7257
|
-
fnumfiles = int(listcatfiles['fnumfiles']);
|
|
7258
|
-
lcfi = 0;
|
|
7259
|
-
lcfx = int(listcatfiles['fnumfiles']);
|
|
7260
|
-
if(lenlist>listcatfiles['fnumfiles'] or lenlist<listcatfiles['fnumfiles']):
|
|
7261
|
-
lcfx = int(lenlist);
|
|
7262
|
-
else:
|
|
7263
|
-
lcfx = int(listcatfiles['fnumfiles']);
|
|
7264
|
-
returnval = {};
|
|
7265
|
-
while(lcfi<lcfx):
|
|
7266
|
-
returnval.update({lcfi: listcatfiles['ffilelist'][lcfi]['fname']});
|
|
7267
|
-
if(not verbose):
|
|
7268
|
-
VerbosePrintOut(listcatfiles['ffilelist'][lcfi]['fname']);
|
|
7269
|
-
if(verbose):
|
|
7270
|
-
permissions = { 'access': { '0': ('---'), '1': ('--x'), '2': ('-w-'), '3': ('-wx'), '4': ('r--'), '5': ('r-x'), '6': ('rw-'), '7': ('rwx') }, 'roles': { 0: 'owner', 1: 'group', 2: 'other' } };
|
|
7271
|
-
printfname = listcatfiles['ffilelist'][lcfi]['fname'];
|
|
7272
|
-
if(listcatfiles['ffilelist'][lcfi]['ftype']==1):
|
|
7273
|
-
printfname = listcatfiles['ffilelist'][lcfi]['fname'] + " link to " + listcatfiles['ffilelist'][lcfi]['flinkname'];
|
|
7274
|
-
if(listcatfiles['ffilelist'][lcfi]['ftype']==2):
|
|
7275
|
-
printfname = listcatfiles['ffilelist'][lcfi]['fname'] + " -> " + listcatfiles['ffilelist'][lcfi]['flinkname'];
|
|
7276
|
-
fuprint = listcatfiles['ffilelist'][lcfi]['funame'];
|
|
7277
|
-
if(len(fuprint)<=0):
|
|
7278
|
-
fuprint = listcatfiles['ffilelist'][lcfi]['fuid'];
|
|
7279
|
-
fgprint = listcatfiles['ffilelist'][lcfi]['fgname'];
|
|
7280
|
-
if(len(fgprint)<=0):
|
|
7281
|
-
fgprint = listcatfiles['ffilelist'][lcfi]['fgid'];
|
|
7282
|
-
VerbosePrintOut(PrintPermissionString(listcatfiles['ffilelist'][lcfi]['fmode'], listcatfiles['ffilelist'][lcfi]['ftype']) + " " + str(str(fuprint) + "/" + str(fgprint) + " " + str(listcatfiles['ffilelist'][lcfi]['fsize']).rjust(15) + " " + datetime.datetime.utcfromtimestamp(listcatfiles['ffilelist'][lcfi]['fmtime']).strftime('%Y-%m-%d %H:%M') + " " + printfname));
|
|
7283
|
-
lcfi = lcfi + 1;
|
|
7284
|
-
if(returnfp):
|
|
7285
|
-
return listcatfiles['catfp'];
|
|
7286
|
-
else:
|
|
7287
|
-
return True;
|
|
7288
|
-
|
|
7289
|
-
create_alias_function("", __file_format_name__, "ListFilesAlt", ArchiveFileListFilesAlt);
|
|
7290
|
-
|
|
7291
|
-
def ArchiveFileStringListFilesAlt(catstr, seekstart=0, seekend=0, skipchecksum=False, formatspecs=__file_format_list__, verbose=False, returnfp=False):
|
|
7292
|
-
catfp = BytesIO(catstr);
|
|
7293
|
-
listcatfiles = ArchiveFileListFilesAlt(catstr, seekstart, seekend, skipchecksum, formatspecs, verbose, returnfp);
|
|
7294
|
-
return listcatfiles;
|
|
7295
|
-
|
|
7296
|
-
create_alias_function("", __file_format_name__, "StringListFilesAlt", ArchiveFileListFilesAlt);
|
|
7294
|
+
create_alias_function("", __file_format_name__, "StringListFiles", ArchiveFileStringListFiles);
|
|
7297
7295
|
|
|
7298
7296
|
def TarFileListFiles(infile, verbose=False, returnfp=False):
|
|
7299
7297
|
logging.basicConfig(format="%(message)s", stream=sys.stdout, level=logging.DEBUG);
|
|
@@ -7751,13 +7749,14 @@ if(py7zr_support):
|
|
|
7751
7749
|
return True;
|
|
7752
7750
|
|
|
7753
7751
|
def InFileListFiles(infile, verbose=False, formatspecs=__file_format_list__, returnfp=False):
|
|
7752
|
+
logging.basicConfig(format="%(message)s", stream=sys.stdout, level=logging.DEBUG);
|
|
7754
7753
|
checkcompressfile = CheckCompressionSubType(infile, formatspecs, True);
|
|
7755
7754
|
if(checkcompressfile=="tarfile"):
|
|
7756
7755
|
return TarFileListFiles(infile, verbose, returnfp);
|
|
7757
7756
|
elif(checkcompressfile=="zipfile"):
|
|
7758
7757
|
return ZipFileListFiles(infile, verbose, returnfp);
|
|
7759
7758
|
elif(checkcompressfile=="catfile"):
|
|
7760
|
-
return ArchiveFileListFiles(infile, verbose, returnfp);
|
|
7759
|
+
return ArchiveFileListFiles(infile, 0, 0, False, formatspecs, verbose, returnfp);
|
|
7761
7760
|
elif(rarfile_support and checkcompressfile=="rarfile"):
|
|
7762
7761
|
return RarFileListFiles(infile, verbose, returnfp);
|
|
7763
7762
|
elif(py7zr_support and checkcompressfile=="7zipfile"):
|
|
@@ -7896,9 +7895,9 @@ def upload_file_to_ftp_file(ftpfile, url):
|
|
|
7896
7895
|
return False;
|
|
7897
7896
|
if(urlparts.scheme=="sftp"):
|
|
7898
7897
|
if(__use_pysftp__):
|
|
7899
|
-
return
|
|
7898
|
+
return upload_file_to_pysftp_file(url);
|
|
7900
7899
|
else:
|
|
7901
|
-
return
|
|
7900
|
+
return upload_file_to_sftp_file(url);
|
|
7902
7901
|
elif(urlparts.scheme=="http" or urlparts.scheme=="https"):
|
|
7903
7902
|
return False;
|
|
7904
7903
|
ftp_port = urlparts.port;
|
|
@@ -8058,7 +8057,7 @@ if(haveparamiko):
|
|
|
8058
8057
|
else:
|
|
8059
8058
|
sftp_password = "";
|
|
8060
8059
|
if(urlparts.scheme=="ftp"):
|
|
8061
|
-
return
|
|
8060
|
+
return upload_file_to_ftp_file(url);
|
|
8062
8061
|
elif(urlparts.scheme=="http" or urlparts.scheme=="https"):
|
|
8063
8062
|
return False;
|
|
8064
8063
|
if(urlparts.scheme!="sftp"):
|
|
@@ -8172,7 +8171,7 @@ if(havepysftp):
|
|
|
8172
8171
|
else:
|
|
8173
8172
|
sftp_password = "";
|
|
8174
8173
|
if(urlparts.scheme=="ftp"):
|
|
8175
|
-
return
|
|
8174
|
+
return upload_file_to_ftp_file(url);
|
|
8176
8175
|
elif(urlparts.scheme=="http" or urlparts.scheme=="https"):
|
|
8177
8176
|
return False;
|
|
8178
8177
|
if(urlparts.scheme!="sftp"):
|
|
@@ -8258,12 +8257,12 @@ def upload_file_to_internet_file(ifp, url):
|
|
|
8258
8257
|
if(urlparts.scheme=="http" or urlparts.scheme=="https"):
|
|
8259
8258
|
return False;
|
|
8260
8259
|
elif(urlparts.scheme=="ftp" or urlparts.scheme=="ftps"):
|
|
8261
|
-
return
|
|
8260
|
+
return upload_file_to_ftp_file(ifp, url);
|
|
8262
8261
|
elif(urlparts.scheme=="sftp"):
|
|
8263
8262
|
if(__use_pysftp__ and havepysftp):
|
|
8264
|
-
return
|
|
8263
|
+
return upload_file_to_pysftp_file(ifp, url);
|
|
8265
8264
|
else:
|
|
8266
|
-
return
|
|
8265
|
+
return upload_file_to_sftp_file(ifp, url);
|
|
8267
8266
|
else:
|
|
8268
8267
|
return False;
|
|
8269
8268
|
return False;
|
|
@@ -8281,12 +8280,12 @@ def upload_file_to_internet_string(ifp, url):
|
|
|
8281
8280
|
if(urlparts.scheme=="http" or urlparts.scheme=="https"):
|
|
8282
8281
|
return False;
|
|
8283
8282
|
elif(urlparts.scheme=="ftp" or urlparts.scheme=="ftps"):
|
|
8284
|
-
return
|
|
8283
|
+
return upload_file_to_ftp_string(ifp, url);
|
|
8285
8284
|
elif(urlparts.scheme=="sftp"):
|
|
8286
8285
|
if(__use_pysftp__ and havepysftp):
|
|
8287
|
-
return
|
|
8286
|
+
return upload_file_to_pysftp_string(ifp, url);
|
|
8288
8287
|
else:
|
|
8289
|
-
return
|
|
8288
|
+
return upload_file_to_sftp_string(ifp, url);
|
|
8290
8289
|
else:
|
|
8291
8290
|
return False;
|
|
8292
8291
|
return False;
|
|
@@ -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: 4/
|
|
16
|
+
$FileInfo: setup.py - Last Update: 4/30/2024 Ver. 0.9.2 RC 1 - Author: cooldude2k $
|
|
17
17
|
'''
|
|
18
18
|
|
|
19
19
|
import os, re, sys, pkg_resources;
|
pycatfile-0.8.6/catfile.py
DELETED
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
|
-
|
|
4
|
-
'''
|
|
5
|
-
This program is free software; you can redistribute it and/or modify
|
|
6
|
-
it under the terms of the Revised BSD License.
|
|
7
|
-
|
|
8
|
-
This program is distributed in the hope that it will be useful,
|
|
9
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
11
|
-
Revised BSD License for more details.
|
|
12
|
-
|
|
13
|
-
Copyright 2018-2024 Cool Dude 2k - http://idb.berlios.de/
|
|
14
|
-
Copyright 2018-2024 Game Maker 2k - http://intdb.sourceforge.net/
|
|
15
|
-
Copyright 2018-2024 Kazuki Przyborowski - https://github.com/KazukiPrzyborowski
|
|
16
|
-
|
|
17
|
-
$FileInfo: catfile.py - Last Update: 4/26/2024 Ver. 0.8.6 RC 1 - Author: cooldude2k $
|
|
18
|
-
'''
|
|
19
|
-
|
|
20
|
-
from __future__ import absolute_import, division, print_function, unicode_literals;
|
|
21
|
-
import sys, argparse, pycatfile, binascii;
|
|
22
|
-
|
|
23
|
-
rarfile_support = pycatfile.rarfile_support;
|
|
24
|
-
py7zr_support = pycatfile.py7zr_support;
|
|
25
|
-
|
|
26
|
-
if(sys.version[0]=="2"):
|
|
27
|
-
try:
|
|
28
|
-
from io import StringIO, BytesIO;
|
|
29
|
-
except ImportError:
|
|
30
|
-
try:
|
|
31
|
-
from cStringIO import StringIO;
|
|
32
|
-
from cStringIO import StringIO as BytesIO;
|
|
33
|
-
except ImportError:
|
|
34
|
-
from StringIO import StringIO;
|
|
35
|
-
from StringIO import StringIO as BytesIO;
|
|
36
|
-
elif(sys.version[0]>="3"):
|
|
37
|
-
from io import StringIO, BytesIO;
|
|
38
|
-
else:
|
|
39
|
-
teststringio = 0;
|
|
40
|
-
if(teststringio<=0):
|
|
41
|
-
try:
|
|
42
|
-
from cStringIO import StringIO as BytesIO;
|
|
43
|
-
teststringio = 1;
|
|
44
|
-
except ImportError:
|
|
45
|
-
teststringio = 0;
|
|
46
|
-
if(teststringio<=0):
|
|
47
|
-
try:
|
|
48
|
-
from StringIO import StringIO as BytesIO;
|
|
49
|
-
teststringio = 2;
|
|
50
|
-
except ImportError:
|
|
51
|
-
teststringio = 0;
|
|
52
|
-
if(teststringio<=0):
|
|
53
|
-
try:
|
|
54
|
-
from io import BytesIO;
|
|
55
|
-
teststringio = 3;
|
|
56
|
-
except ImportError:
|
|
57
|
-
teststringio = 0;
|
|
58
|
-
|
|
59
|
-
__project__ = pycatfile.__project__;
|
|
60
|
-
__program_name__ = pycatfile.__program_name__;
|
|
61
|
-
__file_format_name__ = pycatfile.__file_format_name__;
|
|
62
|
-
__file_format_lower__ = pycatfile.__file_format_lower__;
|
|
63
|
-
__file_format_magic__ = pycatfile.__file_format_magic__;
|
|
64
|
-
__file_format_len__ = pycatfile.__file_format_len__;
|
|
65
|
-
__file_format_hex__ = pycatfile.__file_format_hex__;
|
|
66
|
-
__file_format_delimiter__ = pycatfile.__file_format_delimiter__;
|
|
67
|
-
__file_format_list__ = pycatfile.__file_format_list__;
|
|
68
|
-
__use_new_style__ = pycatfile.__use_new_style__;
|
|
69
|
-
__use_advanced_list__ = pycatfile.__use_advanced_list__;
|
|
70
|
-
__use_alt_inode__ = pycatfile.__use_alt_inode__;
|
|
71
|
-
__project_url__ = pycatfile.__project_url__;
|
|
72
|
-
__version_info__ = pycatfile.__version_info__;
|
|
73
|
-
__version_date_info__ = pycatfile.__version_date_info__;
|
|
74
|
-
__version_date__ = pycatfile.__version_date__;
|
|
75
|
-
__version_date_plusrc__ = pycatfile.__version_date_plusrc__;
|
|
76
|
-
__version__ = pycatfile.__version__;
|
|
77
|
-
|
|
78
|
-
argparser = argparse.ArgumentParser(description="Manipulate concatenated files.", conflict_handler="resolve", add_help=True);
|
|
79
|
-
argparser.add_argument("-V", "--version", action="version", version=__program_name__ + " " + __version__);
|
|
80
|
-
argparser.add_argument("-i", "--input", help="Specify the file(s) to concatenate or the concatenated file to extract.", required=True);
|
|
81
|
-
argparser.add_argument("-d", "--verbose", action="store_true", help="Enable verbose mode to display various debugging information.");
|
|
82
|
-
argparser.add_argument("-c", "--create", action="store_true", help="Perform concatenation operation only.");
|
|
83
|
-
argparser.add_argument("-v", "--validate", action="store_true", help="Validate CatFile checksums.");
|
|
84
|
-
argparser.add_argument("-C", "--checksum", default="crc32", help="Specify the type of checksum to use. The default is crc32.");
|
|
85
|
-
argparser.add_argument("-s", "--skipchecksum", action="store_true", help="Skip the checksum check of files.");
|
|
86
|
-
argparser.add_argument("-e", "--extract", action="store_true", help="Perform extraction operation only.");
|
|
87
|
-
argparser.add_argument("-F", "--format", default=__file_format_list__[0], help="Specify the format to use.");
|
|
88
|
-
argparser.add_argument("-D", "--delimiter", default=__file_format_list__[5], help="Specify the delimiter to use.");
|
|
89
|
-
argparser.add_argument("-m", "--formatver", default=__file_format_list__[6], help="Specify the format version.");
|
|
90
|
-
argparser.add_argument("-l", "--list", action="store_true", help="List files included in the concatenated file.");
|
|
91
|
-
argparser.add_argument("-p", "--preserve", action="store_false", help="Preserve permissions and timestamps of files.");
|
|
92
|
-
argparser.add_argument("-R", "--repack", action="store_true", help="Re-concatenate files, fixing checksum errors, if any.");
|
|
93
|
-
argparser.add_argument("-o", "--output", default=None, help="Specify the name for the extracted or output concatenated files.");
|
|
94
|
-
argparser.add_argument("-P", "--compression", default="auto", help="Specify the compression method to use for concatenation.");
|
|
95
|
-
argparser.add_argument("-L", "--level", default=None, help="Specify the compression level for concatenation.");
|
|
96
|
-
argparser.add_argument("-t", "--convert", action="store_true", help="Convert a tar / zip / rar / 7zip file to a CatFile.");
|
|
97
|
-
argparser.add_argument("-T", "--text", action="store_true", help="Read file locations from a text file.");
|
|
98
|
-
getargs = argparser.parse_args()
|
|
99
|
-
|
|
100
|
-
fname = getargs.format;
|
|
101
|
-
fnamelower = fname.lower();
|
|
102
|
-
fnamemagic = fname;
|
|
103
|
-
fnamelen = len(fname);
|
|
104
|
-
fnamehex = binascii.hexlify(fname.encode("UTF-8")).decode("UTF-8");
|
|
105
|
-
fnamesty = __use_new_style__;
|
|
106
|
-
fnamelst = __use_advanced_list__;
|
|
107
|
-
fnameino = __use_alt_inode__;
|
|
108
|
-
fnamelist = [fname, fnamemagic, fnamelower, fnamelen, fnamehex, getargs.delimiter, getargs.formatver, fnamesty, fnamelst, fnameino];
|
|
109
|
-
|
|
110
|
-
# Determine actions based on user input
|
|
111
|
-
should_create = getargs.create and not getargs.extract and not getargs.list;
|
|
112
|
-
should_extract = getargs.extract and not getargs.create and not getargs.list;
|
|
113
|
-
should_list = getargs.list and not getargs.create and not getargs.extract;
|
|
114
|
-
should_repack = getargs.create and getargs.repack;
|
|
115
|
-
should_validate = getargs.validate;
|
|
116
|
-
|
|
117
|
-
# Execute the appropriate functions based on determined actions and arguments
|
|
118
|
-
if should_create:
|
|
119
|
-
if getargs.convert:
|
|
120
|
-
checkcompressfile = pycatfile.CheckCompressionSubType(getargs.input, fnamelist, True);
|
|
121
|
-
if(checkcompressfile=="tarfile"):
|
|
122
|
-
pycatfile.PackArchiveFileFromTarFile(getargs.input, getargs.output, getargs.compression, getargs.level, getargs.checksum, [], fnamelist, getargs.verbose, False);
|
|
123
|
-
elif(checkcompressfile=="zipfile"):
|
|
124
|
-
pycatfile.PackArchiveFileFromZipFile(getargs.input, getargs.output, getargs.compression, getargs.level, getargs.checksum, [], fnamelist, getargs.verbose, False);
|
|
125
|
-
elif(checkcompressfile=="catfile"):
|
|
126
|
-
pycatfile.RePackArchiveFile(getargs.input, getargs.output, getargs.compression, getargs.level, False, 0, 0, getargs.checksum, getargs.skipchecksum, [], fnamelist, getargs.verbose, False);
|
|
127
|
-
elif(rarfile_support and checkcompressfile=="rarfile"):
|
|
128
|
-
pycatfile.PackArchiveFileFromRarFile(getargs.input, getargs.output, getargs.compression, getargs.level, getargs.checksum, [], fnamelist, getargs.verbose, False);
|
|
129
|
-
elif(py7zr_support and checkcompressfile=="7zipfile"):
|
|
130
|
-
pycatfile.PackArchiveFileFromSevenZipFile(getargs.input, getargs.output, getargs.compression, getargs.level, getargs.checksum, [], fnamelist, getargs.verbose, False);
|
|
131
|
-
else:
|
|
132
|
-
sys.exit(1);
|
|
133
|
-
else:
|
|
134
|
-
pycatfile.PackArchiveFile(getargs.input, getargs.output, getargs.text, getargs.compression, getargs.level, False, getargs.checksum, [], fnamelist, getargs.verbose, False);
|
|
135
|
-
|
|
136
|
-
elif should_repack:
|
|
137
|
-
if getargs.convert:
|
|
138
|
-
checkcompressfile = pycatfile.CheckCompressionSubType(getargs.input, fnamelist, True);
|
|
139
|
-
if(checkcompressfile=="tarfile"):
|
|
140
|
-
pycatfile.PackArchiveFileFromTarFile(getargs.input, getargs.output, getargs.compression, getargs.level, getargs.checksum, [], fnamelist, getargs.verbose, False);
|
|
141
|
-
elif(checkcompressfile=="zipfile"):
|
|
142
|
-
pycatfile.PackArchiveFileFromZipFile(getargs.input, getargs.output, getargs.compression, getargs.level, getargs.checksum, [], fnamelist, getargs.verbose, False);
|
|
143
|
-
elif(checkcompressfile=="catfile"):
|
|
144
|
-
pycatfile.RePackArchiveFile(getargs.input, getargs.output, getargs.compression, getargs.level, False, 0, 0, getargs.checksum, getargs.skipchecksum, [], fnamelist, getargs.verbose, False);
|
|
145
|
-
elif(rarfile_support and checkcompressfile=="rarfile"):
|
|
146
|
-
pycatfile.PackArchiveFileFromRarFile(getargs.input, getargs.output, getargs.compression, getargs.level, getargs.checksum, [], fnamelist, getargs.verbose, False);
|
|
147
|
-
elif(py7zr_support and checkcompressfile=="7zipfile"):
|
|
148
|
-
pycatfile.PackArchiveFileFromSevenZipFile(getargs.input, getargs.output, getargs.compression, getargs.level, getargs.checksum, [], fnamelist, getargs.verbose, False);
|
|
149
|
-
else:
|
|
150
|
-
sys.exit(1);
|
|
151
|
-
else:
|
|
152
|
-
pycatfile.RePackArchiveFile(getargs.input, getargs.output, getargs.compression, getargs.level, False, 0, 0, getargs.checksum, getargs.skipchecksum, [], fnamelist, getargs.verbose, False);
|
|
153
|
-
|
|
154
|
-
elif should_extract:
|
|
155
|
-
if getargs.convert:
|
|
156
|
-
checkcompressfile = pycatfile.CheckCompressionSubType(getargs.input, fnamelist, True);
|
|
157
|
-
tempout = BytesIO();
|
|
158
|
-
if(checkcompressfile=="tarfile"):
|
|
159
|
-
pycatfile.PackArchiveFileFromTarFile(getargs.input, tempout, getargs.compression, getargs.level, getargs.checksum, [], fnamelist, getargs.verbose, False);
|
|
160
|
-
elif(checkcompressfile=="zipfile"):
|
|
161
|
-
pycatfile.PackArchiveFileFromZipFile(getargs.input, tempout, getargs.compression, getargs.level, getargs.checksum, [], fnamelist, getargs.verbose, False);
|
|
162
|
-
elif(checkcompressfile=="catfile"):
|
|
163
|
-
pycatfile.RePackArchiveFile(getargs.input, tempout, getargs.compression, getargs.level, False, 0, 0, getargs.checksum, getargs.skipchecksum, [], fnamelist, getargs.verbose, False);
|
|
164
|
-
elif(rarfile_support and checkcompressfile=="rarfile"):
|
|
165
|
-
pycatfile.PackArchiveFileFromRarFile(getargs.input, tempout, getargs.compression, getargs.level, getargs.checksum, [], fnamelist, getargs.verbose, False);
|
|
166
|
-
elif(py7zr_support and checkcompressfile=="7zipfile"):
|
|
167
|
-
pycatfile.PackArchiveFileFromSevenZipFile(getargs.input, tempout, getargs.compression, getargs.level, getargs.checksum, [], fnamelist, getargs.verbose, False);
|
|
168
|
-
else:
|
|
169
|
-
sys.exit(1);
|
|
170
|
-
getargs.input = tempout;
|
|
171
|
-
pycatfile.UnPackArchiveFile(getargs.input, getargs.output, False, 0, 0, getargs.skipchecksum, fnamelist, getargs.verbose, getargs.preserve, getargs.preserve, False);
|
|
172
|
-
|
|
173
|
-
elif should_list:
|
|
174
|
-
if getargs.convert:
|
|
175
|
-
checkcompressfile = pycatfile.CheckCompressionSubType(getargs.input, fnamelist, True);
|
|
176
|
-
if(checkcompressfile=="tarfile"):
|
|
177
|
-
pycatfile.TarFileListFiles(getargs.input, getargs.verbose, False);
|
|
178
|
-
elif(checkcompressfile=="zipfile"):
|
|
179
|
-
pycatfile.ZipFileListFiles(getargs.input, getargs.verbose, False);
|
|
180
|
-
elif(checkcompressfile=="catfile"):
|
|
181
|
-
pycatfile.ArchiveFileListFiles(getargs.input, 0, 0, getargs.skipchecksum, fnamelist, getargs.verbose, False);
|
|
182
|
-
elif(rarfile_support and checkcompressfile=="rarfile"):
|
|
183
|
-
pycatfile.RarFileListFiles(getargs.input, getargs.verbose, False);
|
|
184
|
-
elif(py7zr_support and checkcompressfile=="7zipfile"):
|
|
185
|
-
pycatfile.SevenZipFileListFiles(getargs.input, getargs.verbose, False);
|
|
186
|
-
else:
|
|
187
|
-
sys.exit(1);
|
|
188
|
-
else:
|
|
189
|
-
pycatfile.ArchiveFileListFiles(getargs.input, 0, 0, getargs.skipchecksum, fnamelist, getargs.verbose, False);
|
|
190
|
-
|
|
191
|
-
elif should_validate:
|
|
192
|
-
if getargs.convert:
|
|
193
|
-
checkcompressfile = pycatfile.CheckCompressionSubType(getargs.input, fnamelist, True);
|
|
194
|
-
tempout = BytesIO();
|
|
195
|
-
if(checkcompressfile=="tarfile"):
|
|
196
|
-
pycatfile.PackArchiveFileFromTarFile(getargs.input, tempout, getargs.compression, getargs.level, getargs.checksum, [], fnamelist, getargs.verbose, False);
|
|
197
|
-
elif(checkcompressfile=="zipfile"):
|
|
198
|
-
pycatfile.PackArchiveFileFromZipFile(getargs.input, tempout, getargs.compression, getargs.level, getargs.checksum, [], fnamelist, getargs.verbose, False);
|
|
199
|
-
elif(checkcompressfile=="catfile"):
|
|
200
|
-
pycatfile.RePackArchiveFile(getargs.input, tempout, getargs.compression, getargs.level, False, 0, 0, getargs.checksum, getargs.skipchecksum, [], fnamelist, getargs.verbose, False);
|
|
201
|
-
elif(rarfile_support and checkcompressfile=="rarfile"):
|
|
202
|
-
pycatfile.PackArchiveFileFromRarFile(getargs.input, tempout, getargs.compression, getargs.level, getargs.checksum, [], fnamelist, getargs.verbose, False);
|
|
203
|
-
elif(py7zr_support and checkcompressfile=="7zipfile"):
|
|
204
|
-
pycatfile.PackArchiveFileFromSevenZipFile(getargs.input, tempout, getargs.compression, getargs.level, getargs.checksum, [], fnamelist, getargs.verbose, False);
|
|
205
|
-
else:
|
|
206
|
-
sys.exit(1);
|
|
207
|
-
getargs.input = tempout;
|
|
208
|
-
fvalid = pycatfile.ArchiveFileValidate(getargs.input, fnamelist, getargs.verbose, False);
|
|
209
|
-
if(not getargs.verbose):
|
|
210
|
-
import sys, logging;
|
|
211
|
-
logging.basicConfig(format="%(message)s", stream=sys.stdout, level=logging.DEBUG);
|
|
212
|
-
if(fvalid):
|
|
213
|
-
pycatfile.VerbosePrintOut("File is valid: \n" + str(getargs.input));
|
|
214
|
-
else:
|
|
215
|
-
pycatfile.VerbosePrintOut("File is invalid: \n" + str(getargs.input));
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|