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. I'd be very happy if "resource" didn't encompass that type of thing, though... then we could have a separate interface that addressed the issues with them. I'll be at PyCon (flying in late tonight, though, and leaving Sunday) if Tarek and others want to get ahold of me to discuss possible ways to address what's a resource, what's not, and what we would need to handle the different cases. -Toshio -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 197 bytes Desc: OpenPGP digital signature URL: <http://mail.python.org/pipermail/python-dev/attachments/20090326/fce22801/attachment.pgp>
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4