New submission from Zack Weinberg <za...@panix.com>:

Recent versions of the gzip command-line utility have an option `-n` which 
causes it to omit the FNAME field of the gzip file header, and write out the 
MTIME field as zero.  Both of these properties are desirable when constructing 
reproducible build artifacts (see https://reproducible-builds.org/ ).

Right now, the gzip module lets you set MTIME to zero explicitly by passing 
`mtime=0` to the GzipFile constructor, but this is not documented.  You can 
avoid writing out a filename by opening the output file yourself:

    with gzip.GzipFile(fileobj=open("foo.gz", "wb"),
                       filename='', mtime=0) as ofp:
        ... write to ofp ...

but that's awkward and, again, not documented.  I'd like to be able to write 
something like this instead:

    with gzip.open("foo.gz", mtime=0, record_filename=False) as ofp:

with this being the documented way to achieve the same effect as `gzip -n`.

----------
components: Library (Lib)
messages: 356150
nosy: zwol
priority: normal
severity: normal
status: open
title: Documented equivalent of `gzip -n` (omit timestamp and original file 
name) in gzip module

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue38725>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to