PyCatFile 0.13.0__tar.gz → 0.13.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.13.0 → pycatfile-0.13.2}/PKG-INFO +1 -1
- {pycatfile-0.13.0 → pycatfile-0.13.2}/PyCatFile.egg-info/PKG-INFO +1 -1
- {pycatfile-0.13.0 → pycatfile-0.13.2}/catfile.py +1 -1
- {pycatfile-0.13.0 → pycatfile-0.13.2}/neocatfile.py +1 -1
- {pycatfile-0.13.0 → pycatfile-0.13.2}/pycatfile.py +250 -28
- {pycatfile-0.13.0 → pycatfile-0.13.2}/setup.py +1 -1
- {pycatfile-0.13.0 → pycatfile-0.13.2}/LICENSE +0 -0
- {pycatfile-0.13.0 → pycatfile-0.13.2}/PyCatFile.egg-info/SOURCES.txt +0 -0
- {pycatfile-0.13.0 → pycatfile-0.13.2}/PyCatFile.egg-info/dependency_links.txt +0 -0
- {pycatfile-0.13.0 → pycatfile-0.13.2}/PyCatFile.egg-info/top_level.txt +0 -0
- {pycatfile-0.13.0 → pycatfile-0.13.2}/PyCatFile.egg-info/zip-safe +0 -0
- {pycatfile-0.13.0 → pycatfile-0.13.2}/README.md +0 -0
- {pycatfile-0.13.0 → pycatfile-0.13.2}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: PyCatFile
|
|
3
|
-
Version: 0.13.
|
|
3
|
+
Version: 0.13.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.13.
|
|
3
|
+
Version: 0.13.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: 6/
|
|
17
|
+
$FileInfo: catfile.py - Last Update: 6/14/2024 Ver. 0.13.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: 6/
|
|
17
|
+
$FileInfo: neocatfile.py - Last Update: 6/14/2024 Ver. 0.13.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: 6/
|
|
17
|
+
$FileInfo: pycatfile.py - Last Update: 6/14/2024 Ver. 0.13.2 RC 1 - Author: cooldude2k $
|
|
18
18
|
'''
|
|
19
19
|
|
|
20
20
|
from __future__ import absolute_import, division, print_function, unicode_literals;
|
|
@@ -192,11 +192,11 @@ __file_format_list__ = [__file_format_name__, __file_format_magic__, __file_form
|
|
|
192
192
|
__file_format_dict__ = {'format_name': __file_format_name__, 'format_magic': __file_format_magic__, 'format_lower': __file_format_lower__, 'format_len': __file_format_len__, 'format_hex': __file_format_hex__, 'format_delimiter': __file_format_delimiter__, 'format_ver': __file_format_ver__, 'new_style': __use_new_style__, 'use_advanced_list': __use_advanced_list__, 'use_alt_inode': __use_alt_inode__};
|
|
193
193
|
__project__ = __program_name__;
|
|
194
194
|
__project_url__ = "https://github.com/GameMaker2k/PyCatFile";
|
|
195
|
-
__version_info__ = (0, 13,
|
|
196
|
-
__version_date_info__ = (2024, 6,
|
|
195
|
+
__version_info__ = (0, 13, 2, "RC 1", 1);
|
|
196
|
+
__version_date_info__ = (2024, 6, 14, "RC 1", 1);
|
|
197
197
|
__version_date__ = str(__version_date_info__[0]) + "." + str(__version_date_info__[1]).zfill(2) + "." + str(__version_date_info__[2]).zfill(2);
|
|
198
198
|
__revision__ = __version_info__[3];
|
|
199
|
-
__revision_id__ = "$Id:
|
|
199
|
+
__revision_id__ = "$Id: 4fa12ed6c9a98672ea7ca68f9bff7b0f13f625d1 $";
|
|
200
200
|
if(__version_info__[4] is not None):
|
|
201
201
|
__version_date_plusrc__ = __version_date__ + "-" + str(__version_date_info__[4]);
|
|
202
202
|
if(__version_info__[4] is None):
|
|
@@ -321,6 +321,8 @@ if('zlib' in compressionsupport):
|
|
|
321
321
|
outextlistwd.append('.zz');
|
|
322
322
|
outextlist.append('zl');
|
|
323
323
|
outextlistwd.append('.zl');
|
|
324
|
+
outextlist.append('zlib');
|
|
325
|
+
outextlistwd.append('.zlib');
|
|
324
326
|
|
|
325
327
|
tarfile_mimetype = "application/tar";
|
|
326
328
|
tarfile_tar_mimetype = tarfile_mimetype;
|
|
@@ -344,7 +346,7 @@ archivefile_xz_mimetype = "application/x-"+__file_format_dict__['format_lower']+
|
|
|
344
346
|
archivefile_zlib_mimetype = "application/x-"+__file_format_dict__['format_lower']+"+zlib";
|
|
345
347
|
archivefile_zz_mimetype = archivefile_zlib_mimetype;
|
|
346
348
|
archivefile_zl_mimetype = archivefile_zlib_mimetype;
|
|
347
|
-
archivefile_extensions = [__file_format_extension__, __file_format_extension__+".gz", __file_format_extension__+".bz2", __file_format_extension__+".zst", __file_format_extension__+".lz4", __file_format_extension__+".lzo", __file_format_extension__+".lzop", __file_format_extension__+".lzma", __file_format_extension__+".xz", __file_format_extension__+".zz", __file_format_extension__+".zl"];
|
|
349
|
+
archivefile_extensions = [__file_format_extension__, __file_format_extension__+".gz", __file_format_extension__+".bz2", __file_format_extension__+".zst", __file_format_extension__+".lz4", __file_format_extension__+".lzo", __file_format_extension__+".lzop", __file_format_extension__+".lzma", __file_format_extension__+".xz", __file_format_extension__+".zz", __file_format_extension__+".zl", __file_format_extension__+".zlib"];
|
|
348
350
|
|
|
349
351
|
if __name__ == "__main__":
|
|
350
352
|
import subprocess;
|
|
@@ -525,7 +527,7 @@ def FormatSpecsListToDict(formatspecs=__file_format_list__):
|
|
|
525
527
|
return __file_format_dict__;
|
|
526
528
|
|
|
527
529
|
class ZlibFile:
|
|
528
|
-
def __init__(self, file_path=None, fileobj=None, mode='rb', level=9, encoding=None, errors=None, newline=None):
|
|
530
|
+
def __init__(self, file_path=None, fileobj=None, mode='rb', level=9, wbits=15, encoding=None, errors=None, newline=None):
|
|
529
531
|
if file_path is None and fileobj is None:
|
|
530
532
|
raise ValueError("Either file_path or fileobj must be provided");
|
|
531
533
|
if file_path is not None and fileobj is not None:
|
|
@@ -535,6 +537,7 @@ class ZlibFile:
|
|
|
535
537
|
self.fileobj = fileobj;
|
|
536
538
|
self.mode = mode;
|
|
537
539
|
self.level = level;
|
|
540
|
+
self.wbits = wbits;
|
|
538
541
|
self.encoding = encoding;
|
|
539
542
|
self.errors = errors;
|
|
540
543
|
self.newline = newline;
|
|
@@ -548,7 +551,7 @@ class ZlibFile:
|
|
|
548
551
|
|
|
549
552
|
if 'w' in mode or 'a' in mode or 'x' in mode:
|
|
550
553
|
self.file = open(file_path, internal_mode) if file_path else fileobj;
|
|
551
|
-
self._compressor = zlib.compressobj(level);
|
|
554
|
+
self._compressor = zlib.compressobj(level, zlib.DEFLATED, wbits);
|
|
552
555
|
elif 'r' in mode:
|
|
553
556
|
if file_path:
|
|
554
557
|
if os.path.exists(file_path):
|
|
@@ -567,7 +570,7 @@ class ZlibFile:
|
|
|
567
570
|
self._compressed_data = self.file.read();
|
|
568
571
|
if not self._compressed_data.startswith((b'\x78\x01', b'\x78\x5E', b'\x78\x9C', b'\x78\xDA')):
|
|
569
572
|
raise ValueError("Invalid zlib file header");
|
|
570
|
-
self._decompressed_data = zlib.decompress(self._compressed_data);
|
|
573
|
+
self._decompressed_data = zlib.decompress(self._compressed_data, self.wbits);
|
|
571
574
|
if self._text_mode:
|
|
572
575
|
self._decompressed_data = self._decompressed_data.decode(self.encoding or 'utf-8', self.errors or 'strict');
|
|
573
576
|
|
|
@@ -601,8 +604,7 @@ class ZlibFile:
|
|
|
601
604
|
return self._position;
|
|
602
605
|
|
|
603
606
|
def flush(self):
|
|
604
|
-
|
|
605
|
-
self.file.flush();
|
|
607
|
+
self.file.flush();
|
|
606
608
|
|
|
607
609
|
def fileno(self):
|
|
608
610
|
if hasattr(self.file, 'fileno'):
|
|
@@ -738,6 +740,222 @@ class GzipFile:
|
|
|
738
740
|
def __exit__(self, exc_type, exc_value, traceback):
|
|
739
741
|
self.close();
|
|
740
742
|
|
|
743
|
+
'''
|
|
744
|
+
class BloscFile:
|
|
745
|
+
def __init__(self, file_path=None, fileobj=None, mode='rb', level=9, encoding=None, errors=None, newline=None):
|
|
746
|
+
if file_path is None and fileobj is None:
|
|
747
|
+
raise ValueError("Either file_path or fileobj must be provided");
|
|
748
|
+
if file_path is not None and fileobj is not None:
|
|
749
|
+
raise ValueError("Only one of file_path or fileobj should be provided");
|
|
750
|
+
|
|
751
|
+
self.file_path = file_path;
|
|
752
|
+
self.fileobj = fileobj;
|
|
753
|
+
self.mode = mode;
|
|
754
|
+
self.level = level;
|
|
755
|
+
self.encoding = encoding;
|
|
756
|
+
self.errors = errors;
|
|
757
|
+
self.newline = newline;
|
|
758
|
+
self._compressed_data = b'';
|
|
759
|
+
self._decompressed_data = b'';
|
|
760
|
+
self._position = 0;
|
|
761
|
+
self._text_mode = 't' in mode;
|
|
762
|
+
|
|
763
|
+
# Force binary mode for internal handling
|
|
764
|
+
internal_mode = mode.replace('t', 'b');
|
|
765
|
+
|
|
766
|
+
if 'w' in mode or 'a' in mode or 'x' in mode:
|
|
767
|
+
self.file = open(file_path, internal_mode) if file_path else fileobj;
|
|
768
|
+
self._compressor = blosc.Blosc(level);
|
|
769
|
+
elif 'r' in mode:
|
|
770
|
+
if file_path:
|
|
771
|
+
if os.path.exists(file_path):
|
|
772
|
+
self.file = open(file_path, internal_mode);
|
|
773
|
+
self._load_file();
|
|
774
|
+
else:
|
|
775
|
+
raise FileNotFoundError("No such file: '{}'".format(file_path));
|
|
776
|
+
elif fileobj:
|
|
777
|
+
self.file = fileobj;
|
|
778
|
+
self._load_file();
|
|
779
|
+
else:
|
|
780
|
+
raise ValueError("Mode should be 'rb' or 'wb'");
|
|
781
|
+
|
|
782
|
+
def _load_file(self):
|
|
783
|
+
self.file.seek(0);
|
|
784
|
+
self._compressed_data = self.file.read();
|
|
785
|
+
if not self._compressed_data:
|
|
786
|
+
raise ValueError("Invalid blosc file header");
|
|
787
|
+
self._decompressed_data = blosc.decompress(self._compressed_data);
|
|
788
|
+
if self._text_mode:
|
|
789
|
+
self._decompressed_data = self._decompressed_data.decode(self.encoding or 'utf-8', self.errors or 'strict');
|
|
790
|
+
|
|
791
|
+
def write(self, data):
|
|
792
|
+
if self._text_mode:
|
|
793
|
+
data = data.encode(self.encoding or 'utf-8', self.errors or 'strict');
|
|
794
|
+
compressed_data = blosc.compress(data, cname='blosclz', clevel=self.level);
|
|
795
|
+
self.file.write(compressed_data);
|
|
796
|
+
self.file.flush();
|
|
797
|
+
|
|
798
|
+
def read(self, size=-1):
|
|
799
|
+
if size == -1:
|
|
800
|
+
size = len(self._decompressed_data) - self._position;
|
|
801
|
+
data = self._decompressed_data[self._position:self._position + size];
|
|
802
|
+
self._position += size;
|
|
803
|
+
return data;
|
|
804
|
+
|
|
805
|
+
def seek(self, offset, whence=0):
|
|
806
|
+
if whence == 0: # absolute file positioning
|
|
807
|
+
self._position = offset;
|
|
808
|
+
elif whence == 1: # seek relative to the current position
|
|
809
|
+
self._position += offset;
|
|
810
|
+
elif whence == 2: # seek relative to the file's end
|
|
811
|
+
self._position = len(self._decompressed_data) + offset;
|
|
812
|
+
else:
|
|
813
|
+
raise ValueError("Invalid value for whence");
|
|
814
|
+
|
|
815
|
+
# Ensure the position is within bounds
|
|
816
|
+
self._position = max(0, min(self._position, len(self._decompressed_data)));
|
|
817
|
+
|
|
818
|
+
def tell(self):
|
|
819
|
+
return self._position;
|
|
820
|
+
|
|
821
|
+
def flush(self):
|
|
822
|
+
self.file.flush();
|
|
823
|
+
|
|
824
|
+
def fileno(self):
|
|
825
|
+
if hasattr(self.file, 'fileno'):
|
|
826
|
+
return self.file.fileno();
|
|
827
|
+
raise OSError("The underlying file object does not support fileno()");
|
|
828
|
+
|
|
829
|
+
def isatty(self):
|
|
830
|
+
if hasattr(self.file, 'isatty'):
|
|
831
|
+
return self.file.isatty();
|
|
832
|
+
return False;
|
|
833
|
+
|
|
834
|
+
def truncate(self, size=None):
|
|
835
|
+
if hasattr(self.file, 'truncate'):
|
|
836
|
+
return self.file.truncate(size);
|
|
837
|
+
raise OSError("The underlying file object does not support truncate()");
|
|
838
|
+
|
|
839
|
+
def close(self):
|
|
840
|
+
if 'w' in self.mode or 'a' in self.mode or 'x' in self.mode:
|
|
841
|
+
self.file.write(blosc.compress(self._compressor.flush(), cname='blosclz', clevel=self.level));
|
|
842
|
+
if self.file_path:
|
|
843
|
+
self.file.close();
|
|
844
|
+
|
|
845
|
+
def __enter__(self):
|
|
846
|
+
return self;
|
|
847
|
+
|
|
848
|
+
def __exit__(self, exc_type, exc_value, traceback):
|
|
849
|
+
self.close();
|
|
850
|
+
|
|
851
|
+
class BrotliFile:
|
|
852
|
+
def __init__(self, file_path=None, fileobj=None, mode='rb', level=11, encoding=None, errors=None, newline=None):
|
|
853
|
+
if file_path is None and fileobj is None:
|
|
854
|
+
raise ValueError("Either file_path or fileobj must be provided");
|
|
855
|
+
if file_path is not None and fileobj is not None:
|
|
856
|
+
raise ValueError("Only one of file_path or fileobj should be provided");
|
|
857
|
+
|
|
858
|
+
self.file_path = file_path;
|
|
859
|
+
self.fileobj = fileobj;
|
|
860
|
+
self.mode = mode;
|
|
861
|
+
self.level = level;
|
|
862
|
+
self.encoding = encoding;
|
|
863
|
+
self.errors = errors;
|
|
864
|
+
self.newline = newline;
|
|
865
|
+
self._compressed_data = b'';
|
|
866
|
+
self._decompressed_data = b'';
|
|
867
|
+
self._position = 0;
|
|
868
|
+
self._text_mode = 't' in mode;
|
|
869
|
+
|
|
870
|
+
# Force binary mode for internal handling
|
|
871
|
+
internal_mode = mode.replace('t', 'b');
|
|
872
|
+
|
|
873
|
+
if 'w' in mode or 'a' in mode or 'x' in mode:
|
|
874
|
+
self.file = open(file_path, internal_mode) if file_path else fileobj;
|
|
875
|
+
self._compressor = brotli.Compressor(quality=self.level);
|
|
876
|
+
elif 'r' in mode:
|
|
877
|
+
if file_path:
|
|
878
|
+
if os.path.exists(file_path):
|
|
879
|
+
self.file = open(file_path, internal_mode);
|
|
880
|
+
self._load_file();
|
|
881
|
+
else:
|
|
882
|
+
raise FileNotFoundError("No such file: '{}'".format(file_path));
|
|
883
|
+
elif fileobj:
|
|
884
|
+
self.file = fileobj;
|
|
885
|
+
self._load_file();
|
|
886
|
+
else:
|
|
887
|
+
raise ValueError("Mode should be 'rb' or 'wb'");
|
|
888
|
+
|
|
889
|
+
def _load_file(self):
|
|
890
|
+
self.file.seek(0);
|
|
891
|
+
self._compressed_data = self.file.read();
|
|
892
|
+
if not self._compressed_data:
|
|
893
|
+
raise ValueError("Invalid brotli file header");
|
|
894
|
+
self._decompressed_data = brotli.decompress(self._compressed_data);
|
|
895
|
+
if self._text_mode:
|
|
896
|
+
self._decompressed_data = self._decompressed_data.decode(self.encoding or 'utf-8', self.errors or 'strict');
|
|
897
|
+
|
|
898
|
+
def write(self, data):
|
|
899
|
+
if self._text_mode:
|
|
900
|
+
data = data.encode(self.encoding or 'utf-8', self.errors or 'strict');
|
|
901
|
+
compressed_data = self._compressor.process(data);
|
|
902
|
+
self.file.write(compressed_data);
|
|
903
|
+
self.file.flush();
|
|
904
|
+
|
|
905
|
+
def read(self, size=-1):
|
|
906
|
+
if size == -1:
|
|
907
|
+
size = len(self._decompressed_data) - self._position;
|
|
908
|
+
data = self._decompressed_data[self._position:self._position + size];
|
|
909
|
+
self._position += size;
|
|
910
|
+
return data;
|
|
911
|
+
|
|
912
|
+
def seek(self, offset, whence=0):
|
|
913
|
+
if whence == 0: # absolute file positioning
|
|
914
|
+
self._position = offset;
|
|
915
|
+
elif whence == 1: # seek relative to the current position
|
|
916
|
+
self._position += offset;
|
|
917
|
+
elif whence == 2: # seek relative to the file's end
|
|
918
|
+
self._position = len(self._decompressed_data) + offset;
|
|
919
|
+
else:
|
|
920
|
+
raise ValueError("Invalid value for whence");
|
|
921
|
+
|
|
922
|
+
# Ensure the position is within bounds
|
|
923
|
+
self._position = max(0, min(self._position, len(self._decompressed_data)));
|
|
924
|
+
|
|
925
|
+
def tell(self):
|
|
926
|
+
return self._position;
|
|
927
|
+
|
|
928
|
+
def flush(self):
|
|
929
|
+
self.file.flush();
|
|
930
|
+
|
|
931
|
+
def fileno(self):
|
|
932
|
+
if hasattr(self.file, 'fileno'):
|
|
933
|
+
return self.file.fileno();
|
|
934
|
+
raise OSError("The underlying file object does not support fileno()");
|
|
935
|
+
|
|
936
|
+
def isatty(self):
|
|
937
|
+
if hasattr(self.file, 'isatty'):
|
|
938
|
+
return self.file.isatty();
|
|
939
|
+
return False;
|
|
940
|
+
|
|
941
|
+
def truncate(self, size=None):
|
|
942
|
+
if hasattr(self.file, 'truncate'):
|
|
943
|
+
return self.file.truncate(size);
|
|
944
|
+
raise OSError("The underlying file object does not support truncate()");
|
|
945
|
+
|
|
946
|
+
def close(self):
|
|
947
|
+
if 'w' in self.mode or 'a' in self.mode or 'x' in self.mode:
|
|
948
|
+
self.file.write(self._compressor.finish());
|
|
949
|
+
if self.file_path:
|
|
950
|
+
self.file.close();
|
|
951
|
+
|
|
952
|
+
def __enter__(self):
|
|
953
|
+
return self;
|
|
954
|
+
|
|
955
|
+
def __exit__(self, exc_type, exc_value, traceback):
|
|
956
|
+
self.close();
|
|
957
|
+
'''
|
|
958
|
+
|
|
741
959
|
def TarFileCheck(infile):
|
|
742
960
|
try:
|
|
743
961
|
if is_tarfile(infile):
|
|
@@ -1634,7 +1852,7 @@ def ReadInFileBySizeWithContentToArray(infile, seekstart=0, seekend=0, listonly=
|
|
|
1634
1852
|
compresscheck = "lzma";
|
|
1635
1853
|
elif(fextname==".xz"):
|
|
1636
1854
|
compresscheck = "xz";
|
|
1637
|
-
elif(fextname==".zz" or fextname==".zl"):
|
|
1855
|
+
elif(fextname==".zz" or fextname==".zl" or fextname==".zlib"):
|
|
1638
1856
|
compresscheck = "zlib";
|
|
1639
1857
|
else:
|
|
1640
1858
|
return False;
|
|
@@ -1696,7 +1914,7 @@ def ReadInFileBySizeWithContentToList(infile, seekstart=0, seekend=0, listonly=F
|
|
|
1696
1914
|
compresscheck = "lzma";
|
|
1697
1915
|
elif(fextname==".xz"):
|
|
1698
1916
|
compresscheck = "xz";
|
|
1699
|
-
elif(fextname==".zz" or fextname==".zl"):
|
|
1917
|
+
elif(fextname==".zz" or fextname==".zl" or fextname==".zlib"):
|
|
1700
1918
|
compresscheck = "zlib";
|
|
1701
1919
|
else:
|
|
1702
1920
|
return False;
|
|
@@ -2418,7 +2636,7 @@ def GetCompressionMimeType(infile, formatspecs=__file_format_dict__):
|
|
|
2418
2636
|
compresscheck = CheckCompressionType(fp, formatspecs, False);
|
|
2419
2637
|
if(compresscheck=="gzip" or compresscheck=="gz"):
|
|
2420
2638
|
return archivefile_gzip_mimetype;
|
|
2421
|
-
if(compresscheck=="zlib" or (compresscheck=="zz" or compresscheck=="zl")):
|
|
2639
|
+
if(compresscheck=="zlib" or (compresscheck=="zz" or compresscheck=="zl" or compresscheck=="zlib")):
|
|
2422
2640
|
return archivefile_zlib_mimetype;
|
|
2423
2641
|
if(compresscheck=="bzip2" or compresscheck=="bz2"):
|
|
2424
2642
|
return archivefile_bzip2_mimetype;
|
|
@@ -2446,22 +2664,18 @@ def UncompressArchiveFile(fp, formatspecs=__file_format_dict__):
|
|
|
2446
2664
|
if(compresscheck=="gzip" and compresscheck in compressionsupport):
|
|
2447
2665
|
catfp = gzip.GzipFile(fileobj=fp, mode="rb");
|
|
2448
2666
|
elif(compresscheck=="bzip2" and compresscheck in compressionsupport):
|
|
2449
|
-
catfp =
|
|
2450
|
-
catfp.write(bz2.decompress(fp.read()));
|
|
2667
|
+
catfp = bz2.BZ2File(fp);
|
|
2451
2668
|
elif(compresscheck=="zstd" and compresscheck in compressionsupport):
|
|
2452
|
-
catfp =
|
|
2453
|
-
catfp.write(zstandard.decompress(fp.read()));
|
|
2669
|
+
catfp = zstd.ZstdDecompressor().stream_reader(fp);
|
|
2454
2670
|
elif(compresscheck=="lz4" and compresscheck in compressionsupport):
|
|
2455
|
-
catfp =
|
|
2456
|
-
catfp.write(lz4.frame.decompress(fp.read()));
|
|
2671
|
+
catfp = lz4.frame.open_fp(fp, mode='rb');
|
|
2457
2672
|
elif((compresscheck=="lzo" or compresscheck=="lzop") and compresscheck in compressionsupport):
|
|
2458
2673
|
catfp = BytesIO();
|
|
2674
|
+
catfp.write(lzo.decompress(fp.read()));
|
|
2459
2675
|
elif((compresscheck=="lzma" or compresscheck=="xz") and compresscheck in compressionsupport):
|
|
2460
|
-
catfp =
|
|
2461
|
-
catfp.write(lzma.decompress(fp.read()));
|
|
2676
|
+
catfp = lzma.LZMAFile(fp);
|
|
2462
2677
|
elif(compresscheck=="zlib" and compresscheck in compressionsupport):
|
|
2463
2678
|
catfp = ZlibFile(fileobj=fp, mode="rb");
|
|
2464
|
-
catfp.write(lzo.decompress(fp.read()));
|
|
2465
2679
|
if(compresscheck=="catfile" or compresscheck==formatspecs['format_lower']):
|
|
2466
2680
|
catfp = fp;
|
|
2467
2681
|
if(not compresscheck):
|
|
@@ -2537,6 +2751,10 @@ def UncompressFile(infile, formatspecs=__file_format_dict__, mode="rb"):
|
|
|
2537
2751
|
filefp = open(infile, mode);
|
|
2538
2752
|
except FileNotFoundError:
|
|
2539
2753
|
return False;
|
|
2754
|
+
try:
|
|
2755
|
+
filefp.write_through = True;
|
|
2756
|
+
except AttributeError:
|
|
2757
|
+
pass;
|
|
2540
2758
|
return filefp;
|
|
2541
2759
|
|
|
2542
2760
|
def UncompressString(infile):
|
|
@@ -2591,7 +2809,7 @@ def CheckCompressionSubType(infile, formatspecs=__file_format_dict__, closefp=Tr
|
|
|
2591
2809
|
compresscheck = "lzma";
|
|
2592
2810
|
elif(fextname==".xz"):
|
|
2593
2811
|
compresscheck = "xz";
|
|
2594
|
-
elif(fextname==".zz" or fextname==".zl"):
|
|
2812
|
+
elif(fextname==".zz" or fextname==".zl" or fextname==".zlib"):
|
|
2595
2813
|
compresscheck = "zlib";
|
|
2596
2814
|
else:
|
|
2597
2815
|
return False;
|
|
@@ -2807,10 +3025,14 @@ def CompressOpenFile(outfile, compressionenable=True, compressionlevel=None):
|
|
|
2807
3025
|
outfp = lzma.open(outfile, mode, format=lzma.FORMAT_ALONE, filters=[{"id": lzma.FILTER_LZMA1, "preset": compressionlevel}], encoding="UTF-8");
|
|
2808
3026
|
except (ValueError, TypeError) as e:
|
|
2809
3027
|
outfp = lzma.open(outfile, mode, format=lzma.FORMAT_ALONE, filters=[{"id": lzma.FILTER_LZMA1, "preset": compressionlevel}]);
|
|
2810
|
-
elif((fextname==".zz" or fextname==".zl") and "zlib" in compressionsupport):
|
|
3028
|
+
elif((fextname==".zz" or fextname==".zl" or fextname==".zlib") and "zlib" in compressionsupport):
|
|
2811
3029
|
outfp = ZlibFile(outfile, mode=mode, level=compressionlevel);
|
|
2812
3030
|
except FileNotFoundError:
|
|
2813
3031
|
return False;
|
|
3032
|
+
try:
|
|
3033
|
+
outfp.write_through = True;
|
|
3034
|
+
except AttributeError:
|
|
3035
|
+
pass;
|
|
2814
3036
|
return outfp;
|
|
2815
3037
|
|
|
2816
3038
|
def GetDevMajorMinor(fdev):
|
|
@@ -4242,7 +4464,7 @@ def ArchiveFileSeekToFileNum(infile, seekto=0, listonly=False, skipchecksum=Fals
|
|
|
4242
4464
|
compresscheck = "lzma";
|
|
4243
4465
|
elif(fextname==".xz"):
|
|
4244
4466
|
compresscheck = "xz";
|
|
4245
|
-
elif(fextname==".zz" or fextname==".zl"):
|
|
4467
|
+
elif(fextname==".zz" or fextname==".zl" or fextname==".zlib"):
|
|
4246
4468
|
compresscheck = "zlib";
|
|
4247
4469
|
else:
|
|
4248
4470
|
return False;
|
|
@@ -4475,7 +4697,7 @@ def ArchiveFileSeekToFileName(infile, seekfile=None, listonly=False, skipchecksu
|
|
|
4475
4697
|
compresscheck = "lzma";
|
|
4476
4698
|
elif(fextname==".xz"):
|
|
4477
4699
|
compresscheck = "xz";
|
|
4478
|
-
elif(fextname==".zz" or fextname==".zl"):
|
|
4700
|
+
elif(fextname==".zz" or fextname==".zl" or fextname==".zlib"):
|
|
4479
4701
|
compresscheck = "zlib";
|
|
4480
4702
|
else:
|
|
4481
4703
|
return False;
|
|
@@ -4720,7 +4942,7 @@ def ArchiveFileValidate(infile, formatspecs=__file_format_dict__, verbose=False,
|
|
|
4720
4942
|
compresscheck = "lzma";
|
|
4721
4943
|
elif(fextname==".xz"):
|
|
4722
4944
|
compresscheck = "xz";
|
|
4723
|
-
elif(fextname==".zz" or fextname==".zl"):
|
|
4945
|
+
elif(fextname==".zz" or fextname==".zl" or fextname==".zlib"):
|
|
4724
4946
|
compresscheck = "zlib";
|
|
4725
4947
|
else:
|
|
4726
4948
|
return False;
|
|
@@ -4964,7 +5186,7 @@ def ArchiveFileToArray(infile, seekstart=0, seekend=0, listonly=False, uncompres
|
|
|
4964
5186
|
compresscheck = "lzma";
|
|
4965
5187
|
elif(fextname==".xz"):
|
|
4966
5188
|
compresscheck = "xz";
|
|
4967
|
-
elif(fextname==".zz" or fextname==".zl"):
|
|
5189
|
+
elif(fextname==".zz" or fextname==".zl" or fextname==".zlib"):
|
|
4968
5190
|
compresscheck = "zlib";
|
|
4969
5191
|
else:
|
|
4970
5192
|
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: 6/
|
|
16
|
+
$FileInfo: setup.py - Last Update: 6/14/2024 Ver. 0.13.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
|