This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Extend zipfile's compression level support to LZMA
Type: enhancement Stage: patch review
Components: Library (Lib) Versions: Python 3.8
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: bbayles
Priority: normal Keywords: patch

Created on 2018-01-30 16:47 by bbayles, last changed 2022-04-11 14:58 by admin.

Pull Requests
URL Status Linked Edit
PR 5534 closed bbayles, 2018-02-04 19:39
Messages (1)
msg311283 - (view) Author: bbayles (bbayles) * Date: 2018-01-30 16:47
In [1] (issue 21417), support for setting an archive (or its files) compression level was added to the zipfile module.

That currently works for the ZIP_DEFLATED and ZIP_BZIP2 compression methods, but not for ZIP_LZMA. This is because zipfile includes its own implementation of LZMACompressor that hard-codes the default preset's parameters (see also [2]).

It should be possible to extend compression level settings to ZIP_LZMA by making zipfile.LZMACompressor more flexible, i.e. able to accept an LZMA preset. I think this would involve porting the function that translates presets to options (lzma_lzma_preset, see [3]) and passing in those options to lzma.LZMACompressor .

[1] https://bugs.python.org/issue21417
[2] https://github.com/python/cpython/pull/5385
[3] https://git.tukaani.org/?p=xz.git;a=blob;f=src/liblzma/lzma/lzma_encoder_presets.c;hb=HEAD
History
Date User Action Args
2022-04-11 14:58:57adminsetgithub: 76909
2018-02-04 19:39:12bbaylessetkeywords: + patch
stage: patch review
pull_requests: + pull_request5361
2018-01-30 16:47:20bbaylescreate