ResourcePackage 1.0.0a2 available...

Mike C. Fletcher mcfletch at rogers.com
Mon Jan 13 21:27:42 CET 2003


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,
}

And wxgenerators adds wxgenerators.GENERATOR registered as default for 
each of:
    [ '.png','.jpg','.ico','.tif','.bmp','.xpm', 
'.gif','.pcx','.pnm','.iff', ]
if/when it's imported.  That's a poor design decision, as it should 
really not change a default but instead provide a mechanism for updating 
your own custom set.

Should the mappings be defined by a data-file instead (a resource :) )? 
 Should there be a similar data-file in the resource directory to 
customise the site-wide customisation?

Probably should be something along those lines to prevent needing lots 
of slightly-customised scanning__init__ files. Will see about getting 
that done tomorrow.

Enjoy,
Mike

Just wrote:

>In article <mailman.1042476451.9009.python-list at python.org>,
> "Mike C. Fletcher" <mcfletch at rogers.com> wrote:
>
>  
>
>>ResourcePackage is a mechanism for automatically managing resources 
>>(i.e. non-Python files: small images, documentation files, binary data) 
>>embedded in Python modules (as Python source code), particularly for 
>>those wishing to create re-usable Python packages which require their 
>>own resource-sets.
>>    
>>
>[ ... ]
>  
>
>>    http://sourceforge.net/projects/resourcepackage/
>>    
>>
>
>Cool! Very nice idea.
>
>One minor comment after a quick scan of the code: if possible, I'd make 
>zlib compression optional, as when packaging the modules in a zip file 
>(and import it with zipimport) would otherwise result in double 
>compression.
>
>Just
>  
>
_______________________________________
  Mike C. Fletcher
  Designer, VR Plumber, Coder
  http://members.rogers.com/mcfletch/








More information about the Python-list mailing list