PyCatFile 0.10.0__tar.gz → 0.10.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.10.0 → pycatfile-0.10.2}/PKG-INFO +1 -1
- {pycatfile-0.10.0 → pycatfile-0.10.2}/PyCatFile.egg-info/PKG-INFO +1 -1
- {pycatfile-0.10.0 → pycatfile-0.10.2}/catfile.py +1 -1
- {pycatfile-0.10.0 → pycatfile-0.10.2}/neocatfile.py +1 -1
- {pycatfile-0.10.0 → pycatfile-0.10.2}/pycatfile.py +66 -31
- {pycatfile-0.10.0 → pycatfile-0.10.2}/setup.py +1 -1
- {pycatfile-0.10.0 → pycatfile-0.10.2}/LICENSE +0 -0
- {pycatfile-0.10.0 → pycatfile-0.10.2}/PyCatFile.egg-info/SOURCES.txt +0 -0
- {pycatfile-0.10.0 → pycatfile-0.10.2}/PyCatFile.egg-info/dependency_links.txt +0 -0
- {pycatfile-0.10.0 → pycatfile-0.10.2}/PyCatFile.egg-info/top_level.txt +0 -0
- {pycatfile-0.10.0 → pycatfile-0.10.2}/PyCatFile.egg-info/zip-safe +0 -0
- {pycatfile-0.10.0 → pycatfile-0.10.2}/README.md +0 -0
- {pycatfile-0.10.0 → pycatfile-0.10.2}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: PyCatFile
|
|
3
|
-
Version: 0.10.
|
|
3
|
+
Version: 0.10.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.10.
|
|
3
|
+
Version: 0.10.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
|
|
@@ -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/5/2024 Ver. 0.10.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: neocatfile.py - Last Update: 5/
|
|
17
|
+
$FileInfo: neocatfile.py - Last Update: 5/5/2024 Ver. 0.10.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: 5/
|
|
17
|
+
$FileInfo: pycatfile.py - Last Update: 5/5/2024 Ver. 0.10.2 RC 1 - Author: cooldude2k $
|
|
18
18
|
'''
|
|
19
19
|
|
|
20
20
|
from __future__ import absolute_import, division, print_function, unicode_literals;
|
|
@@ -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, 10,
|
|
178
|
-
__version_date_info__ = (2024, 5,
|
|
177
|
+
__version_info__ = (0, 10, 2, "RC 1", 1);
|
|
178
|
+
__version_date_info__ = (2024, 5, 5, "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: fc3f579a8dd909abc9786722184c4750a68cb94d $";
|
|
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):
|
|
@@ -624,6 +624,7 @@ def ReadFileHeaderDataBySizeWithContent(fp, listonly=False, skipchecksum=False,
|
|
|
624
624
|
newfcs = GetHeaderChecksum(HeaderOut[:-2], HeaderOut[-3].lower(), True, formatspecs);
|
|
625
625
|
if(fcs!=newfcs and not skipchecksum):
|
|
626
626
|
VerbosePrintOut("File Header Checksum Error with file " + fname + " at offset " + str(fheaderstart));
|
|
627
|
+
VerbosePrintOut("'" + str(fcs) + "' != " + "'" + str(newfcs) + "'");
|
|
627
628
|
return False;
|
|
628
629
|
fhend = fp.tell() - 1;
|
|
629
630
|
fcontentstart = fp.tell();
|
|
@@ -636,6 +637,7 @@ def ReadFileHeaderDataBySizeWithContent(fp, listonly=False, skipchecksum=False,
|
|
|
636
637
|
newfccs = GetFileChecksum(fcontents.read(), HeaderOut[-3].lower(), False, formatspecs);
|
|
637
638
|
if(fccs!=newfccs and not skipchecksum and not listonly):
|
|
638
639
|
VerbosePrintOut("File Content Checksum Error with file " + fname + " at offset " + str(fcontentstart));
|
|
640
|
+
VerbosePrintOut("'" + str(fccs) + "' != " + "'" + str(newfccs) + "'");
|
|
639
641
|
return False;
|
|
640
642
|
fp.seek(1, 1);
|
|
641
643
|
fcontentend = fp.tell() - 1;
|
|
@@ -695,6 +697,7 @@ def ReadFileHeaderDataBySizeWithContentToArray(fp, listonly=False, skipchecksum=
|
|
|
695
697
|
newfcs = GetHeaderChecksum(HeaderOut[:-2], HeaderOut[-3].lower(), True, formatspecs);
|
|
696
698
|
if(fcs!=newfcs and not skipchecksum):
|
|
697
699
|
VerbosePrintOut("File Header Checksum Error with file " + fname + " at offset " + str(fheaderstart));
|
|
700
|
+
VerbosePrintOut("'" + str(fcs) + "' != " + "'" + str(newfcs) + "'");
|
|
698
701
|
return False;
|
|
699
702
|
fhend = fp.tell() - 1;
|
|
700
703
|
fcontentstart = fp.tell();
|
|
@@ -710,6 +713,7 @@ def ReadFileHeaderDataBySizeWithContentToArray(fp, listonly=False, skipchecksum=
|
|
|
710
713
|
newfccs = GetFileChecksum(fcontents.read(), HeaderOut[-3].lower(), False, formatspecs);
|
|
711
714
|
if(fccs!=newfccs and not skipchecksum and not listonly):
|
|
712
715
|
VerbosePrintOut("File Content Checksum Error with file " + fname + " at offset " + str(fcontentstart));
|
|
716
|
+
VerbosePrintOut("'" + str(fccs) + "' != " + "'" + str(newfccs) + "'");
|
|
713
717
|
return False;
|
|
714
718
|
fp.seek(1, 1);
|
|
715
719
|
fcontentend = fp.tell() - 1;
|
|
@@ -770,6 +774,7 @@ def ReadFileHeaderDataBySizeWithContentToList(fp, listonly=False, skipchecksum=F
|
|
|
770
774
|
newfcs = GetHeaderChecksum(HeaderOut[:-2], HeaderOut[-3].lower(), True, formatspecs);
|
|
771
775
|
if(fcs!=newfcs and not skipchecksum):
|
|
772
776
|
VerbosePrintOut("File Header Checksum Error with file " + fname + " at offset " + str(fheaderstart));
|
|
777
|
+
VerbosePrintOut("'" + str(fcs) + "' != " + "'" + str(newfcs) + "'");
|
|
773
778
|
return False;
|
|
774
779
|
fhend = fp.tell() - 1;
|
|
775
780
|
fcontentstart = fp.tell();
|
|
@@ -785,6 +790,7 @@ def ReadFileHeaderDataBySizeWithContentToList(fp, listonly=False, skipchecksum=F
|
|
|
785
790
|
newfccs = GetFileChecksum(fcontents.read(), HeaderOut[-3].lower(), False, formatspecs);
|
|
786
791
|
if(fccs!=newfccs and not skipchecksum and not listonly):
|
|
787
792
|
VerbosePrintOut("File Content Checksum Error with file " + fname + " at offset " + str(fcontentstart));
|
|
793
|
+
VerbosePrintOut("'" + str(fccs) + "' != " + "'" + str(newfccs) + "'");
|
|
788
794
|
return False;
|
|
789
795
|
fp.seek(1, 1);
|
|
790
796
|
fcontentend = fp.tell() - 1;
|
|
@@ -800,8 +806,10 @@ def ReadFileDataBySizeWithContent(fp, listonly=False, skipchecksum=False, format
|
|
|
800
806
|
if(curloc>0):
|
|
801
807
|
fp.seek(curloc, 0);
|
|
802
808
|
headercheck = ValidateHeaderChecksum(catheader[:-1], catheader[2], catheader[3], formatspecs);
|
|
809
|
+
newfcs = GetHeaderChecksum(catheader[:-2], catheader[2], True, formatspecs);
|
|
803
810
|
if(not headercheck and not skipchecksum):
|
|
804
811
|
VerbosePrintOut("File Header Checksum Error with file at offset " + str(0));
|
|
812
|
+
VerbosePrintOut("'" + str(newfcs) + "' != " + "'" + str(catheader[3]) + "'");
|
|
805
813
|
return False;
|
|
806
814
|
fnumfiles = int(catheader[1], 16);
|
|
807
815
|
countnum = 0;
|
|
@@ -823,8 +831,10 @@ def ReadFileDataBySizeWithContentToArray(fp, seekstart=0, seekend=0, listonly=Fa
|
|
|
823
831
|
if(curloc>0):
|
|
824
832
|
fp.seek(curloc, 0);
|
|
825
833
|
headercheck = ValidateHeaderChecksum(catheader[:-1], catheader[2], catheader[3], formatspecs);
|
|
834
|
+
newfcs = GetHeaderChecksum(catheader[:-2], catheader[2], True, formatspecs);
|
|
826
835
|
if(not headercheck and not skipchecksum):
|
|
827
836
|
VerbosePrintOut("File Header Checksum Error with file at offset " + str(0));
|
|
837
|
+
VerbosePrintOut("'" + str(newfcs) + "' != " + "'" + str(catheader[3]) + "'");
|
|
828
838
|
return False;
|
|
829
839
|
catstring = catheader[0];
|
|
830
840
|
catversion = re.findall(r"([\d]+)$", catstring);
|
|
@@ -851,7 +861,8 @@ def ReadFileDataBySizeWithContentToArray(fp, seekstart=0, seekend=0, listonly=Fa
|
|
|
851
861
|
prenewfcs = GetHeaderChecksum(preheaderdata[:-2], preheaderdata[-3].lower(), True, formatspecs);
|
|
852
862
|
prefcs = preheaderdata[-2];
|
|
853
863
|
if(prefcs!=prenewfcs and not skipchecksum):
|
|
854
|
-
|
|
864
|
+
VVerbosePrintOut("File Header Checksum Error with file " + prefname + " at offset " + str(prefhstart));
|
|
865
|
+
VerbosePrintOut("'" + str(prefcs) + "' != " + "'" + str(prenewfcs) + "'");
|
|
855
866
|
return False;
|
|
856
867
|
valid_archive = False;
|
|
857
868
|
invalid_archive = True;
|
|
@@ -867,6 +878,7 @@ def ReadFileDataBySizeWithContentToArray(fp, seekstart=0, seekend=0, listonly=Fa
|
|
|
867
878
|
pyhascontents = True;
|
|
868
879
|
if(prefccs!=prenewfccs and not skipchecksum):
|
|
869
880
|
VerbosePrintOut("File Content Checksum Error with file " + prefname + " at offset " + str(prefcontentstart));
|
|
881
|
+
VerbosePrintOut("'" + str(prefccs) + "' != " + "'" + str(prenewfccs) + "'");
|
|
870
882
|
return False;
|
|
871
883
|
fp.seek(1, 1);
|
|
872
884
|
il = il + 1;
|
|
@@ -947,8 +959,10 @@ def ReadFileDataBySizeWithContentToList(fp, seekstart=0, seekend=0, listonly=Fal
|
|
|
947
959
|
if(curloc>0):
|
|
948
960
|
fp.seek(curloc, 0);
|
|
949
961
|
headercheck = ValidateHeaderChecksum(catheader[:-1], catheader[2], catheader[3], formatspecs);
|
|
962
|
+
newfcs = GetHeaderChecksum(catheader[:-2], catheader[2], True, formatspecs);
|
|
950
963
|
if(not headercheck and not skipchecksum):
|
|
951
964
|
VerbosePrintOut("File Header Checksum Error with file at offset " + str(0));
|
|
965
|
+
VerbosePrintOut("'" + str(newfcs) + "' != " + "'" + str(catheader[3]) + "'");
|
|
952
966
|
return False;
|
|
953
967
|
catstring = catheader[0];
|
|
954
968
|
catversion = re.findall(r"([\d]+)$", catstring);
|
|
@@ -976,6 +990,7 @@ def ReadFileDataBySizeWithContentToList(fp, seekstart=0, seekend=0, listonly=Fal
|
|
|
976
990
|
prefcs = preheaderdata[-2];
|
|
977
991
|
if(prefcs!=prenewfcs and not skipchecksum):
|
|
978
992
|
VerbosePrintOut("File Header Checksum Error with file " + prefname + " at offset " + str(prefhstart));
|
|
993
|
+
VerbosePrintOut("'" + str(prefcs) + "' != " + "'" + str(prenewfcs) + "'");
|
|
979
994
|
return False;
|
|
980
995
|
valid_archive = False;
|
|
981
996
|
invalid_archive = True;
|
|
@@ -990,6 +1005,7 @@ def ReadFileDataBySizeWithContentToList(fp, seekstart=0, seekend=0, listonly=Fal
|
|
|
990
1005
|
pyhascontents = True;
|
|
991
1006
|
if(prefccs!=prenewfccs and not skipchecksum):
|
|
992
1007
|
VerbosePrintOut("File Content Checksum Error with file " + prefname + " at offset " + str(prefcontentstart));
|
|
1008
|
+
VerbosePrintOut("'" + str(prefccs) + "' != " + "'" + str(prenewfccs) + "'");
|
|
993
1009
|
return False;
|
|
994
1010
|
fp.seek(1, 1);
|
|
995
1011
|
il = il + 1;
|
|
@@ -1230,7 +1246,7 @@ def MakeEmptyFile(outfile, compression="auto", compressionlevel=None, checksumty
|
|
|
1230
1246
|
else:
|
|
1231
1247
|
fbasename = os.path.splitext(outfile)[0];
|
|
1232
1248
|
fextname = os.path.splitext(outfile)[1];
|
|
1233
|
-
catfp = CompressOpenFile(outfile, compressionlevel);
|
|
1249
|
+
catfp = CompressOpenFile(outfile, True, compressionlevel);
|
|
1234
1250
|
catfp = AppendFileHeader(catfp, 0, checksumtype, formatspecs);
|
|
1235
1251
|
if(outfile=="-" or hasattr(outfile, "read") or hasattr(outfile, "write")):
|
|
1236
1252
|
catfp = CompressArchiveFile(catfp, compression, compressionlevel, formatspecs);
|
|
@@ -1547,7 +1563,7 @@ def AppendFilesWithContentToOutFile(infiles, outfile, dirlistfromtxt=False, comp
|
|
|
1547
1563
|
else:
|
|
1548
1564
|
fbasename = os.path.splitext(outfile)[0];
|
|
1549
1565
|
fextname = os.path.splitext(outfile)[1];
|
|
1550
|
-
catfp = CompressOpenFile(outfile, compressionlevel);
|
|
1566
|
+
catfp = CompressOpenFile(outfile, True, compressionlevel);
|
|
1551
1567
|
catfp = AppendFilesWithContent(infiles, catfp, dirlistfromtxt, filevalues, extradata, followlink, checksumtype, formatspecs, verbose);
|
|
1552
1568
|
if(outfile=="-" or hasattr(outfile, "read") or hasattr(outfile, "write")):
|
|
1553
1569
|
catfp = CompressArchiveFile(catfp, compression, compressionlevel, formatspecs);
|
|
@@ -1594,7 +1610,7 @@ def AppendListsWithContentToOutFile(inlist, outfile, dirlistfromtxt=False, compr
|
|
|
1594
1610
|
else:
|
|
1595
1611
|
fbasename = os.path.splitext(outfile)[0];
|
|
1596
1612
|
fextname = os.path.splitext(outfile)[1];
|
|
1597
|
-
catfp = CompressOpenFile(outfile, compressionlevel);
|
|
1613
|
+
catfp = CompressOpenFile(outfile, True, compressionlevel);
|
|
1598
1614
|
catfp = AppendListsWithContent(inlist, catfp, dirlistfromtxt, filevalues, extradata, followlink, checksumtype, formatspecs, verbose);
|
|
1599
1615
|
if(outfile=="-" or hasattr(outfile, "read") or hasattr(outfile, "write")):
|
|
1600
1616
|
catfp = CompressArchiveFile(catfp, compression, compressionlevel, formatspecs);
|
|
@@ -1884,6 +1900,8 @@ def UncompressArchiveFile(fp, formatspecs=__file_format_list__):
|
|
|
1884
1900
|
catfp.write(lzma.decompress(fp.read()));
|
|
1885
1901
|
except lzma.LZMAError:
|
|
1886
1902
|
return False;
|
|
1903
|
+
if(compresscheck!="catfile" or compresscheck!=formatspecs[2]):
|
|
1904
|
+
fp.close();
|
|
1887
1905
|
return catfp;
|
|
1888
1906
|
|
|
1889
1907
|
create_alias_function("Uncompress", __file_format_name__, "", UncompressArchiveFile);
|
|
@@ -2137,8 +2155,8 @@ def CompressArchiveFile(fp, compression="auto", compressionlevel=None, formatspe
|
|
|
2137
2155
|
if(not hasattr(fp, "read") and not hasattr(fp, "write")):
|
|
2138
2156
|
return False;
|
|
2139
2157
|
fp.seek(0, 0);
|
|
2140
|
-
if(not compression or compression
|
|
2141
|
-
compression =
|
|
2158
|
+
if(not compression or compression=="catfile" or compression==formatspecs[2]):
|
|
2159
|
+
compression = "auto";
|
|
2142
2160
|
if(compression not in compressionlist and compression is None):
|
|
2143
2161
|
compression = "auto";
|
|
2144
2162
|
if(compression=="gzip"):
|
|
@@ -2225,7 +2243,7 @@ def CompressArchiveFile(fp, compression="auto", compressionlevel=None, formatspe
|
|
|
2225
2243
|
|
|
2226
2244
|
create_alias_function("Compress", __file_format_name__, "", CompressArchiveFile);
|
|
2227
2245
|
|
|
2228
|
-
def CompressOpenFile(outfile, compressionlevel=None):
|
|
2246
|
+
def CompressOpenFile(outfile, compressionenable=True, compressionlevel=None):
|
|
2229
2247
|
if(outfile is None):
|
|
2230
2248
|
return False;
|
|
2231
2249
|
fbasename = os.path.splitext(outfile)[0];
|
|
@@ -2241,7 +2259,7 @@ def CompressOpenFile(outfile, compressionlevel=None):
|
|
|
2241
2259
|
else:
|
|
2242
2260
|
mode = "wb";
|
|
2243
2261
|
try:
|
|
2244
|
-
if(fextname not in outextlistwd):
|
|
2262
|
+
if(fextname not in outextlistwd or not compressionenable):
|
|
2245
2263
|
try:
|
|
2246
2264
|
outfp = open(outfile, "wb", encoding="UTF-8");
|
|
2247
2265
|
except (ValueError, TypeError) as e:
|
|
@@ -2357,8 +2375,8 @@ def PackArchiveFile(infiles, outfile, dirlistfromtxt=False, compression="auto",
|
|
|
2357
2375
|
checksumtype="crc32";
|
|
2358
2376
|
if(checksumtype=="none"):
|
|
2359
2377
|
checksumtype = "";
|
|
2360
|
-
if(not compression or compression
|
|
2361
|
-
compression =
|
|
2378
|
+
if(not compression or compression=="catfile" or compression==formatspecs[2]):
|
|
2379
|
+
compression = "auto";
|
|
2362
2380
|
if(compression not in compressionlist and compression is None):
|
|
2363
2381
|
compression = "auto";
|
|
2364
2382
|
if(verbose):
|
|
@@ -2379,7 +2397,7 @@ def PackArchiveFile(infiles, outfile, dirlistfromtxt=False, compression="auto",
|
|
|
2379
2397
|
else:
|
|
2380
2398
|
fbasename = os.path.splitext(outfile)[0];
|
|
2381
2399
|
fextname = os.path.splitext(outfile)[1];
|
|
2382
|
-
catfp = CompressOpenFile(outfile, compressionlevel);
|
|
2400
|
+
catfp = CompressOpenFile(outfile, True, compressionlevel);
|
|
2383
2401
|
catver = formatspecs[6];
|
|
2384
2402
|
fileheaderver = str(int(catver.replace(".", "")));
|
|
2385
2403
|
fileheader = AppendNullByte(formatspecs[1] + fileheaderver, formatspecs[5]);
|
|
@@ -2646,8 +2664,8 @@ def PackArchiveFileFromTarFile(infile, outfile, compression="auto", compressionl
|
|
|
2646
2664
|
checksumtype="crc32";
|
|
2647
2665
|
if(checksumtype=="none"):
|
|
2648
2666
|
checksumtype = "";
|
|
2649
|
-
if(not compression or compression
|
|
2650
|
-
compression =
|
|
2667
|
+
if(not compression or compression=="catfile" or compression==formatspecs[2]):
|
|
2668
|
+
compression = "auto";
|
|
2651
2669
|
if(compression not in compressionlist and compression is None):
|
|
2652
2670
|
compression = "auto";
|
|
2653
2671
|
if(verbose):
|
|
@@ -2668,7 +2686,7 @@ def PackArchiveFileFromTarFile(infile, outfile, compression="auto", compressionl
|
|
|
2668
2686
|
else:
|
|
2669
2687
|
fbasename = os.path.splitext(outfile)[0];
|
|
2670
2688
|
fextname = os.path.splitext(outfile)[1];
|
|
2671
|
-
catfp = CompressOpenFile(outfile, compressionlevel);
|
|
2689
|
+
catfp = CompressOpenFile(outfile, True, compressionlevel);
|
|
2672
2690
|
catver = formatspecs[6];
|
|
2673
2691
|
fileheaderver = str(int(catver.replace(".", "")));
|
|
2674
2692
|
fileheader = AppendNullByte(formatspecs[1] + fileheaderver, formatspecs[5]);
|
|
@@ -2879,8 +2897,8 @@ def PackArchiveFileFromZipFile(infile, outfile, compression="auto", compressionl
|
|
|
2879
2897
|
checksumtype="crc32";
|
|
2880
2898
|
if(checksumtype=="none"):
|
|
2881
2899
|
checksumtype = "";
|
|
2882
|
-
if(not compression or compression
|
|
2883
|
-
compression =
|
|
2900
|
+
if(not compression or compression=="catfile" or compression==formatspecs[2]):
|
|
2901
|
+
compression = "auto";
|
|
2884
2902
|
if(compression not in compressionlist and compression is None):
|
|
2885
2903
|
compression = "auto";
|
|
2886
2904
|
if(verbose):
|
|
@@ -2901,7 +2919,7 @@ def PackArchiveFileFromZipFile(infile, outfile, compression="auto", compressionl
|
|
|
2901
2919
|
else:
|
|
2902
2920
|
fbasename = os.path.splitext(outfile)[0];
|
|
2903
2921
|
fextname = os.path.splitext(outfile)[1];
|
|
2904
|
-
catfp = CompressOpenFile(outfile, compressionlevel);
|
|
2922
|
+
catfp = CompressOpenFile(outfile, True, compressionlevel);
|
|
2905
2923
|
catver = formatspecs[6];
|
|
2906
2924
|
fileheaderver = str(int(catver.replace(".", "")));
|
|
2907
2925
|
fileheader = AppendNullByte(formatspecs[1] + fileheaderver, formatspecs[5]);
|
|
@@ -3137,8 +3155,8 @@ if(rarfile_support):
|
|
|
3137
3155
|
checksumtype="crc32";
|
|
3138
3156
|
if(checksumtype=="none"):
|
|
3139
3157
|
checksumtype = "";
|
|
3140
|
-
if(not compression or compression
|
|
3141
|
-
compression =
|
|
3158
|
+
if(not compression or compression=="catfile" or compression==formatspecs[2]):
|
|
3159
|
+
compression = "auto";
|
|
3142
3160
|
if(compression not in compressionlist and compression is None):
|
|
3143
3161
|
compression = "auto";
|
|
3144
3162
|
if(verbose):
|
|
@@ -3159,7 +3177,7 @@ if(rarfile_support):
|
|
|
3159
3177
|
else:
|
|
3160
3178
|
fbasename = os.path.splitext(outfile)[0];
|
|
3161
3179
|
fextname = os.path.splitext(outfile)[1];
|
|
3162
|
-
catfp = CompressOpenFile(outfile, compressionlevel);
|
|
3180
|
+
catfp = CompressOpenFile(outfile, True, compressionlevel);
|
|
3163
3181
|
catver = formatspecs[6];
|
|
3164
3182
|
fileheaderver = str(int(catver.replace(".", "")));
|
|
3165
3183
|
fileheader = AppendNullByte(formatspecs[1] + fileheaderver, formatspecs[5]);
|
|
@@ -3408,8 +3426,8 @@ if(py7zr_support):
|
|
|
3408
3426
|
checksumtype="crc32";
|
|
3409
3427
|
if(checksumtype=="none"):
|
|
3410
3428
|
checksumtype = "";
|
|
3411
|
-
if(not compression or compression
|
|
3412
|
-
compression =
|
|
3429
|
+
if(not compression or compression=="catfile" or compression==formatspecs[2]):
|
|
3430
|
+
compression = "auto";
|
|
3413
3431
|
if(compression not in compressionlist and compression is None):
|
|
3414
3432
|
compression = "auto";
|
|
3415
3433
|
if(verbose):
|
|
@@ -3430,7 +3448,7 @@ if(py7zr_support):
|
|
|
3430
3448
|
else:
|
|
3431
3449
|
fbasename = os.path.splitext(outfile)[0];
|
|
3432
3450
|
fextname = os.path.splitext(outfile)[1];
|
|
3433
|
-
catfp = CompressOpenFile(outfile, compressionlevel);
|
|
3451
|
+
catfp = CompressOpenFile(outfile, True, compressionlevel);
|
|
3434
3452
|
catver = formatspecs[6];
|
|
3435
3453
|
fileheaderver = str(int(catver.replace(".", "")));
|
|
3436
3454
|
fileheader = AppendNullByte(formatspecs[1] + fileheaderver, formatspecs[5]);
|
|
@@ -3739,6 +3757,7 @@ def ArchiveFileSeekToFileNum(infile, seekto=0, listonly=False, skipchecksum=Fals
|
|
|
3739
3757
|
fheadtell = len(fileheader);
|
|
3740
3758
|
if(fprechecksum!=catfileheadercshex and not skipchecksum):
|
|
3741
3759
|
VerbosePrintOut("File Header Checksum Error with file " + infile + " at offset " + str(0));
|
|
3760
|
+
VerbosePrintOut("'" + str(fprechecksum) + "' != " + "'" + str(catfileheadercshex) + "'");
|
|
3742
3761
|
return False;
|
|
3743
3762
|
catversions = re.search(r'(.*?)(\d+)$', catstring).groups();
|
|
3744
3763
|
catlist = {'fnumfiles': fnumfiles, 'fformat': catversions[0], 'fversion': catversions[1], 'fformatspecs': formatspecs, 'fchecksumtype': fprechecksumtype, 'fheaderchecksum': fprechecksum, 'ffilelist': {}};
|
|
@@ -3806,6 +3825,7 @@ def ArchiveFileSeekToFileNum(infile, seekto=0, listonly=False, skipchecksum=Fals
|
|
|
3806
3825
|
prenewfcs = GetFileChecksum(hout, preheaderdata[-3].lower(), True, formatspecs);
|
|
3807
3826
|
if(prefcs!=prenewfcs and not skipchecksum):
|
|
3808
3827
|
VerbosePrintOut("File Header Checksum Error with file " + prefname + " at offset " + str(prefhstart));
|
|
3828
|
+
VerbosePrintOut("'" + str(prefcs) + "' != " + "'" + str(prenewfcs) + "'");
|
|
3809
3829
|
return False;
|
|
3810
3830
|
valid_archive = False;
|
|
3811
3831
|
invalid_archive = True;
|
|
@@ -3819,6 +3839,7 @@ def ArchiveFileSeekToFileNum(infile, seekto=0, listonly=False, skipchecksum=Fals
|
|
|
3819
3839
|
pyhascontents = True;
|
|
3820
3840
|
if(prefccs!=prenewfccs and not skipchecksum):
|
|
3821
3841
|
VerbosePrintOut("File Content Checksum Error with file " + prefname + " at offset " + str(prefcontentstart));
|
|
3842
|
+
VerbosePrintOut("'" + str(prefccs) + "' != " + "'" + str(prenewfccs) + "'");
|
|
3822
3843
|
return False;
|
|
3823
3844
|
catfp.seek(1, 1);
|
|
3824
3845
|
il = il + 1;
|
|
@@ -3949,6 +3970,7 @@ def ArchiveFileSeekToFileName(infile, seekfile=None, listonly=False, skipchecksu
|
|
|
3949
3970
|
fheadtell = len(fileheader);
|
|
3950
3971
|
if(fprechecksum!=catfileheadercshex and not skipchecksum):
|
|
3951
3972
|
VerbosePrintOut("File Header Checksum Error with file " + infile + " at offset " + str(0));
|
|
3973
|
+
VerbosePrintOut("'" + str(fprechecksum) + "' != " + "'" + str(catfileheadercshex) + "'");
|
|
3952
3974
|
return False;
|
|
3953
3975
|
catversions = re.search(r'(.*?)(\d+)$', catstring).groups();
|
|
3954
3976
|
catlist = {'fnumfiles': fnumfiles, 'fformat': catversions[0], 'fversion': catversions[1], 'fformatspecs': formatspecs, 'fchecksumtype': fprechecksumtype, 'fheaderchecksum': fprechecksum, 'ffilelist': {}};
|
|
@@ -4014,6 +4036,7 @@ def ArchiveFileSeekToFileName(infile, seekfile=None, listonly=False, skipchecksu
|
|
|
4014
4036
|
prenewfcs = GetFileChecksum(hout, preheaderdata[-3].lower(), True, formatspecs);
|
|
4015
4037
|
if(prefcs!=prenewfcs and not skipchecksum):
|
|
4016
4038
|
VerbosePrintOut("File Header Checksum Error with file " + prefname + " at offset " + str(prefhstart));
|
|
4039
|
+
VerbosePrintOut("'" + str(prefcs) + "' != " + "'" + str(prenewfcs) + "'");
|
|
4017
4040
|
return False;
|
|
4018
4041
|
valid_archive = False;
|
|
4019
4042
|
invalid_archive = True;
|
|
@@ -4027,6 +4050,7 @@ def ArchiveFileSeekToFileName(infile, seekfile=None, listonly=False, skipchecksu
|
|
|
4027
4050
|
pyhascontents = True;
|
|
4028
4051
|
if(prefccs!=prenewfccs and not skipchecksum):
|
|
4029
4052
|
VerbosePrintOut("File Content Checksum Error with file " + prefname + " at offset " + str(prefcontentstart));
|
|
4053
|
+
VerbosePrintOut("'" + str(prefccs) + "' != " + "'" + str(prenewfccs) + "'");
|
|
4030
4054
|
return False;
|
|
4031
4055
|
catfp.seek(1, 1);
|
|
4032
4056
|
il = il + 1;
|
|
@@ -4177,9 +4201,11 @@ def ArchiveFileValidate(infile, formatspecs=__file_format_list__, verbose=False,
|
|
|
4177
4201
|
if(fprechecksum==catfileheadercshex):
|
|
4178
4202
|
if(verbose):
|
|
4179
4203
|
VerbosePrintOut("File Header Checksum Passed at offset " + str(0));
|
|
4204
|
+
VerbosePrintOut("'" + str(fprechecksum) + "' == " + "'" + str(catfileheadercshex) + "'");
|
|
4180
4205
|
else:
|
|
4181
4206
|
if(verbose):
|
|
4182
4207
|
VerbosePrintOut("File Header Checksum Failed at offset " + str(0));
|
|
4208
|
+
VerbosePrintOut("'" + str(fprechecksum) + "' != " + "'" + str(catfileheadercshex) + "'");
|
|
4183
4209
|
valid_archive = False;
|
|
4184
4210
|
invalid_archive = True;
|
|
4185
4211
|
if(verbose):
|
|
@@ -4246,9 +4272,11 @@ def ArchiveFileValidate(infile, formatspecs=__file_format_list__, verbose=False,
|
|
|
4246
4272
|
if(catfcs==catnewfcs):
|
|
4247
4273
|
if(verbose):
|
|
4248
4274
|
VerbosePrintOut("File Header Checksum Passed at offset " + str(catfhstart));
|
|
4275
|
+
VerbosePrintOut("'" + str(catfcs) + "' == " + "'" + str(catnewfcs) + "'");
|
|
4249
4276
|
else:
|
|
4250
4277
|
if(verbose):
|
|
4251
4278
|
VerbosePrintOut("File Header Checksum Failed at offset " + str(catfhstart));
|
|
4279
|
+
VerbosePrintOut("'" + str(catfcs) + "' != " + "'" + str(catnewfcs) + "'");
|
|
4252
4280
|
valid_archive = False;
|
|
4253
4281
|
invalid_archive = True;
|
|
4254
4282
|
catfhend = catfp.tell() - 1;
|
|
@@ -4262,9 +4290,11 @@ def ArchiveFileValidate(infile, formatspecs=__file_format_list__, verbose=False,
|
|
|
4262
4290
|
if(catfccs==catnewfccs):
|
|
4263
4291
|
if(verbose):
|
|
4264
4292
|
VerbosePrintOut("File Content Checksum Passed at offset " + str(catfcontentstart));
|
|
4293
|
+
VerbosePrintOut("'" + str(catfccs) + "' == " + "'" + str(catnewfccs) + "'");
|
|
4265
4294
|
else:
|
|
4266
4295
|
if(verbose):
|
|
4267
4296
|
VerbosePrintOut("File Content Checksum Failed at offset " + str(catfcontentstart));
|
|
4297
|
+
VerbosePrintOut("'" + str(catfccs) + "' != " + "'" + str(catnewfccs) + "'");
|
|
4268
4298
|
valid_archive = False;
|
|
4269
4299
|
invalid_archive = True;
|
|
4270
4300
|
if(verbose):
|
|
@@ -4388,7 +4418,8 @@ def ArchiveFileToArray(infile, seekstart=0, seekend=0, listonly=False, skipcheck
|
|
|
4388
4418
|
fileheader = fileheader + AppendNullByte(catfileheadercshex, formatspecs[5]);
|
|
4389
4419
|
fheadtell = len(fileheader);
|
|
4390
4420
|
if(fprechecksum!=catfileheadercshex and not skipchecksum):
|
|
4391
|
-
VerbosePrintOut("File Header Checksum Error with file
|
|
4421
|
+
VerbosePrintOut("File Header Checksum Error with file at offset " + str(0));
|
|
4422
|
+
VerbosePrintOut("'" + str(fprechecksum) + "' != " + "'" + str(catfileheadercshex) + "'");
|
|
4392
4423
|
return False;
|
|
4393
4424
|
catversions = re.search(r'(.*?)(\d+)$', catstring).groups();
|
|
4394
4425
|
catlist = {'fnumfiles': fnumfiles, 'fformat': catversions[0], 'fversion': catversions[1], 'fformatspecs': formatspecs, 'fchecksumtype': fprechecksumtype, 'fheaderchecksum': fprechecksum, 'ffilelist': {}};
|
|
@@ -4436,6 +4467,7 @@ def ArchiveFileToArray(infile, seekstart=0, seekend=0, listonly=False, skipcheck
|
|
|
4436
4467
|
prenewfcs = GetFileChecksum(hout, preheaderdata[-3].lower(), True, formatspecs);
|
|
4437
4468
|
if(prefcs!=prenewfcs and not skipchecksum):
|
|
4438
4469
|
VerbosePrintOut("File Header Checksum Error with file " + prefname + " at offset " + str(prefhstart));
|
|
4470
|
+
VerbosePrintOut("'" + str(prefcs) + "' != " + "'" + str(prenewfcs) + "'");
|
|
4439
4471
|
return False;
|
|
4440
4472
|
valid_archive = False;
|
|
4441
4473
|
invalid_archive = True;
|
|
@@ -4449,6 +4481,7 @@ def ArchiveFileToArray(infile, seekstart=0, seekend=0, listonly=False, skipcheck
|
|
|
4449
4481
|
pyhascontents = True;
|
|
4450
4482
|
if(prefccs!=prenewfccs and not skipchecksum):
|
|
4451
4483
|
VerbosePrintOut("File Content Checksum Error with file " + prefname + " at offset " + str(prefcontentstart));
|
|
4484
|
+
VerbosePrintOut("'" + str(prefccs) + "' != " + "'" + str(prenewfccs) + "'");
|
|
4452
4485
|
return False;
|
|
4453
4486
|
catfp.seek(1, 1);
|
|
4454
4487
|
il = il + 1;
|
|
@@ -4512,6 +4545,7 @@ def ArchiveFileToArray(infile, seekstart=0, seekend=0, listonly=False, skipcheck
|
|
|
4512
4545
|
catnewfcs = GetFileChecksum(hout, catheaderdata[-3].lower(), True, formatspecs);
|
|
4513
4546
|
if(catfcs!=catnewfcs and not skipchecksum):
|
|
4514
4547
|
VerbosePrintOut("File Header Checksum Error with file " + catfname + " at offset " + str(catfhstart));
|
|
4548
|
+
VerbosePrintOut("'" + str(catfcs) + "' != " + "'" + str(catnewfcs) + "'");
|
|
4515
4549
|
return False;
|
|
4516
4550
|
catfhend = catfp.tell() - 1;
|
|
4517
4551
|
catfcontentstart = catfp.tell();
|
|
@@ -4524,6 +4558,7 @@ def ArchiveFileToArray(infile, seekstart=0, seekend=0, listonly=False, skipcheck
|
|
|
4524
4558
|
pyhascontents = True;
|
|
4525
4559
|
if(catfccs!=catnewfccs and skipchecksum):
|
|
4526
4560
|
VerbosePrintOut("File Content Checksum Error with file " + catfname + " at offset " + str(catfcontentstart));
|
|
4561
|
+
VerbosePrintOut("'" + str(catfccs) + "' != " + "'" + str(catnewfccs) + "'");
|
|
4527
4562
|
return False;
|
|
4528
4563
|
if(catfsize>0 and listonly):
|
|
4529
4564
|
catfp.seek(catfsize, 1);
|
|
@@ -5965,8 +6000,8 @@ def RePackArchiveFile(infile, outfile, compression="auto", compressionlevel=None
|
|
|
5965
6000
|
checksumtype="crc32";
|
|
5966
6001
|
if(checksumtype=="none"):
|
|
5967
6002
|
checksumtype = "";
|
|
5968
|
-
if(not compression or compression
|
|
5969
|
-
compression =
|
|
6003
|
+
if(not compression or compression=="catfile" or compression==formatspecs[2]):
|
|
6004
|
+
compression = "auto";
|
|
5970
6005
|
if(compression not in compressionlist and compression is None):
|
|
5971
6006
|
compression = "auto";
|
|
5972
6007
|
if(verbose):
|
|
@@ -5989,7 +6024,7 @@ def RePackArchiveFile(infile, outfile, compression="auto", compressionlevel=None
|
|
|
5989
6024
|
else:
|
|
5990
6025
|
fbasename = os.path.splitext(outfile)[0];
|
|
5991
6026
|
fextname = os.path.splitext(outfile)[1];
|
|
5992
|
-
catfp = CompressOpenFile(outfile, compressionlevel);
|
|
6027
|
+
catfp = CompressOpenFile(outfile, True, compressionlevel);
|
|
5993
6028
|
catver = formatspecs[6];
|
|
5994
6029
|
fileheaderver = str(int(catver.replace(".", "")));
|
|
5995
6030
|
fileheader = AppendNullByte(formatspecs[1] + fileheaderver, formatspecs[5]);
|
|
@@ -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/5/2024 Ver. 0.10.2 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
|