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.

Author zwol
Recipients zwol
Date 2019-11-06.20:06:30
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1573070791.08.0.617845732948.issue38725@roundup.psfhosted.org>
In-reply-to
Content
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`.
History
Date User Action Args
2019-11-06 20:06:31zwolsetrecipients: + zwol
2019-11-06 20:06:31zwolsetmessageid: <1573070791.08.0.617845732948.issue38725@roundup.psfhosted.org>
2019-11-06 20:06:31zwollinkissue38725 messages
2019-11-06 20:06:30zwolcreate