Tar for python? Better compressed file archives 'r us?

Richard Jones richard at bizarsoftware.com.au
Mon Dec 17 01:40:58 EST 2001


Does anyone have tar written in python? I've just compared the difference 
between a .zip and .tgz of the same directory structure, and the sizes are:

-rw-rw-r--    1 builder  builder   3796376 Dec 17 15:39 zope.zip
-rw-rw-r--    1 builder  builder   2270562 Dec 17 15:55 zope.tgz

(the zip is a zope source tree with the C objects built)

Having looked at the ZipFile source, I gather that zip compresses the stored 
files individually, whereas gzip'ing tar files will take advantage of the 
large amount of similarity between the files in the archive. The result being 
a loss of 1.5Mb of extraneous download :)

In the meantime, I'm creating the zip file with ZIP_STORED and compressing 
the result...

-rw-rw-r--    1 builder  builder   2635321 Dec 17 16:20 zope.zip.gz

... strange, it's still bigger than zope.tgz... but it's still much better 
than the zip file. Can't be read by unzip, but I don't care in this instance.

Anyone else had any fun in this area? Any ideas why .zip.gz is so much bigger 
than .tgz?


    Richard

ps. no, system() or popen() is not an alternative :)




More information about the Python-list mailing list