[Distutils] distlib updated with resources API

Daniel Holth dholth at gmail.com
Thu Sep 27 15:25:26 CEST 2012


On Thu, Sep 27, 2012 at 9:14 AM, Vinay Sajip <vinay_sajip at yahoo.co.uk> wrote:
> I haven't defined any new importers. In terms of listing a whole zip's contents,
> that's not part of the idea of a resource: you need to know what resource you
> want, before you can get it, at least at the top level. Of
> course, you can iterate over a resource tree once you have a top-level
> resource. Possibly an iterator could be provided for convenience, but I'm not
> sure what the use case is. For example, should particular files like __pycache__
> and .pyc be excluded when operating on file system resources?

The pkgutil "walk modules/packages" API uses listdir / equivalent to
find the packages. So does the code that finds .egg-info / .dist-info.

> I don't use _zip_directory_cache directly - it's exposed as the zipimport
> loader's "_files" attribute, and I use that.

Really the importer API is deficient, but that is a different problem.

>> Speaking of old code, does anyone feel like replacing
>>
>> # @decorator
>> def fn(): ...
>> fn = decorator(fn)
>>
>> with the probably-ok-to-use-by-now decorator syntax?
>
> Where's the anachronistic code you're referring to?

pkgutil and pkg_resources


More information about the Distutils-SIG mailing list