[Distutils] Easy install and zipimporter

Phillip J. Eby pje at telecommunity.com
Sat Nov 10 23:44:39 CET 2007

At 09:47 PM 11/10/2007 +0100, Maciej Fijalkowski wrote:
>I've been implementing zipimport module recently for the pypy 
>project and I came to the following problem:
>When zipimport is there, easy install is mangling with 
>zipimport._zip_directory_cache, which is
>a) undocumented in importer protocol
>b) starts with an _
>c) explodes when I compile pypy and import site.py (providing that 
>I've got easy_install installed)
>Any propositions what to do here? Just providing 
>_zip_directory_cache is not really an option, since it has no documentation

 >>> import zipimport
 >>> help(zipimport)
Help on built-in module zipimport:

     zipimport - zipimport provides support for importing Python 
modules from Zip archives.



     This module exports three objects:
     - zipimporter: a class; its constructor takes a path to a Zip archive.
     - ZipImporterError: exception raised by zipimporter objects. It's a
       subclass of ImportError, so it can be caught as ImportError, too.
     - _zip_directory_cache: a dict, mapping archive paths to zip directory
       info dicts, as used in zipimporter._files.

>and no unittests,

Well, the tests in test_zipimport *clear* it.

>which means it might change at any moment.

Why?  Note, by the way, that as of Python 2.5, the pkgutil module 
also makes use of this variable.

More information about the Distutils-SIG mailing list