[Python-Dev] "setuptools has divided the Python community"
a.badger at gmail.com
Fri Mar 27 17:19:00 CET 2009
Guido van Rossum wrote:
> 2009/3/26 Toshio Kuratomi <a.badger at gmail.com>:
>> Guido van Rossum wrote:
>>> On Wed, Mar 25, 2009 at 9:40 PM, Tarek Ziadé <ziade.tarek at gmail.com> wrote:
>>>> I think Distutils (and therefore Setuptools) should provide some APIs
>>>> to play with special files (like resources) and to mark them as being special,
>>>> no matter where they end up in the target system.
>>>> So the code inside the package can use these files seamessly no matter
>>>> what the system is
>>>> and no matter where the files have been placed by the packager.
>>>> This has been discussed already but not clearly defined.
>>> Yes, this should be done. PEP 302 has some hooks but they are optional
>>> and not available for the default case. A simple wrapper to access a
>>> resource file relative to a given module or package would be easy to
>>> add. It should probably support four APIs:
>>> - Open as a binary stream
>>> - Open as a text stream
>>> - Get contents as a binary string
>>> - Get contents as a text string
>> Depending on the definition of a "resource" there's additional
>> information that could be needed. For instance, if resource includes
>> message catalogs, then being able to get the base directory that the
>> catalogs reside in is needed for passing to gettext.
> Well the whole point is that for certain loaders (e.g. zip files)
> there *is* no base directory. If you do need directories you won't be
> able to use PEP-302 loaders, and you can just use
Yep. Having no base directory isn't sufficient in all cases.
So one way to fix this is to define resources so that these cases fall
outside of that.
Current setuptools works around this by having API in pkg_resources that
unzips when it's necessary to use a filename rather than just retrieving
the data from the file. So a second option is to have other API methods
that allow this.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 197 bytes
Desc: OpenPGP digital signature
More information about the Python-Dev