[Distutils] distlib and data files => resources ?
tarek at ziade.org
Sun Nov 18 23:33:22 CET 2012
On 11/18/12 11:15 PM, Chris McDonough wrote:
> On 11/18/2012 05:08 PM, Vinay Sajip wrote:
>> Tarek Ziadé <tarek <at> ziade.org> writes:
>>> Having a indirection like distutils2's resources allows the data files
>>> to live alongside the code
>>> in development and to be installed wherever that's desired by the
>>> distro, without breaking
>>> the code as long as it uses the indirection function to find back
>>> the file.
>>> Since the indirection is provided by a file that can be browsed in the
>>> metadata directory,
>>> it means anyone can get the file location by using the API we provided.
>> Yes, but it seems like you're assuming everything's always installed
>> in a
>> conventional way and not, say, deployed in a .zip. I'm not disputing
>> what you
>> said - get_file_path and get_resource_path are still there in distlib
>> - but I'm
>> not sure that there's *never* a case for data located in packages.
> Requiring that developers build an
> outside the package structure seems like a terrible idea.
I think you did not get it.
If you look/read carefully, it's not an alternate structure. The files
are not moved - they are staying at the same place alongside the Python
files in your source tree.
The difference is only at installation time: they may be installed
somewhere else. And when you access them - there's an API to read them
instead of using __file__.
> Distutils-SIG maillist - Distutils-SIG at python.org
More information about the Distutils-SIG