From 7778db0108d3a734b0e578f7831e1896c80f2498 Mon Sep 17 00:00:00 2001 From: DaryaDoronina Date: Mon, 30 Jul 2018 15:51:06 +0700 Subject: [PATCH 1/5] Add possibility to write directories from based on `arcname` If `arcname` ends with os path separator (e.g. '\'), it is written to archive as a directory --- zipstream/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/zipstream/__init__.py b/zipstream/__init__.py index a176935..1bf2987 100644 --- a/zipstream/__init__.py +++ b/zipstream/__init__.py @@ -243,7 +243,8 @@ def __write(self, filename=None, iterable=None, arcname=None, compress_type=None mtime = time.localtime(st.st_mtime) date_time = mtime[0:6] else: - st, isdir, date_time = None, False, time.localtime()[0:6] + st, date_time = None, time.localtime()[0:6] + isdir = arcname[-1] == os.sep # Create ZipInfo instance to store file information if arcname is None: arcname = filename From 72148061bc99b96ad2d9cf51d13016b5572675b0 Mon Sep 17 00:00:00 2001 From: Kseniya Shaydurova Date: Fri, 1 Feb 2019 12:29:29 +0700 Subject: [PATCH 2/5] Fix bug with macOS archives decompressing There was a bug in macOS that archive with directories couldn't be correctly decompressed. It happened because of folders `ZipInfo` creation and wrong flag_bits for this case --- zipstream/__init__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/zipstream/__init__.py b/zipstream/__init__.py index 1bf2987..42e0fb5 100644 --- a/zipstream/__init__.py +++ b/zipstream/__init__.py @@ -281,6 +281,9 @@ def __write(self, filename=None, iterable=None, arcname=None, compress_type=None zinfo.file_size = 0 zinfo.compress_size = 0 zinfo.CRC = 0 + # use `0` bits flag for folders - because of bug with opening + # archives with folders ZipInfo on macOS (couldn't be decompressed) + zinfo.flag_bits = 0 self.filelist.append(zinfo) self.NameToInfo[zinfo.filename] = zinfo yield self.fp.write(zinfo.FileHeader(False)) From 216e22833e78838a6ecc2160a5e9d3eaa8614154 Mon Sep 17 00:00:00 2001 From: Kseniya Shaydurova Date: Fri, 1 Feb 2019 13:51:10 +0700 Subject: [PATCH 3/5] Change created dirs rights to 777 Fixes errors with permissions on macOS and Linux --- zipstream/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/zipstream/__init__.py b/zipstream/__init__.py index 42e0fb5..776016b 100644 --- a/zipstream/__init__.py +++ b/zipstream/__init__.py @@ -257,7 +257,7 @@ def __write(self, filename=None, iterable=None, arcname=None, compress_type=None if st: zinfo.external_attr = (st[0] & 0xFFFF) << 16 # Unix attributes else: - zinfo.external_attr = 0o600 << 16 # ?rw------- + zinfo.external_attr = 0o777 << 16 # ?drwxr-xr-x if compress_type is None: zinfo.compress_type = self.compression else: @@ -284,6 +284,7 @@ def __write(self, filename=None, iterable=None, arcname=None, compress_type=None # use `0` bits flag for folders - because of bug with opening # archives with folders ZipInfo on macOS (couldn't be decompressed) zinfo.flag_bits = 0 + zinfo.external_attr |= 0x10 # MS-DOS directory flag self.filelist.append(zinfo) self.NameToInfo[zinfo.filename] = zinfo yield self.fp.write(zinfo.FileHeader(False)) From be07c9d683fbfff130333a7e13e40e3ebe299f8f Mon Sep 17 00:00:00 2001 From: grigory Date: Mon, 14 Dec 2020 15:29:01 +0700 Subject: [PATCH 4/5] Update supported python versions --- .travis.yml | 10 ++++------ tox.ini | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 49a0120..66deb0a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,12 +1,10 @@ language: python python: - - "2.6" - - "2.7" - - "3.2" - - "3.3" - - "3.4" - "3.5" - - "pypy" + - "3.6" + - "3.7" + - "3.8" + - "3.9" install: - "pip install ." script: nosetests diff --git a/tox.ini b/tox.ini index 8302cc5..16c748f 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py26, py27, py32, py33, py34, py35, pypy +envlist = py35, py36, py37, py38, py39 [testenv] deps=nose From e288e9e6e00c44d8441ae3aee33aa5e1f3bccc64 Mon Sep 17 00:00:00 2001 From: Roman Chubar Date: Fri, 20 Sep 2024 17:30:09 +0300 Subject: [PATCH 5/5] Update README.markdown --- README.markdown | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.markdown b/README.markdown index 1fe72e8..ee17d53 100644 --- a/README.markdown +++ b/README.markdown @@ -1,3 +1,5 @@ +# Deprecated ⚠️ +Moved to: https://github.com/saritasa-nest/usummit-python-zipstream # python-zipstream