2009/3/26 Toshio Kuratomi <a.bad...@gmail.com>: > Guido van Rossum wrote: >> On Wed, Mar 25, 2009 at 9:40 PM, Tarek Ziadé <ziade.ta...@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. >> >> Yes, this should be done. PEP 302 has some hooks but they are optional >> and not available for the default case. [...] >> >> - 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 ... considering my experience with Babel (... gettext is similar too ;) & bundling message catalogs (.MO ...) for Trac plugins needing i18n support (... I even wrote some kind of i18n architecture for Trac < 0.12 ... ;), pkg_resources handles these cases too ... dont remember very well right now how but I think it is some knid of {{{ >>> import pkg_resources >>> help(pkg_resources.resource_filename) resource_filename(self, package_or_requirement, resource_name) method of pkg_resources.ResourceManager instance Return a true filesystem path for specified resource }}} Don't know whether this is enough or not ... but anyway ... it's already there, and many people should be using things like this ... Is it a bad idea to keep it there too ? I mean together with open/get features mentioned by GvR ... Q: Will pkg_resources.ResourceManager or equivalent remain ? AFAIK this is to load resources from multiple sources ... FS, zip | egg files and so on ... CMIIW ... ;) -- Regards, Olemis. Blog ES: http://simelo-es.blogspot.com/ Blog EN: http://simelo-en.blogspot.com/ Featured article: -- Regards, Olemis. Blog ES: http://simelo-es.blogspot.com/ Blog EN: http://simelo-en.blogspot.com/ Featured article: Comandos : Pipe Viewer ... ¿Qué está pasando por esta tubería? _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com