zipremove 0.6.0__tar.gz → 0.7.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.
- {zipremove-0.6.0/src/zipremove.egg-info → zipremove-0.7.0}/PKG-INFO +1 -10
- {zipremove-0.6.0 → zipremove-0.7.0}/setup.cfg +1 -13
- {zipremove-0.6.0 → zipremove-0.7.0}/src/zipremove/__init__.py +1 -11
- {zipremove-0.6.0 → zipremove-0.7.0/src/zipremove.egg-info}/PKG-INFO +1 -10
- {zipremove-0.6.0 → zipremove-0.7.0}/src/zipremove.egg-info/SOURCES.txt +0 -1
- {zipremove-0.6.0 → zipremove-0.7.0}/tests/test_zipfile.py +0 -62
- zipremove-0.6.0/src/zipremove.egg-info/requires.txt +0 -10
- {zipremove-0.6.0 → zipremove-0.7.0}/LICENSE.txt +0 -0
- {zipremove-0.6.0 → zipremove-0.7.0}/README.md +0 -0
- {zipremove-0.6.0 → zipremove-0.7.0}/pyproject.toml +0 -0
- {zipremove-0.6.0 → zipremove-0.7.0}/setup.py +0 -0
- {zipremove-0.6.0 → zipremove-0.7.0}/src/zipremove.egg-info/dependency_links.txt +0 -0
- {zipremove-0.6.0 → zipremove-0.7.0}/src/zipremove.egg-info/top_level.txt +0 -0
- {zipremove-0.6.0 → zipremove-0.7.0}/tests/test_zipfile64.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: zipremove
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.7.0
|
|
4
4
|
Summary: Extend `zipfile` with `remove`-related functionalities
|
|
5
5
|
Home-page: https://github.com/danny0838/zipremove
|
|
6
6
|
Author: Danny Lin
|
|
@@ -21,15 +21,6 @@ Classifier: Operating System :: OS Independent
|
|
|
21
21
|
Requires-Python: ~=3.9
|
|
22
22
|
Description-Content-Type: text/markdown
|
|
23
23
|
License-File: LICENSE.txt
|
|
24
|
-
Provides-Extra: dev
|
|
25
|
-
Requires-Dist: tox>=4.0; extra == "dev"
|
|
26
|
-
Requires-Dist: build; extra == "dev"
|
|
27
|
-
Requires-Dist: twine>=4.0; extra == "dev"
|
|
28
|
-
Requires-Dist: flake8>=5.0; extra == "dev"
|
|
29
|
-
Requires-Dist: flake8-comprehensions>=3.12; extra == "dev"
|
|
30
|
-
Requires-Dist: flake8-bugbear>=22.0; extra == "dev"
|
|
31
|
-
Requires-Dist: flake8-isort>=6.0; extra == "dev"
|
|
32
|
-
Requires-Dist: isort>=5.5; extra == "dev"
|
|
33
24
|
Dynamic: license-file
|
|
34
25
|
|
|
35
26
|

|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[metadata]
|
|
2
2
|
name = zipremove
|
|
3
|
-
version = 0.
|
|
3
|
+
version = 0.7.0
|
|
4
4
|
author = Danny Lin
|
|
5
5
|
author_email = danny0838@gmail.com
|
|
6
6
|
url = https://github.com/danny0838/zipremove
|
|
@@ -25,18 +25,6 @@ classifiers =
|
|
|
25
25
|
[options]
|
|
26
26
|
python_requires = ~=3.9
|
|
27
27
|
|
|
28
|
-
[options.extras_require]
|
|
29
|
-
dev =
|
|
30
|
-
tox >= 4.0
|
|
31
|
-
build
|
|
32
|
-
twine >= 4.0
|
|
33
|
-
|
|
34
|
-
flake8 >= 5.0
|
|
35
|
-
flake8-comprehensions >= 3.12
|
|
36
|
-
flake8-bugbear >= 22.0
|
|
37
|
-
flake8-isort >= 6.0
|
|
38
|
-
isort >= 5.5
|
|
39
|
-
|
|
40
28
|
[flake8]
|
|
41
29
|
exclude =
|
|
42
30
|
.git
|
|
@@ -177,8 +177,7 @@ class _ZipRepacker:
|
|
|
177
177
|
|
|
178
178
|
Side effects:
|
|
179
179
|
- Modifies the ZIP file in place.
|
|
180
|
-
- Updates zfile.start_dir
|
|
181
|
-
removed data.
|
|
180
|
+
- Updates zfile.start_dir to account for removed data.
|
|
182
181
|
- Sets zfile._didModify to True.
|
|
183
182
|
- Updates header_offset and clears _end_offset of referenced
|
|
184
183
|
ZipInfo instances.
|
|
@@ -283,15 +282,6 @@ class _ZipRepacker:
|
|
|
283
282
|
zfile.start_dir -= entry_offset
|
|
284
283
|
zfile._didModify = True
|
|
285
284
|
|
|
286
|
-
# polyfill: update _data_offset if exists
|
|
287
|
-
if getattr(zfile, '_data_offset', None):
|
|
288
|
-
try:
|
|
289
|
-
offset = filelist[0].header_offset
|
|
290
|
-
except IndexError:
|
|
291
|
-
offset = zfile.start_dir
|
|
292
|
-
if offset < zfile._data_offset:
|
|
293
|
-
zfile._data_offset = offset
|
|
294
|
-
|
|
295
285
|
# polyfill: clear ZipInfo._end_offset if exists
|
|
296
286
|
# (Python >= 3.8 with fix #109858)
|
|
297
287
|
if hasattr(ZipInfo, '_end_offset'):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: zipremove
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.7.0
|
|
4
4
|
Summary: Extend `zipfile` with `remove`-related functionalities
|
|
5
5
|
Home-page: https://github.com/danny0838/zipremove
|
|
6
6
|
Author: Danny Lin
|
|
@@ -21,15 +21,6 @@ Classifier: Operating System :: OS Independent
|
|
|
21
21
|
Requires-Python: ~=3.9
|
|
22
22
|
Description-Content-Type: text/markdown
|
|
23
23
|
License-File: LICENSE.txt
|
|
24
|
-
Provides-Extra: dev
|
|
25
|
-
Requires-Dist: tox>=4.0; extra == "dev"
|
|
26
|
-
Requires-Dist: build; extra == "dev"
|
|
27
|
-
Requires-Dist: twine>=4.0; extra == "dev"
|
|
28
|
-
Requires-Dist: flake8>=5.0; extra == "dev"
|
|
29
|
-
Requires-Dist: flake8-comprehensions>=3.12; extra == "dev"
|
|
30
|
-
Requires-Dist: flake8-bugbear>=22.0; extra == "dev"
|
|
31
|
-
Requires-Dist: flake8-isort>=6.0; extra == "dev"
|
|
32
|
-
Requires-Dist: isort>=5.5; extra == "dev"
|
|
33
24
|
Dynamic: license-file
|
|
34
25
|
|
|
35
26
|

|
|
@@ -7,7 +7,6 @@ src/zipremove/__init__.py
|
|
|
7
7
|
src/zipremove.egg-info/PKG-INFO
|
|
8
8
|
src/zipremove.egg-info/SOURCES.txt
|
|
9
9
|
src/zipremove.egg-info/dependency_links.txt
|
|
10
|
-
src/zipremove.egg-info/requires.txt
|
|
11
10
|
src/zipremove.egg-info/top_level.txt
|
|
12
11
|
tests/test_zipfile.py
|
|
13
12
|
tests/test_zipfile64.py
|
|
@@ -985,67 +985,9 @@ class AbstractRepackTests(RepackHelperMixin):
|
|
|
985
985
|
fh.write(b'dummy ')
|
|
986
986
|
fh.write(fz.read())
|
|
987
987
|
with zipfile.ZipFile(TESTFN, 'a', self.compression) as zh:
|
|
988
|
-
if hasattr(zh, 'data_offset'):
|
|
989
|
-
self.assertEqual(zh.data_offset, 6)
|
|
990
988
|
for i in ii:
|
|
991
989
|
zh.remove(self.test_files[i][0])
|
|
992
990
|
zh.repack()
|
|
993
|
-
if hasattr(zh, 'data_offset'):
|
|
994
|
-
self.assertEqual(zh.data_offset, 6)
|
|
995
|
-
|
|
996
|
-
# check infolist
|
|
997
|
-
self.assertEqual(
|
|
998
|
-
[ComparableZipInfo(zi) for zi in zh.infolist()],
|
|
999
|
-
[ComparableZipInfo(zi) for zi in expected_zinfos],
|
|
1000
|
-
)
|
|
1001
|
-
|
|
1002
|
-
# check file size
|
|
1003
|
-
self.assertEqual(os.path.getsize(TESTFN), expected_size)
|
|
1004
|
-
|
|
1005
|
-
# make sure the zip file is still valid
|
|
1006
|
-
with zipfile.ZipFile(TESTFN) as zh:
|
|
1007
|
-
self.assertIsNone(zh.testzip())
|
|
1008
|
-
|
|
1009
|
-
def test_repack_prepended_file_entry(self):
|
|
1010
|
-
for ii in ([0], [0, 1], [0, 1, 2]):
|
|
1011
|
-
with self.subTest(remove=ii):
|
|
1012
|
-
# calculate the expected results
|
|
1013
|
-
fz = io.BytesIO()
|
|
1014
|
-
test_files = [data for j, data in enumerate(self.test_files) if j not in ii]
|
|
1015
|
-
self._prepare_zip_from_test_files(fz, test_files)
|
|
1016
|
-
fz.seek(0)
|
|
1017
|
-
with open(TESTFN, 'wb') as fh:
|
|
1018
|
-
fh.write(b'dummy ')
|
|
1019
|
-
fh.write(fz.read())
|
|
1020
|
-
with zipfile.ZipFile(TESTFN) as zh:
|
|
1021
|
-
expected_zinfos = list(zh.infolist())
|
|
1022
|
-
expected_size = os.path.getsize(TESTFN)
|
|
1023
|
-
|
|
1024
|
-
# do the removal and check the result
|
|
1025
|
-
fz = io.BytesIO()
|
|
1026
|
-
with zipfile.ZipFile(fz, 'w') as zh:
|
|
1027
|
-
for j, (file, data) in enumerate(self.test_files):
|
|
1028
|
-
if j in ii:
|
|
1029
|
-
zh.writestr(file, data)
|
|
1030
|
-
fz.seek(0)
|
|
1031
|
-
prefix = fz.read()
|
|
1032
|
-
|
|
1033
|
-
fz = io.BytesIO()
|
|
1034
|
-
test_files = [data for j, data in enumerate(self.test_files) if j not in ii]
|
|
1035
|
-
self._prepare_zip_from_test_files(fz, test_files)
|
|
1036
|
-
fz.seek(0)
|
|
1037
|
-
|
|
1038
|
-
with open(TESTFN, 'wb') as fh:
|
|
1039
|
-
fh.write(b'dummy ')
|
|
1040
|
-
fh.write(prefix)
|
|
1041
|
-
fh.write(fz.read())
|
|
1042
|
-
|
|
1043
|
-
with zipfile.ZipFile(TESTFN, 'a', self.compression) as zh:
|
|
1044
|
-
if hasattr(zh, 'data_offset'):
|
|
1045
|
-
self.assertEqual(zh.data_offset, 6 + len(prefix))
|
|
1046
|
-
zh.repack()
|
|
1047
|
-
if hasattr(zh, 'data_offset'):
|
|
1048
|
-
self.assertEqual(zh.data_offset, 6)
|
|
1049
991
|
|
|
1050
992
|
# check infolist
|
|
1051
993
|
self.assertEqual(
|
|
@@ -1235,12 +1177,8 @@ class AbstractRepackTests(RepackHelperMixin):
|
|
|
1235
1177
|
fh.write(b'dummy ')
|
|
1236
1178
|
fh.write(fz.read())
|
|
1237
1179
|
with zipfile.ZipFile(TESTFN, 'a', self.compression) as zh:
|
|
1238
|
-
if hasattr(zh, 'data_offset'):
|
|
1239
|
-
self.assertEqual(zh.data_offset, 6)
|
|
1240
1180
|
zinfos = [zh.remove(self.test_files[i][0]) for i in ii]
|
|
1241
1181
|
zh.repack(zinfos)
|
|
1242
|
-
if hasattr(zh, 'data_offset'):
|
|
1243
|
-
self.assertEqual(zh.data_offset, 6)
|
|
1244
1182
|
|
|
1245
1183
|
# check infolist
|
|
1246
1184
|
self.assertEqual(
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|