diff --git a/CHANGELOG.rst b/CHANGELOG.rst index e68a8e4..76712e3 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -12,6 +12,8 @@ version 0.5.0-dev + Wheels are now build for MacOS arm64 architectures. + Fix a bug where READ and WRITE in zlib_ng.gzip_ng were inconsistent with the values in gzip on Python 3.13 ++ Small simplifications to the ``gzip_ng.compress`` and ``gzip_ng.decompress`` + functions, which should lead to less overhead. version 0.4.3 ----------------- diff --git a/src/zlib_ng/gzip_ng.py b/src/zlib_ng/gzip_ng.py index 24b5512..f24bdbe 100644 --- a/src/zlib_ng/gzip_ng.py +++ b/src/zlib_ng/gzip_ng.py @@ -22,6 +22,7 @@ import gzip import io import os +import shutil import struct import sys import time @@ -180,50 +181,27 @@ def write(self, data): _GzipNGReader = _GzipReader -def _create_simple_gzip_header(compresslevel: int, - mtime=None) -> bytes: - """ - Write a simple gzip header with no extra fields. - :param compresslevel: Compresslevel used to determine the xfl bytes. - :param mtime: The mtime (must support conversion to a 32-bit integer). - :return: A bytes object representing the gzip header. - """ - if mtime is None: - mtime = time.time() - if compresslevel == _COMPRESS_LEVEL_BEST: - xfl = 2 - elif compresslevel == _COMPRESS_LEVEL_FAST: - xfl = 4 - else: - xfl = 0 - # Pack ID1 and ID2 magic bytes, method (8=deflate), header flags (no extra - # fields added to header), mtime, xfl and os (255 for unknown OS). - return struct.pack("