ResourcePackage 1.0.0a2 available...

Just just at xs4all.nl
Mon Jan 13 16:14:40 EST 2003


In article <mailman.1042489765.27610.python-list at python.org>,
 "Mike C. Fletcher" <mcfletch at rogers.com> wrote:

> Zlib compression is actually already optional :) .  It's just that the 
> option is handled on a filetype-by-filetype basis (at the moment, the 
> only filetypes that are compressed are .txt, .html and .pdf (chosen 
> totally arbitrarily as I was coding just to test the gzipping 
> mechanism)).  To do something different, change your scanning__init__.py 
> to use a different set of generators when initialising the Package object:
> 
> The current default set of generators is
> {
>     "": defaultgenerators.SIMPLE, # used if no specific generator registered
>     ".txt": defaultgenerators.GZIP,
>     ".html": defaultgenerators.GZIP,
>     ".pdf": defaultgenerators.GZIP,
> }

Ah. "GZIP"? It's straight zlib compression, right?

I also wonder whether base64 encoding in the source would be more 
efficient than a repr-ed string for binary data. Hm, I guess the 
packager could find out by trying both...

I'm not too sure I like is the fact you need to replace the __init__.py 
when packaging. I'd think something like this could work (at least in 
the context of freeze, py2exe, Installer and zipimport):

import os

for d in __path__:
    try:
        files = os.listdir(d)
    except IOError:
        pass
    else:
        ...scan for data files...

Just




More information about the Python-list mailing list