internetarchive / warctools

Command line tools and libraries for handling and manipulating WARC files (and HTTP contents)
MIT License
149 stars 27 forks source link

custom class MultiMemberGzipReader and other tweaks #16

Open nlevitt opened 8 years ago

nlevitt commented 8 years ago

The old GeeZipFile class: https://github.com/internetarchive/warctools/blob/7f2b9a9/hanzo/warctools/stream.py#L183 depended on implementation details of gzip.py in the python standard library. It looks like python 3.5 breaks that class. Moreover, GeeZipFile doesn't work correctly for certain gzip members in any python version (can skip over some very small members, and there might be other issues). It turned out to be necessary to write a new class using zlib, rather than try to extend gzip.GzipFile.

This pull request makes tests pass on python 3.5, see https://travis-ci.org/internetarchive/warctools/builds/157185857 vs https://travis-ci.org/internetarchive/warctools/builds/157138379

These are changes I was working as part of the painful project of making CDX-Writer work with mainline surt and warctools libraries. That project isn't finished, but I think we might as well merge this change now.