zip archives: keep individual files compression type
While hardcoding the compression to zipfile.ZIP_DEFLATED works for most use cases of mat, being able to produce cleaned up uncompressed zip files is useful for content that cannot be compressed more.
In addition it also enables to use mat2 for reproducible builds of Android bootanimation files file that don't support compression.
Signed-off-by: Denis 'GNUtoo' Carikli GNUtoo@cyberdimension.org
Merge request reports
Activity
mentioned in issue #160 (closed)
enabled an automatic merge when the pipeline for e8970f1c succeeds
added 1 commit
- 1703ed6e - zip archives: keep individual files compression type
I'm more used to the mailing list workflow so to find how to contribute I read the
CONTRIBUTING.md
which didn't mention these tests, though the code had traces of them, and the commands are in.gitlab-ci.yml
.Anyway I've still two issues left to fix, but I don't know how to fix them:
- Pylint has an error (https://0xacab.org/GNUtoo/mat2/-/jobs/233684):
libmat2/archive.py:166:4: R0915: Too many statements (52/50) (too-many-statements).
. As it's not in the code path that I touched, and that my commit broke that test, could it be because it increased the size of the classes? - The second issue I have is with mypy(https://0xacab.org/GNUtoo/mat2/-/jobs/233686): it has 2 errors:
libmat2/archive.py:441: error: Item "TarInfo" of "Union[ZipInfo, TarInfo]" has no attribute "compress_type"
andlibmat2/archive.py:445: error: Item "TarInfo" of "Union[ZipInfo, TarInfo]" has no attribute "compress_type"
. Here I do understand the error well, but I don't know how to fix it either. Adding a compress_type attribute to Tar doesn't look like the right fix to me as we have several classes for Tar to handle the compression. Using a zipinfo.ZipInfo type in the function declarations doesn't work either as the type conflicts. My idea here was to have an opaque type (compression) that the class ZipInfo would handle. Do you have an idea how to best fix that?
Denis.
- Pylint has an error (https://0xacab.org/GNUtoo/mat2/-/jobs/233684):
Please do send a merge request to document whatever you found unclear in the
CONTRIBUTING.md
file.As for the errors:
- pylint is being annoying, I silenced it for this particular warnings
- mypy is being dumb, and is unable to understand libmat2's inheritance tree, so we have to use
assert isinstance(member, zipfile.ZipInfo)
to tell it that the classZipParser
doesn't have anything to do with tar.
Thanks for your contribution