tarfile woes

Lars Gustaebel lars at gustaebel.de
Fri Aug 22 05:40:13 EDT 2003


On Thu, 21 Aug 2003 19:29:50 +0200, Hans-Joachim Widmaier wrote:

>  - bzip2 compressed files cannot be read from a "fake" (StringIO) file
>    object, only from real files.

Much to my regret, this is a limitation of the bz2 module which is used.
 
>  - It does not handle compressed (.Z) archives.

This is sad, too, but IMO tolerable for most people.
 
>  - TarInfo and ZipInfo (zipfile) objects differ without need.
> 
>        TarInfo attribute     ZipFile attribute
> 
>        name                  filename
>        size                  file_size
>        mtime                 date_time	(int, 6-Tuple)

As you observed by yourself ZipInfo's naming scheme is inconsistent and I
didn't find it a good idea to adopt this mindlessly. Also, I found an
integer value for mtime much more versatile than a tuple.

> I can see 2 reasons for that: 1. The library is written by a bunch of
> different guys at different dates. Everyone's got her own style, and it
> shows. 2. The underlying internals ahll get exposed to some degree.

Good observation.

I didn't have the standard library in mind when I started writing tarfile.
I realized the zipfile interface wouldn't suit my ideas, so I decided to
design one I could be happy with. In the months before tarfile's addition
to the stdlib I perceived some people's concerns about this lack of
uniformity, so I added the TarFileCompat class to calm them down. Perhaps
it could serve you too.
Your criticism is justified. And I'm sure that in the future a
standardized and extensible interface to archive manipulation could emerge
*if* people just want it badly enough (and someone does all the work :-).

Let's wait and see.

-- 
Lars Gustäbel
lars at gustaebel.de





More information about the Python-list mailing list