PyCatFile 0.9.6__tar.gz → 0.10.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.
- {pycatfile-0.9.6 → pycatfile-0.10.0}/PKG-INFO +1 -1
- {pycatfile-0.9.6 → pycatfile-0.10.0}/PyCatFile.egg-info/PKG-INFO +1 -1
- {pycatfile-0.9.6 → pycatfile-0.10.0}/catfile.py +1 -1
- {pycatfile-0.9.6 → pycatfile-0.10.0}/neocatfile.py +1 -1
- {pycatfile-0.9.6 → pycatfile-0.10.0}/pycatfile.py +154 -76
- {pycatfile-0.9.6 → pycatfile-0.10.0}/setup.py +1 -1
- {pycatfile-0.9.6 → pycatfile-0.10.0}/LICENSE +0 -0
- {pycatfile-0.9.6 → pycatfile-0.10.0}/PyCatFile.egg-info/SOURCES.txt +0 -0
- {pycatfile-0.9.6 → pycatfile-0.10.0}/PyCatFile.egg-info/dependency_links.txt +0 -0
- {pycatfile-0.9.6 → pycatfile-0.10.0}/PyCatFile.egg-info/top_level.txt +0 -0
- {pycatfile-0.9.6 → pycatfile-0.10.0}/PyCatFile.egg-info/zip-safe +0 -0
- {pycatfile-0.9.6 → pycatfile-0.10.0}/README.md +0 -0
- {pycatfile-0.9.6 → pycatfile-0.10.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: PyCatFile
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.10.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
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: PyCatFile
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.10.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
|
|
@@ -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: catfile.py - Last Update: 5/
|
|
17
|
+
$FileInfo: catfile.py - Last Update: 5/3/2024 Ver. 0.10.0 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: neocatfile.py - Last Update: 5/
|
|
17
|
+
$FileInfo: neocatfile.py - Last Update: 5/3/2024 Ver. 0.10.0 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: 5/
|
|
17
|
+
$FileInfo: pycatfile.py - Last Update: 5/3/2024 Ver. 0.10.0 RC 1 - Author: cooldude2k $
|
|
18
18
|
'''
|
|
19
19
|
|
|
20
20
|
from __future__ import absolute_import, division, print_function, unicode_literals;
|
|
@@ -75,18 +75,18 @@ except ImportError:
|
|
|
75
75
|
py7zr_support = False;
|
|
76
76
|
|
|
77
77
|
try:
|
|
78
|
-
from
|
|
78
|
+
from xtarfile import is_tarfile;
|
|
79
79
|
except ImportError:
|
|
80
80
|
try:
|
|
81
|
-
from
|
|
81
|
+
from safetar import is_tarfile;
|
|
82
82
|
except ImportError:
|
|
83
83
|
from tarfile import is_tarfile;
|
|
84
84
|
|
|
85
85
|
try:
|
|
86
|
-
import
|
|
86
|
+
import xtarfile as tarfile;
|
|
87
87
|
except ImportError:
|
|
88
88
|
try:
|
|
89
|
-
import
|
|
89
|
+
import safetar as tarfile;
|
|
90
90
|
except ImportError:
|
|
91
91
|
import tarfile;
|
|
92
92
|
|
|
@@ -174,11 +174,11 @@ __use_alt_inode__ = False;
|
|
|
174
174
|
__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__];
|
|
175
175
|
__project__ = __program_name__;
|
|
176
176
|
__project_url__ = "https://github.com/GameMaker2k/PyCatFile";
|
|
177
|
-
__version_info__ = (0,
|
|
178
|
-
__version_date_info__ = (2024, 5,
|
|
177
|
+
__version_info__ = (0, 10, 0, "RC 1", 1);
|
|
178
|
+
__version_date_info__ = (2024, 5, 3, "RC 1", 1);
|
|
179
179
|
__version_date__ = str(__version_date_info__[0]) + "." + str(__version_date_info__[1]).zfill(2) + "." + str(__version_date_info__[2]).zfill(2);
|
|
180
180
|
__revision__ = __version_info__[3];
|
|
181
|
-
__revision_id__ = "$Id:
|
|
181
|
+
__revision_id__ = "$Id: 315654f0f21d3dcfe5c3339c8c23806a723ff64f $";
|
|
182
182
|
if(__version_info__[4] is not None):
|
|
183
183
|
__version_date_plusrc__ = __version_date__ + "-" + str(__version_date_info__[4]);
|
|
184
184
|
if(__version_info__[4] is None):
|
|
@@ -1205,6 +1205,8 @@ def AppendFileHeader(fp, numfiles, checksumtype="crc32", formatspecs=__file_form
|
|
|
1205
1205
|
pass;
|
|
1206
1206
|
except AttributeError:
|
|
1207
1207
|
pass;
|
|
1208
|
+
except OSError as e:
|
|
1209
|
+
pass;
|
|
1208
1210
|
return fp;
|
|
1209
1211
|
|
|
1210
1212
|
def MakeEmptyFilePointer(fp, checksumtype="crc32", formatspecs=__file_format_list__):
|
|
@@ -1214,7 +1216,10 @@ def MakeEmptyFilePointer(fp, checksumtype="crc32", formatspecs=__file_format_lis
|
|
|
1214
1216
|
def MakeEmptyFile(outfile, compression="auto", compressionlevel=None, checksumtype="crc32", formatspecs=__file_format_list__, returnfp=False):
|
|
1215
1217
|
if(outfile!="-" and not hasattr(outfile, "read") and not hasattr(outfile, "write")):
|
|
1216
1218
|
if(os.path.exists(outfile)):
|
|
1217
|
-
|
|
1219
|
+
try:
|
|
1220
|
+
os.unlink(outfile);
|
|
1221
|
+
except OSError as e:
|
|
1222
|
+
pass;
|
|
1218
1223
|
if(outfile=="-"):
|
|
1219
1224
|
verbose = False;
|
|
1220
1225
|
catfpfp = BytesIO();
|
|
@@ -1228,7 +1233,7 @@ def MakeEmptyFile(outfile, compression="auto", compressionlevel=None, checksumty
|
|
|
1228
1233
|
catfp = CompressOpenFile(outfile, compressionlevel);
|
|
1229
1234
|
catfp = AppendFileHeader(catfp, 0, checksumtype, formatspecs);
|
|
1230
1235
|
if(outfile=="-" or hasattr(outfile, "read") or hasattr(outfile, "write")):
|
|
1231
|
-
catfp = CompressArchiveFile(catfp, compression, formatspecs);
|
|
1236
|
+
catfp = CompressArchiveFile(catfp, compression, compressionlevel, formatspecs);
|
|
1232
1237
|
try:
|
|
1233
1238
|
catfp.flush();
|
|
1234
1239
|
os.fsync(catfp.fileno());
|
|
@@ -1236,6 +1241,8 @@ def MakeEmptyFile(outfile, compression="auto", compressionlevel=None, checksumty
|
|
|
1236
1241
|
pass;
|
|
1237
1242
|
except AttributeError:
|
|
1238
1243
|
pass;
|
|
1244
|
+
except OSError as e:
|
|
1245
|
+
pass;
|
|
1239
1246
|
if(outfile=="-"):
|
|
1240
1247
|
catfp.seek(0, 0);
|
|
1241
1248
|
if(hasattr(sys.stdout, "buffer")):
|
|
@@ -1243,7 +1250,7 @@ def MakeEmptyFile(outfile, compression="auto", compressionlevel=None, checksumty
|
|
|
1243
1250
|
else:
|
|
1244
1251
|
shutil.copyfileobj(catfp, sys.stdout);
|
|
1245
1252
|
elif(re.findall(r"^(ftp|ftps|sftp)\:\/\/", str(outfile))):
|
|
1246
|
-
catfp = CompressArchiveFile(catfp, compression, formatspecs);
|
|
1253
|
+
catfp = CompressArchiveFile(catfp, compression, compressionlevel, formatspecs);
|
|
1247
1254
|
catfp.seek(0, 0);
|
|
1248
1255
|
upload_file_to_internet_file(catfp, outfile);
|
|
1249
1256
|
if(returnfp):
|
|
@@ -1287,6 +1294,8 @@ def AppendFileHeaderWithContent(fp, filevalues=[], extradata=[], filecontent="",
|
|
|
1287
1294
|
pass;
|
|
1288
1295
|
except AttributeError:
|
|
1289
1296
|
pass;
|
|
1297
|
+
except OSError as e:
|
|
1298
|
+
pass;
|
|
1290
1299
|
return fp;
|
|
1291
1300
|
|
|
1292
1301
|
def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, filevalues=[], extradata=[], followlink=False, checksumtype="crc32", formatspecs=__file_format_list__, verbose=False):
|
|
@@ -1326,7 +1335,6 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, filevalues=[], ext
|
|
|
1326
1335
|
fnumfiles = format(numfiles, 'x').lower();
|
|
1327
1336
|
AppendFileHeader(fp, fnumfiles, checksumtype, formatspecs);
|
|
1328
1337
|
for curfname in GetDirList:
|
|
1329
|
-
catfhstart = fp.tell();
|
|
1330
1338
|
if(re.findall("^[.|/]", curfname)):
|
|
1331
1339
|
fname = curfname;
|
|
1332
1340
|
else:
|
|
@@ -1525,7 +1533,10 @@ def AppendInFileWithContent(infile, fp, dirlistfromtxt=False, filevalues=[], ext
|
|
|
1525
1533
|
def AppendFilesWithContentToOutFile(infiles, outfile, dirlistfromtxt=False, compression="auto", compressionlevel=None, filevalues=[], extradata=[], followlink=False, checksumtype="crc32", formatspecs=__file_format_list__, verbose=False, returnfp=False):
|
|
1526
1534
|
if(outfile!="-" and not hasattr(outfile, "read") and not hasattr(outfile, "write")):
|
|
1527
1535
|
if(os.path.exists(outfile)):
|
|
1528
|
-
|
|
1536
|
+
try:
|
|
1537
|
+
os.unlink(outfile);
|
|
1538
|
+
except OSError as e:
|
|
1539
|
+
pass;
|
|
1529
1540
|
if(outfile=="-"):
|
|
1530
1541
|
verbose = False;
|
|
1531
1542
|
catfpfp = BytesIO();
|
|
@@ -1539,7 +1550,7 @@ def AppendFilesWithContentToOutFile(infiles, outfile, dirlistfromtxt=False, comp
|
|
|
1539
1550
|
catfp = CompressOpenFile(outfile, compressionlevel);
|
|
1540
1551
|
catfp = AppendFilesWithContent(infiles, catfp, dirlistfromtxt, filevalues, extradata, followlink, checksumtype, formatspecs, verbose);
|
|
1541
1552
|
if(outfile=="-" or hasattr(outfile, "read") or hasattr(outfile, "write")):
|
|
1542
|
-
catfp = CompressArchiveFile(catfp, compression, formatspecs);
|
|
1553
|
+
catfp = CompressArchiveFile(catfp, compression, compressionlevel, formatspecs);
|
|
1543
1554
|
try:
|
|
1544
1555
|
catfp.flush();
|
|
1545
1556
|
os.fsync(catfp.fileno());
|
|
@@ -1547,6 +1558,8 @@ def AppendFilesWithContentToOutFile(infiles, outfile, dirlistfromtxt=False, comp
|
|
|
1547
1558
|
pass;
|
|
1548
1559
|
except AttributeError:
|
|
1549
1560
|
pass;
|
|
1561
|
+
except OSError as e:
|
|
1562
|
+
pass;
|
|
1550
1563
|
if(outfile=="-"):
|
|
1551
1564
|
catfp.seek(0, 0);
|
|
1552
1565
|
if(hasattr(sys.stdout, "buffer")):
|
|
@@ -1554,7 +1567,7 @@ def AppendFilesWithContentToOutFile(infiles, outfile, dirlistfromtxt=False, comp
|
|
|
1554
1567
|
else:
|
|
1555
1568
|
shutil.copyfileobj(catfp, sys.stdout);
|
|
1556
1569
|
elif(re.findall(r"^(ftp|ftps|sftp)\:\/\/", str(outfile))):
|
|
1557
|
-
catfp = CompressArchiveFile(catfp, compression, formatspecs);
|
|
1570
|
+
catfp = CompressArchiveFile(catfp, compression, compressionlevel, formatspecs);
|
|
1558
1571
|
catfp.seek(0, 0);
|
|
1559
1572
|
upload_file_to_internet_file(catfp, outfile);
|
|
1560
1573
|
if(returnfp):
|
|
@@ -1567,7 +1580,10 @@ def AppendFilesWithContentToOutFile(infiles, outfile, dirlistfromtxt=False, comp
|
|
|
1567
1580
|
def AppendListsWithContentToOutFile(inlist, outfile, dirlistfromtxt=False, compression="auto", compressionlevel=None, filevalues=[], extradata=[], followlink=False, checksumtype="crc32", formatspecs=__file_format_list__, verbose=False, returnfp=False):
|
|
1568
1581
|
if(outfile!="-" and not hasattr(outfile, "read") and not hasattr(outfile, "write")):
|
|
1569
1582
|
if(os.path.exists(outfile)):
|
|
1570
|
-
|
|
1583
|
+
try:
|
|
1584
|
+
os.unlink(outfile);
|
|
1585
|
+
except OSError as e:
|
|
1586
|
+
pass;
|
|
1571
1587
|
if(outfile=="-"):
|
|
1572
1588
|
verbose = False;
|
|
1573
1589
|
catfpfp = BytesIO();
|
|
@@ -1581,7 +1597,7 @@ def AppendListsWithContentToOutFile(inlist, outfile, dirlistfromtxt=False, compr
|
|
|
1581
1597
|
catfp = CompressOpenFile(outfile, compressionlevel);
|
|
1582
1598
|
catfp = AppendListsWithContent(inlist, catfp, dirlistfromtxt, filevalues, extradata, followlink, checksumtype, formatspecs, verbose);
|
|
1583
1599
|
if(outfile=="-" or hasattr(outfile, "read") or hasattr(outfile, "write")):
|
|
1584
|
-
catfp = CompressArchiveFile(catfp, compression, formatspecs);
|
|
1600
|
+
catfp = CompressArchiveFile(catfp, compression, compressionlevel, formatspecs);
|
|
1585
1601
|
try:
|
|
1586
1602
|
catfp.flush();
|
|
1587
1603
|
os.fsync(catfp.fileno());
|
|
@@ -1589,6 +1605,8 @@ def AppendListsWithContentToOutFile(inlist, outfile, dirlistfromtxt=False, compr
|
|
|
1589
1605
|
pass;
|
|
1590
1606
|
except AttributeError:
|
|
1591
1607
|
pass;
|
|
1608
|
+
except OSError as e:
|
|
1609
|
+
pass;
|
|
1592
1610
|
if(outfile=="-"):
|
|
1593
1611
|
catfp.seek(0, 0);
|
|
1594
1612
|
if(hasattr(sys.stdout, "buffer")):
|
|
@@ -1596,7 +1614,7 @@ def AppendListsWithContentToOutFile(inlist, outfile, dirlistfromtxt=False, compr
|
|
|
1596
1614
|
else:
|
|
1597
1615
|
shutil.copyfileobj(catfp, sys.stdout);
|
|
1598
1616
|
elif(re.findall(r"^(ftp|ftps|sftp)\:\/\/", str(outfile))):
|
|
1599
|
-
catfp = CompressArchiveFile(catfp, compression, formatspecs);
|
|
1617
|
+
catfp = CompressArchiveFile(catfp, compression, compressionlevel, formatspecs);
|
|
1600
1618
|
catfp.seek(0, 0);
|
|
1601
1619
|
upload_file_to_internet_file(catfp, outfile);
|
|
1602
1620
|
if(returnfp):
|
|
@@ -1762,6 +1780,19 @@ def CheckCompressionType(infile, formatspecs=__file_format_list__, closefp=True)
|
|
|
1762
1780
|
if(prefp==binascii.unhexlify("7061785f676c6f62616c")):
|
|
1763
1781
|
filetype = "tarfile";
|
|
1764
1782
|
catfp.seek(0, 0);
|
|
1783
|
+
if(filetype=="gzip" or filetype=="bzip2" or filetype=="lzma" or filetype=="zstd" or filetype=="lz4"):
|
|
1784
|
+
if(is_tarfile(catfp)):
|
|
1785
|
+
filetype = "tarfile";
|
|
1786
|
+
if(not filetype):
|
|
1787
|
+
if(is_tarfile(catfp)):
|
|
1788
|
+
filetype = "tarfile";
|
|
1789
|
+
elif(zipfile.is_zipfile(catfp)):
|
|
1790
|
+
filetype = "zipfile";
|
|
1791
|
+
elif(rarfile.is_rarfile(catfp) or rarfile.is_rarfile_sfx(catfp)):
|
|
1792
|
+
filetype = "rarile";
|
|
1793
|
+
else:
|
|
1794
|
+
filetype = False;
|
|
1795
|
+
catfp.seek(0, 0);
|
|
1765
1796
|
if(closefp):
|
|
1766
1797
|
catfp.close();
|
|
1767
1798
|
return filetype;
|
|
@@ -2002,7 +2033,18 @@ def CheckCompressionSubType(infile, formatspecs=__file_format_list__, closefp=Tr
|
|
|
2002
2033
|
compresscheck = "lzma";
|
|
2003
2034
|
else:
|
|
2004
2035
|
return False;
|
|
2036
|
+
if(compresscheck=="gzip" or compresscheck=="bzip2" or compresscheck=="lzma" or compresscheck=="zstd" or compresscheck=="lz4"):
|
|
2037
|
+
if(is_tarfile(infile)):
|
|
2038
|
+
filetype = "tarfile";
|
|
2005
2039
|
if(not compresscheck):
|
|
2040
|
+
if(is_tarfile(infile)):
|
|
2041
|
+
return "tarfile";
|
|
2042
|
+
elif(zipfile.is_zipfile(infile)):
|
|
2043
|
+
return "zipfile";
|
|
2044
|
+
elif(rarfile.is_rarfile(infile) or rarfile.is_rarfile_sfx(infile)):
|
|
2045
|
+
return "rarile";
|
|
2046
|
+
else:
|
|
2047
|
+
return False;
|
|
2006
2048
|
return False;
|
|
2007
2049
|
if(compresscheck=="catfile"):
|
|
2008
2050
|
return "catfile";
|
|
@@ -2323,7 +2365,10 @@ def PackArchiveFile(infiles, outfile, dirlistfromtxt=False, compression="auto",
|
|
|
2323
2365
|
logging.basicConfig(format="%(message)s", stream=sys.stdout, level=logging.DEBUG);
|
|
2324
2366
|
if(outfile!="-" and not hasattr(outfile, "read") and not hasattr(outfile, "write")):
|
|
2325
2367
|
if(os.path.exists(outfile)):
|
|
2326
|
-
|
|
2368
|
+
try:
|
|
2369
|
+
os.unlink(outfile);
|
|
2370
|
+
except OSError as e:
|
|
2371
|
+
pass;
|
|
2327
2372
|
if(outfile=="-"):
|
|
2328
2373
|
verbose = False;
|
|
2329
2374
|
catfp = BytesIO();
|
|
@@ -2381,8 +2426,9 @@ def PackArchiveFile(infiles, outfile, dirlistfromtxt=False, compression="auto",
|
|
|
2381
2426
|
pass;
|
|
2382
2427
|
except AttributeError:
|
|
2383
2428
|
pass;
|
|
2429
|
+
except OSError as e:
|
|
2430
|
+
pass;
|
|
2384
2431
|
for curfname in GetDirList:
|
|
2385
|
-
catfhstart = catfp.tell();
|
|
2386
2432
|
if(re.findall("^[.|/]", curfname)):
|
|
2387
2433
|
fname = curfname;
|
|
2388
2434
|
else:
|
|
@@ -2536,13 +2582,10 @@ def PackArchiveFile(infiles, outfile, dirlistfromtxt=False, compression="auto",
|
|
|
2536
2582
|
catfileoutstr = AppendNullByte(catheaersize, formatspecs[5]) + catfileoutstr;
|
|
2537
2583
|
catfileheadercshex = GetFileChecksum(catfileoutstr, checksumtype, True, formatspecs);
|
|
2538
2584
|
catfileoutstr = catfileoutstr + AppendNullBytes([catfileheadercshex, catfilecontentcshex], formatspecs[5]);
|
|
2539
|
-
catfhend = (catfp.tell() - 1) + len(catfileoutstr);
|
|
2540
|
-
catfcontentstart = catfp.tell() + len(catfileoutstr);
|
|
2541
2585
|
catfileoutstrecd = catfileoutstr.encode('UTF-8');
|
|
2542
2586
|
nullstrecd = formatspecs[5].encode('UTF-8');
|
|
2543
2587
|
fcontents.seek(0, 0);
|
|
2544
2588
|
catfileout = catfileoutstrecd + fcontents.read() + nullstrecd;
|
|
2545
|
-
catfcontentend = (catfp.tell() - 1) + len(catfileout);
|
|
2546
2589
|
catfp.write(catfileout);
|
|
2547
2590
|
try:
|
|
2548
2591
|
catfp.flush();
|
|
@@ -2551,10 +2594,12 @@ def PackArchiveFile(infiles, outfile, dirlistfromtxt=False, compression="auto",
|
|
|
2551
2594
|
pass;
|
|
2552
2595
|
except AttributeError:
|
|
2553
2596
|
pass;
|
|
2597
|
+
except OSError as e:
|
|
2598
|
+
pass;
|
|
2554
2599
|
if(numfiles>0):
|
|
2555
2600
|
catfp.write(AppendNullBytes([0, 0], formatspecs[5]).encode("UTF-8"));
|
|
2556
2601
|
if(outfile=="-" or hasattr(outfile, "read") or hasattr(outfile, "write")):
|
|
2557
|
-
catfp = CompressArchiveFile(catfp, compression, formatspecs);
|
|
2602
|
+
catfp = CompressArchiveFile(catfp, compression, compressionlevel, formatspecs);
|
|
2558
2603
|
try:
|
|
2559
2604
|
catfp.flush();
|
|
2560
2605
|
os.fsync(catfp.fileno());
|
|
@@ -2562,6 +2607,8 @@ def PackArchiveFile(infiles, outfile, dirlistfromtxt=False, compression="auto",
|
|
|
2562
2607
|
pass;
|
|
2563
2608
|
except AttributeError:
|
|
2564
2609
|
pass;
|
|
2610
|
+
except OSError as e:
|
|
2611
|
+
pass;
|
|
2565
2612
|
if(outfile=="-"):
|
|
2566
2613
|
catfp.seek(0, 0);
|
|
2567
2614
|
if(hasattr(sys.stdout, "buffer")):
|
|
@@ -2569,7 +2616,7 @@ def PackArchiveFile(infiles, outfile, dirlistfromtxt=False, compression="auto",
|
|
|
2569
2616
|
else:
|
|
2570
2617
|
shutil.copyfileobj(catfp, sys.stdout);
|
|
2571
2618
|
elif(re.findall(r"^(ftp|ftps|sftp)\:\/\/", str(outfile))):
|
|
2572
|
-
catfp = CompressArchiveFile(catfp, compression, formatspecs);
|
|
2619
|
+
catfp = CompressArchiveFile(catfp, compression, compressionlevel, formatspecs);
|
|
2573
2620
|
catfp.seek(0, 0);
|
|
2574
2621
|
upload_file_to_internet_file(catfp, outfile);
|
|
2575
2622
|
if(returnfp):
|
|
@@ -2607,7 +2654,10 @@ def PackArchiveFileFromTarFile(infile, outfile, compression="auto", compressionl
|
|
|
2607
2654
|
logging.basicConfig(format="%(message)s", stream=sys.stdout, level=logging.DEBUG);
|
|
2608
2655
|
if(outfile!="-" and not hasattr(outfile, "read") and not hasattr(outfile, "write")):
|
|
2609
2656
|
if(os.path.exists(outfile)):
|
|
2610
|
-
|
|
2657
|
+
try:
|
|
2658
|
+
os.unlink(outfile);
|
|
2659
|
+
except OSError as e:
|
|
2660
|
+
pass;
|
|
2611
2661
|
if(outfile=="-"):
|
|
2612
2662
|
verbose = False;
|
|
2613
2663
|
catfp = BytesIO();
|
|
@@ -2676,8 +2726,9 @@ def PackArchiveFileFromTarFile(infile, outfile, compression="auto", compressionl
|
|
|
2676
2726
|
pass;
|
|
2677
2727
|
except AttributeError:
|
|
2678
2728
|
pass;
|
|
2729
|
+
except OSError as e:
|
|
2730
|
+
pass;
|
|
2679
2731
|
for member in sorted(tarfp.getmembers(), key=lambda x: x.name):
|
|
2680
|
-
catfhstart = catfp.tell();
|
|
2681
2732
|
if(re.findall("^[.|/]", member.name)):
|
|
2682
2733
|
fname = member.name;
|
|
2683
2734
|
else:
|
|
@@ -2766,8 +2817,6 @@ def PackArchiveFileFromTarFile(infile, outfile, compression="auto", compressionl
|
|
|
2766
2817
|
if(len(extradata)>0):
|
|
2767
2818
|
catfileoutstr = catfileoutstr + AppendNullBytes(extradata, formatspecs[5]);
|
|
2768
2819
|
catfileoutstr = catfileoutstr + AppendNullByte(checksumtype, formatspecs[5]);
|
|
2769
|
-
catfhend = (catfp.tell() - 1) + len(catfileoutstr);
|
|
2770
|
-
catfcontentstart = catfp.tell() + len(catfileoutstr);
|
|
2771
2820
|
catfileheadercshex = GetFileChecksum(catfileoutstr, checksumtype, True, formatspecs);
|
|
2772
2821
|
fcontents.seek(0, 0);
|
|
2773
2822
|
catfilecontentcshex = GetFileChecksum(fcontents.read(), checksumtype, False, formatspecs);
|
|
@@ -2780,7 +2829,6 @@ def PackArchiveFileFromTarFile(infile, outfile, compression="auto", compressionl
|
|
|
2780
2829
|
nullstrecd = formatspecs[5].encode('UTF-8');
|
|
2781
2830
|
fcontents.seek(0, 0);
|
|
2782
2831
|
catfileout = catfileoutstrecd + fcontents.read() + nullstrecd;
|
|
2783
|
-
catfcontentend = (catfp.tell() - 1) + len(catfileout);
|
|
2784
2832
|
catfp.write(catfileout);
|
|
2785
2833
|
try:
|
|
2786
2834
|
catfp.flush();
|
|
@@ -2789,10 +2837,12 @@ def PackArchiveFileFromTarFile(infile, outfile, compression="auto", compressionl
|
|
|
2789
2837
|
pass;
|
|
2790
2838
|
except AttributeError:
|
|
2791
2839
|
pass;
|
|
2840
|
+
except OSError as e:
|
|
2841
|
+
pass;
|
|
2792
2842
|
if(numfiles>0):
|
|
2793
2843
|
catfp.write(AppendNullBytes([0, 0], formatspecs[5]).encode("UTF-8"));
|
|
2794
2844
|
if(outfile=="-" or hasattr(outfile, "read") or hasattr(outfile, "write")):
|
|
2795
|
-
catfp = CompressArchiveFile(catfp, compression, formatspecs);
|
|
2845
|
+
catfp = CompressArchiveFile(catfp, compression, compressionlevel, formatspecs);
|
|
2796
2846
|
try:
|
|
2797
2847
|
catfp.flush();
|
|
2798
2848
|
os.fsync(catfp.fileno());
|
|
@@ -2800,6 +2850,8 @@ def PackArchiveFileFromTarFile(infile, outfile, compression="auto", compressionl
|
|
|
2800
2850
|
pass;
|
|
2801
2851
|
except AttributeError:
|
|
2802
2852
|
pass;
|
|
2853
|
+
except OSError as e:
|
|
2854
|
+
pass;
|
|
2803
2855
|
if(outfile=="-"):
|
|
2804
2856
|
catfp.seek(0, 0);
|
|
2805
2857
|
if(hasattr(sys.stdout, "buffer")):
|
|
@@ -2807,7 +2859,7 @@ def PackArchiveFileFromTarFile(infile, outfile, compression="auto", compressionl
|
|
|
2807
2859
|
else:
|
|
2808
2860
|
shutil.copyfileobj(catfp, sys.stdout);
|
|
2809
2861
|
elif(re.findall(r"^(ftp|ftps|sftp)\:\/\/", str(outfile))):
|
|
2810
|
-
catfp = CompressArchiveFile(catfp, compression, formatspecs);
|
|
2862
|
+
catfp = CompressArchiveFile(catfp, compression, compressionlevel, formatspecs);
|
|
2811
2863
|
catfp.seek(0, 0);
|
|
2812
2864
|
upload_file_to_internet_file(catfp, outfile);
|
|
2813
2865
|
if(returnfp):
|
|
@@ -2835,7 +2887,10 @@ def PackArchiveFileFromZipFile(infile, outfile, compression="auto", compressionl
|
|
|
2835
2887
|
logging.basicConfig(format="%(message)s", stream=sys.stdout, level=logging.DEBUG);
|
|
2836
2888
|
if(outfile!="-" and not hasattr(outfile, "read") and not hasattr(outfile, "write")):
|
|
2837
2889
|
if(os.path.exists(outfile)):
|
|
2838
|
-
|
|
2890
|
+
try:
|
|
2891
|
+
os.unlink(outfile);
|
|
2892
|
+
except OSError as e:
|
|
2893
|
+
pass;
|
|
2839
2894
|
if(outfile=="-"):
|
|
2840
2895
|
verbose = False;
|
|
2841
2896
|
catfp = BytesIO();
|
|
@@ -2899,8 +2954,9 @@ def PackArchiveFileFromZipFile(infile, outfile, compression="auto", compressionl
|
|
|
2899
2954
|
pass;
|
|
2900
2955
|
except AttributeError:
|
|
2901
2956
|
pass;
|
|
2957
|
+
except OSError as e:
|
|
2958
|
+
pass;
|
|
2902
2959
|
for member in sorted(zipfp.infolist(), key=lambda x: x.filename):
|
|
2903
|
-
catfhstart = catfp.tell();
|
|
2904
2960
|
if(re.findall("^[.|/]", member.filename)):
|
|
2905
2961
|
fname = member.filename;
|
|
2906
2962
|
else:
|
|
@@ -3014,8 +3070,6 @@ def PackArchiveFileFromZipFile(infile, outfile, compression="auto", compressionl
|
|
|
3014
3070
|
if(len(extradata)>0):
|
|
3015
3071
|
catfileoutstr = catfileoutstr + AppendNullBytes(extradata, formatspecs[5]);
|
|
3016
3072
|
catfileoutstr = catfileoutstr + AppendNullByte(checksumtype, formatspecs[5]);
|
|
3017
|
-
catfhend = (catfp.tell() - 1) + len(catfileoutstr);
|
|
3018
|
-
catfcontentstart = catfp.tell() + len(catfileoutstr);
|
|
3019
3073
|
catfileheadercshex = GetFileChecksum(catfileoutstr, checksumtype, True, formatspecs);
|
|
3020
3074
|
fcontents.seek(0, 0);
|
|
3021
3075
|
catfilecontentcshex = GetFileChecksum(fcontents.read(), checksumtype, False, formatspecs);
|
|
@@ -3028,7 +3082,6 @@ def PackArchiveFileFromZipFile(infile, outfile, compression="auto", compressionl
|
|
|
3028
3082
|
nullstrecd = formatspecs[5].encode('UTF-8');
|
|
3029
3083
|
fcontents.seek(0, 0);
|
|
3030
3084
|
catfileout = catfileoutstrecd + fcontents.read() + nullstrecd;
|
|
3031
|
-
catfcontentend = (catfp.tell() - 1) + len(catfileout);
|
|
3032
3085
|
catfp.write(catfileout);
|
|
3033
3086
|
try:
|
|
3034
3087
|
catfp.flush();
|
|
@@ -3037,10 +3090,12 @@ def PackArchiveFileFromZipFile(infile, outfile, compression="auto", compressionl
|
|
|
3037
3090
|
pass;
|
|
3038
3091
|
except AttributeError:
|
|
3039
3092
|
pass;
|
|
3093
|
+
except OSError as e:
|
|
3094
|
+
pass;
|
|
3040
3095
|
if(numfiles>0):
|
|
3041
3096
|
catfp.write(AppendNullBytes([0, 0], formatspecs[5]).encode("UTF-8"));
|
|
3042
3097
|
if(outfile=="-" or hasattr(outfile, "read") or hasattr(outfile, "write")):
|
|
3043
|
-
catfp = CompressArchiveFile(catfp, compression, formatspecs);
|
|
3098
|
+
catfp = CompressArchiveFile(catfp, compression, compressionlevel, formatspecs);
|
|
3044
3099
|
try:
|
|
3045
3100
|
catfp.flush();
|
|
3046
3101
|
os.fsync(catfp.fileno());
|
|
@@ -3048,6 +3103,8 @@ def PackArchiveFileFromZipFile(infile, outfile, compression="auto", compressionl
|
|
|
3048
3103
|
pass;
|
|
3049
3104
|
except AttributeError:
|
|
3050
3105
|
pass;
|
|
3106
|
+
except OSError as e:
|
|
3107
|
+
pass;
|
|
3051
3108
|
if(outfile=="-"):
|
|
3052
3109
|
catfp.seek(0, 0);
|
|
3053
3110
|
if(hasattr(sys.stdout, "buffer")):
|
|
@@ -3055,7 +3112,7 @@ def PackArchiveFileFromZipFile(infile, outfile, compression="auto", compressionl
|
|
|
3055
3112
|
else:
|
|
3056
3113
|
shutil.copyfileobj(catfp, sys.stdout);
|
|
3057
3114
|
elif(re.findall(r"^(ftp|ftps|sftp)\:\/\/", str(outfile))):
|
|
3058
|
-
catfp = CompressArchiveFile(catfp, compression, formatspecs);
|
|
3115
|
+
catfp = CompressArchiveFile(catfp, compression, compressionlevel, formatspecs);
|
|
3059
3116
|
catfp.seek(0, 0);
|
|
3060
3117
|
upload_file_to_internet_file(catfp, outfile);
|
|
3061
3118
|
if(returnfp):
|
|
@@ -3088,7 +3145,10 @@ if(rarfile_support):
|
|
|
3088
3145
|
logging.basicConfig(format="%(message)s", stream=sys.stdout, level=logging.DEBUG);
|
|
3089
3146
|
if(outfile!="-" and not hasattr(outfile, "read") and not hasattr(outfile, "write")):
|
|
3090
3147
|
if(os.path.exists(outfile)):
|
|
3091
|
-
|
|
3148
|
+
try:
|
|
3149
|
+
os.unlink(outfile);
|
|
3150
|
+
except OSError as e:
|
|
3151
|
+
pass;
|
|
3092
3152
|
if(outfile=="-"):
|
|
3093
3153
|
verbose = False;
|
|
3094
3154
|
catfp = BytesIO();
|
|
@@ -3131,6 +3191,8 @@ if(rarfile_support):
|
|
|
3131
3191
|
pass;
|
|
3132
3192
|
except AttributeError:
|
|
3133
3193
|
pass;
|
|
3194
|
+
except OSError as e:
|
|
3195
|
+
pass;
|
|
3134
3196
|
for member in sorted(rarfp.infolist(), key=lambda x: x.filename):
|
|
3135
3197
|
is_unix = False;
|
|
3136
3198
|
is_windows = False;
|
|
@@ -3151,7 +3213,6 @@ if(rarfile_support):
|
|
|
3151
3213
|
else:
|
|
3152
3214
|
is_unix = False;
|
|
3153
3215
|
is_windows = False;
|
|
3154
|
-
catfhstart = catfp.tell();
|
|
3155
3216
|
if(re.findall("^[.|/]", member.filename)):
|
|
3156
3217
|
fname = member.filename;
|
|
3157
3218
|
else:
|
|
@@ -3280,8 +3341,6 @@ if(rarfile_support):
|
|
|
3280
3341
|
if(len(extradata)>0):
|
|
3281
3342
|
catfileoutstr = catfileoutstr + AppendNullBytes(extradata, formatspecs[5]);
|
|
3282
3343
|
catfileoutstr = catfileoutstr + AppendNullByte(checksumtype, formatspecs[5]);
|
|
3283
|
-
catfhend = (catfp.tell() - 1) + len(catfileoutstr);
|
|
3284
|
-
catfcontentstart = catfp.tell() + len(catfileoutstr);
|
|
3285
3344
|
catfileheadercshex = GetFileChecksum(catfileoutstr, checksumtype, True, formatspecs);
|
|
3286
3345
|
fcontents.seek(0, 0);
|
|
3287
3346
|
catfilecontentcshex = GetFileChecksum(fcontents.read(), checksumtype, False, formatspecs);
|
|
@@ -3294,26 +3353,29 @@ if(rarfile_support):
|
|
|
3294
3353
|
nullstrecd = formatspecs[5].encode('UTF-8');
|
|
3295
3354
|
fcontents.seek(0, 0);
|
|
3296
3355
|
catfileout = catfileoutstrecd + fcontents.read() + nullstrecd;
|
|
3297
|
-
catfcontentend = (catfp.tell() - 1) + len(catfileout);
|
|
3298
3356
|
catfp.write(catfileout);
|
|
3299
3357
|
try:
|
|
3300
3358
|
catfp.flush();
|
|
3301
3359
|
os.fsync(catfp.fileno());
|
|
3302
3360
|
except io.UnsupportedOperation:
|
|
3303
|
-
pass
|
|
3361
|
+
pass;
|
|
3304
3362
|
except AttributeError:
|
|
3305
|
-
pass
|
|
3363
|
+
pass;
|
|
3364
|
+
except OSError as e:
|
|
3365
|
+
pass;
|
|
3306
3366
|
if(numfiles>0):
|
|
3307
3367
|
catfp.write(AppendNullBytes([0, 0], formatspecs[5]).encode("UTF-8"));
|
|
3308
3368
|
if(outfile=="-" or hasattr(outfile, "read") or hasattr(outfile, "write")):
|
|
3309
|
-
catfp = CompressArchiveFile(catfp, compression, formatspecs)
|
|
3369
|
+
catfp = CompressArchiveFile(catfp, compression, compressionlevel, formatspecs)
|
|
3310
3370
|
try:
|
|
3311
3371
|
catfp.flush();
|
|
3312
3372
|
os.fsync(catfp.fileno());
|
|
3313
3373
|
except io.UnsupportedOperation:
|
|
3314
|
-
pass
|
|
3374
|
+
pass;
|
|
3315
3375
|
except AttributeError:
|
|
3316
|
-
pass
|
|
3376
|
+
pass;
|
|
3377
|
+
except OSError as e:
|
|
3378
|
+
pass;
|
|
3317
3379
|
if(outfile=="-"):
|
|
3318
3380
|
catfp.seek(0, 0)
|
|
3319
3381
|
if(hasattr(sys.stdout, "buffer")):
|
|
@@ -3321,7 +3383,7 @@ if(rarfile_support):
|
|
|
3321
3383
|
else:
|
|
3322
3384
|
shutil.copyfileobj(catfp, sys.stdout);
|
|
3323
3385
|
elif(re.findall(r"^(ftp|ftps|sftp)\:\/\/", str(outfile))):
|
|
3324
|
-
catfp = CompressArchiveFile(catfp, compression, formatspecs);
|
|
3386
|
+
catfp = CompressArchiveFile(catfp, compression, compressionlevel, formatspecs);
|
|
3325
3387
|
catfp.seek(0, 0);
|
|
3326
3388
|
upload_file_to_internet_file(catfp, outfile);
|
|
3327
3389
|
if(returnfp):
|
|
@@ -3354,7 +3416,10 @@ if(py7zr_support):
|
|
|
3354
3416
|
logging.basicConfig(format="%(message)s", stream=sys.stdout, level=logging.DEBUG);
|
|
3355
3417
|
if(outfile!="-" and not hasattr(outfile, "read") and not hasattr(outfile, "write")):
|
|
3356
3418
|
if(os.path.exists(outfile)):
|
|
3357
|
-
|
|
3419
|
+
try:
|
|
3420
|
+
os.unlink(outfile);
|
|
3421
|
+
except OSError as e:
|
|
3422
|
+
pass;
|
|
3358
3423
|
if(outfile=="-"):
|
|
3359
3424
|
verbose = False;
|
|
3360
3425
|
catfp = BytesIO();
|
|
@@ -3397,8 +3462,9 @@ if(py7zr_support):
|
|
|
3397
3462
|
pass;
|
|
3398
3463
|
except AttributeError:
|
|
3399
3464
|
pass;
|
|
3465
|
+
except OSError as e:
|
|
3466
|
+
pass;
|
|
3400
3467
|
for member in sorted(szpfp.list(), key=lambda x: x.filename):
|
|
3401
|
-
catfhstart = catfp.tell();
|
|
3402
3468
|
if(re.findall("^[.|/]", member.filename)):
|
|
3403
3469
|
fname = member.filename;
|
|
3404
3470
|
else:
|
|
@@ -3493,8 +3559,6 @@ if(py7zr_support):
|
|
|
3493
3559
|
if(len(extradata)>0):
|
|
3494
3560
|
catfileoutstr = catfileoutstr + AppendNullBytes(extradata, formatspecs[5]);
|
|
3495
3561
|
catfileoutstr = catfileoutstr + AppendNullByte(checksumtype, formatspecs[5]);
|
|
3496
|
-
catfhend = (catfp.tell() - 1) + len(catfileoutstr);
|
|
3497
|
-
catfcontentstart = catfp.tell() + len(catfileoutstr);
|
|
3498
3562
|
catfileheadercshex = GetFileChecksum(catfileoutstr, checksumtype, True, formatspecs);
|
|
3499
3563
|
fcontents.seek(0, 0);
|
|
3500
3564
|
catfilecontentcshex = GetFileChecksum(fcontents.read(), checksumtype, False, formatspecs);
|
|
@@ -3507,26 +3571,29 @@ if(py7zr_support):
|
|
|
3507
3571
|
nullstrecd = formatspecs[5].encode('UTF-8');
|
|
3508
3572
|
fcontents.seek(0, 0);
|
|
3509
3573
|
catfileout = catfileoutstrecd + fcontents.read() + nullstrecd;
|
|
3510
|
-
catfcontentend = (catfp.tell() - 1) + len(catfileout);
|
|
3511
3574
|
catfp.write(catfileout);
|
|
3512
3575
|
try:
|
|
3513
3576
|
catfp.flush();
|
|
3514
3577
|
os.fsync(catfp.fileno());
|
|
3515
3578
|
except io.UnsupportedOperation:
|
|
3516
|
-
pass
|
|
3579
|
+
pass;
|
|
3517
3580
|
except AttributeError:
|
|
3518
|
-
pass
|
|
3581
|
+
pass;
|
|
3582
|
+
except OSError as e:
|
|
3583
|
+
pass;
|
|
3519
3584
|
if(numfiles>0):
|
|
3520
3585
|
catfp.write(AppendNullBytes([0, 0], formatspecs[5]).encode("UTF-8"));
|
|
3521
3586
|
if(outfile=="-" or hasattr(outfile, "read") or hasattr(outfile, "write")):
|
|
3522
|
-
catfp = CompressArchiveFile(catfp, compression, formatspecs)
|
|
3587
|
+
catfp = CompressArchiveFile(catfp, compression, compressionlevel, formatspecs)
|
|
3523
3588
|
try:
|
|
3524
3589
|
catfp.flush();
|
|
3525
3590
|
os.fsync(catfp.fileno());
|
|
3526
3591
|
except io.UnsupportedOperation:
|
|
3527
|
-
pass
|
|
3592
|
+
pass;
|
|
3528
3593
|
except AttributeError:
|
|
3529
|
-
pass
|
|
3594
|
+
pass;
|
|
3595
|
+
except OSError as e:
|
|
3596
|
+
pass;
|
|
3530
3597
|
if(outfile=="-"):
|
|
3531
3598
|
catfp.seek(0, 0);
|
|
3532
3599
|
if(hasattr(sys.stdout, "buffer")):
|
|
@@ -3534,7 +3601,7 @@ if(py7zr_support):
|
|
|
3534
3601
|
else:
|
|
3535
3602
|
shutil.copyfileobj(catfp, sys.stdout);
|
|
3536
3603
|
elif(re.findall(r"^(ftp|ftps|sftp)\:\/\/", str(outfile))):
|
|
3537
|
-
catfp = CompressArchiveFile(catfp, compression, formatspecs);
|
|
3604
|
+
catfp = CompressArchiveFile(catfp, compression, compressionlevel, formatspecs);
|
|
3538
3605
|
catfp.seek(0, 0);
|
|
3539
3606
|
upload_file_to_internet_file(catfp, outfile);
|
|
3540
3607
|
if(returnfp):
|
|
@@ -5906,7 +5973,10 @@ def RePackArchiveFile(infile, outfile, compression="auto", compressionlevel=None
|
|
|
5906
5973
|
logging.basicConfig(format="%(message)s", stream=sys.stdout, level=logging.DEBUG);
|
|
5907
5974
|
if(outfile!="-" and not hasattr(outfile, "read") and not hasattr(outfile, "write")):
|
|
5908
5975
|
if(os.path.exists(outfile)):
|
|
5909
|
-
|
|
5976
|
+
try:
|
|
5977
|
+
os.unlink(outfile);
|
|
5978
|
+
except OSError as e:
|
|
5979
|
+
pass;
|
|
5910
5980
|
if(not listcatfiles):
|
|
5911
5981
|
return False;
|
|
5912
5982
|
if(outfile=="-"):
|
|
@@ -5940,6 +6010,8 @@ def RePackArchiveFile(infile, outfile, compression="auto", compressionlevel=None
|
|
|
5940
6010
|
pass;
|
|
5941
6011
|
except AttributeError:
|
|
5942
6012
|
pass;
|
|
6013
|
+
except OSError as e:
|
|
6014
|
+
pass;
|
|
5943
6015
|
lenlist = len(listcatfiles['ffilelist']);
|
|
5944
6016
|
fnumfiles = int(listcatfiles['fnumfiles']);
|
|
5945
6017
|
lcfi = 0;
|
|
@@ -5955,7 +6027,6 @@ def RePackArchiveFile(infile, outfile, compression="auto", compressionlevel=None
|
|
|
5955
6027
|
filetoinode = {};
|
|
5956
6028
|
reallcfi = 0;
|
|
5957
6029
|
while(lcfi < lcfx):
|
|
5958
|
-
catfhstart = catfp.tell();
|
|
5959
6030
|
if(re.findall("^[.|/]", listcatfiles['ffilelist'][reallcfi]['fname'])):
|
|
5960
6031
|
fname = listcatfiles['ffilelist'][reallcfi]['fname'];
|
|
5961
6032
|
else:
|
|
@@ -6059,8 +6130,6 @@ def RePackArchiveFile(infile, outfile, compression="auto", compressionlevel=None
|
|
|
6059
6130
|
exi = exi + 1;
|
|
6060
6131
|
catfileoutstr += AppendNullBytes([extrafieldslist], formatspecs[5]);
|
|
6061
6132
|
catfileoutstr += AppendNullBytes([checksumtype], formatspecs[5]);
|
|
6062
|
-
catfhend = (catfp.tell() - 1) + len(catfileoutstr);
|
|
6063
|
-
catfcontentstart = catfp.tell() + len(catfileoutstr);
|
|
6064
6133
|
catfileheadercshex = GetFileChecksum(catfileoutstr, checksumtype, True, formatspecs);
|
|
6065
6134
|
fcontents.seek(0, 0);
|
|
6066
6135
|
catfilecontentcshex = GetFileChecksum(fcontents.read(), checksumtype, False, formatspecs);
|
|
@@ -6073,7 +6142,6 @@ def RePackArchiveFile(infile, outfile, compression="auto", compressionlevel=None
|
|
|
6073
6142
|
nullstrecd = formatspecs[5].encode('UTF-8');
|
|
6074
6143
|
fcontents.seek(0, 0);
|
|
6075
6144
|
catfileout = catfileoutstrecd + fcontents.read() + nullstrecd;
|
|
6076
|
-
catfcontentend = (catfp.tell() - 1) + len(catfileout);
|
|
6077
6145
|
catfp.write(catfileout);
|
|
6078
6146
|
try:
|
|
6079
6147
|
catfp.flush();
|
|
@@ -6082,12 +6150,14 @@ def RePackArchiveFile(infile, outfile, compression="auto", compressionlevel=None
|
|
|
6082
6150
|
pass;
|
|
6083
6151
|
except AttributeError:
|
|
6084
6152
|
pass;
|
|
6153
|
+
except OSError as e:
|
|
6154
|
+
pass;
|
|
6085
6155
|
lcfi = lcfi + 1;
|
|
6086
6156
|
reallcfi = reallcfi + 1;
|
|
6087
6157
|
if(lcfx>0):
|
|
6088
6158
|
catfp.write(AppendNullBytes([0, 0], formatspecs[5]).encode("UTF-8"));
|
|
6089
6159
|
if(outfile=="-" or hasattr(outfile, "read") or hasattr(outfile, "write")):
|
|
6090
|
-
catfp = CompressArchiveFile(catfp, compression, formatspecs);
|
|
6160
|
+
catfp = CompressArchiveFile(catfp, compression, compressionlevel, formatspecs);
|
|
6091
6161
|
try:
|
|
6092
6162
|
catfp.flush();
|
|
6093
6163
|
os.fsync(catfp.fileno());
|
|
@@ -6095,6 +6165,8 @@ def RePackArchiveFile(infile, outfile, compression="auto", compressionlevel=None
|
|
|
6095
6165
|
pass;
|
|
6096
6166
|
except AttributeError:
|
|
6097
6167
|
pass;
|
|
6168
|
+
except OSError as e:
|
|
6169
|
+
pass;
|
|
6098
6170
|
if(outfile=="-"):
|
|
6099
6171
|
catfp.seek(0, 0);
|
|
6100
6172
|
if(hasattr(sys.stdout, "buffer")):
|
|
@@ -6102,7 +6174,7 @@ def RePackArchiveFile(infile, outfile, compression="auto", compressionlevel=None
|
|
|
6102
6174
|
else:
|
|
6103
6175
|
shutil.copyfileobj(catfp, sys.stdout);
|
|
6104
6176
|
elif(re.findall(r"^(ftp|ftps|sftp)\:\/\/", str(outfile))):
|
|
6105
|
-
catfp = CompressArchiveFile(catfp, compression, formatspecs);
|
|
6177
|
+
catfp = CompressArchiveFile(catfp, compression, compressionlevel, formatspecs);
|
|
6106
6178
|
catfp.seek(0, 0);
|
|
6107
6179
|
upload_file_to_internet_file(catfp, outfile);
|
|
6108
6180
|
if(returnfp):
|
|
@@ -6186,9 +6258,11 @@ def UnPackArchiveFile(infile, outdir=None, followlink=False, seekstart=0, seeken
|
|
|
6186
6258
|
fpc.flush();
|
|
6187
6259
|
os.fsync(fpc.fileno());
|
|
6188
6260
|
except io.UnsupportedOperation:
|
|
6189
|
-
pass
|
|
6261
|
+
pass;
|
|
6190
6262
|
except AttributeError:
|
|
6191
|
-
pass
|
|
6263
|
+
pass;
|
|
6264
|
+
except OSError as e:
|
|
6265
|
+
pass;
|
|
6192
6266
|
if(hasattr(os, "chown") and funame==listcatfiles['ffilelist'][lcfi]['funame'] and fgname==listcatfiles['ffilelist'][lcfi]['fgname'] and preservepermissions):
|
|
6193
6267
|
os.chown(PrependPath(outdir, listcatfiles['ffilelist'][lcfi]['fname']), listcatfiles['ffilelist'][lcfi]['fuid'], listcatfiles['ffilelist'][lcfi]['fgid']);
|
|
6194
6268
|
if(preservepermissions):
|
|
@@ -6228,9 +6302,11 @@ def UnPackArchiveFile(infile, outdir=None, followlink=False, seekstart=0, seeken
|
|
|
6228
6302
|
fpc.flush();
|
|
6229
6303
|
os.fsync(fpc.fileno());
|
|
6230
6304
|
except io.UnsupportedOperation:
|
|
6231
|
-
pass
|
|
6305
|
+
pass;
|
|
6232
6306
|
except AttributeError:
|
|
6233
|
-
pass
|
|
6307
|
+
pass;
|
|
6308
|
+
except OSError as e:
|
|
6309
|
+
pass;
|
|
6234
6310
|
if(hasattr(os, "chown") and funame==flinkinfo['funame'] and fgname==flinkinfo['fgname'] and preservepermissions):
|
|
6235
6311
|
os.chown(PrependPath(outdir, listcatfiles['ffilelist'][lcfi]['fname']), flinkinfo['fuid'], flinkinfo['fgid']);
|
|
6236
6312
|
if(preservepermissions):
|
|
@@ -6289,9 +6365,11 @@ def UnPackArchiveFile(infile, outdir=None, followlink=False, seekstart=0, seeken
|
|
|
6289
6365
|
fpc.flush();
|
|
6290
6366
|
os.fsync(fpc.fileno());
|
|
6291
6367
|
except io.UnsupportedOperation:
|
|
6292
|
-
pass
|
|
6368
|
+
pass;
|
|
6293
6369
|
except AttributeError:
|
|
6294
|
-
pass
|
|
6370
|
+
pass;
|
|
6371
|
+
except OSError as e:
|
|
6372
|
+
pass;
|
|
6295
6373
|
if(hasattr(os, "chown") and funame==flinkinfo['funame'] and fgname==flinkinfo['fgname'] and preservepermissions):
|
|
6296
6374
|
os.chown(PrependPath(outdir, listcatfiles['ffilelist'][lcfi]['fname']), flinkinfo['fuid'], flinkinfo['fgid']);
|
|
6297
6375
|
if(preservepermissions):
|
|
@@ -7377,7 +7455,7 @@ def upload_file_to_internet_file(ifp, url):
|
|
|
7377
7455
|
return False;
|
|
7378
7456
|
|
|
7379
7457
|
def upload_file_to_internet_compress_file(ifp, url, formatspecs=__file_format_list__):
|
|
7380
|
-
catfp = CompressArchiveFile(catfp, compression, formatspecs);
|
|
7458
|
+
catfp = CompressArchiveFile(catfp, compression, compressionlevel, formatspecs);
|
|
7381
7459
|
if(not catfileout):
|
|
7382
7460
|
return False;
|
|
7383
7461
|
catfp.seek(0, 0);
|
|
@@ -7400,7 +7478,7 @@ def upload_file_to_internet_string(ifp, url):
|
|
|
7400
7478
|
return False;
|
|
7401
7479
|
|
|
7402
7480
|
def upload_file_to_internet_compress_string(ifp, url, formatspecs=__file_format_list__):
|
|
7403
|
-
catfp = CompressArchiveFile(BytesIO(ifp), compression, formatspecs);
|
|
7481
|
+
catfp = CompressArchiveFile(BytesIO(ifp), compression, compressionlevel, formatspecs);
|
|
7404
7482
|
if(not catfileout):
|
|
7405
7483
|
return False;
|
|
7406
7484
|
catfp.seek(0, 0);
|
|
@@ -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: 5/
|
|
16
|
+
$FileInfo: setup.py - Last Update: 5/3/2024 Ver. 0.10.0 RC 1 - Author: cooldude2k $
|
|
17
17
|
'''
|
|
18
18
|
|
|
19
19
|
import os, re, sys, pkg_resources;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|