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 eric.araujo
Recipients docs@python, eric.araujo, lars.gustaebel, nadeem.vawda
Date 2012-02-14.16:27:26
SpamBayes Score 2.333072e-10
Marked as misclassified No
Message-id <1329236847.51.0.270430673151.issue14013@psf.upfronthosting.co.za>
In-reply-to
Content
shutil contains high-level functions to create a zipfile or a tarball.  When a new format is added to the tarfile module, then shutil needs to be updated manually.  If tarfile exposed the names of the compressors it supports, then shutil could just automatically support everything that tarfile supports instead of having to re-do import dances for optional modules (bz2, lzma, zlib) and also duplicate formats in its doc.

This may also be useful for other code wanting to do some introspection.

Attached patch implements tarfile.formats, a list of strings (I thought about using a frozenset but then followed the precedent set by the 3.3 crypt module).  Tests and docs not updated, I wanted to get Lars’ approval on the principle first.

One could argue that this is not needed: compression modules are not added often; updating shutil after updating tarfile is not hard; it is not that useful to have access to the list of supported formats.
History
Date User Action Args
2012-02-14 16:27:27eric.araujosetrecipients: + eric.araujo, lars.gustaebel, nadeem.vawda, docs@python
2012-02-14 16:27:27eric.araujosetmessageid: <1329236847.51.0.270430673151.issue14013@psf.upfronthosting.co.za>
2012-02-14 16:27:26eric.araujolinkissue14013 messages
2012-02-14 16:27:26eric.araujocreate