[Zope-CMF] Re: Adding python packages to ProductsPath
Dieter Maurer wrote: yuppie wrote at 2007-1-23 18:55 +0100: ... Yes, I object. This is a hack that resolves the issue just for some special use cases. We need a solution that works with python packages anywhere in the python path. And packageresources (http://www.handshake.de/~dieter/pyprojects/packageresources.tgz; can show a way to do it. An alternative could be the upcoming egg's support for egg local resources. With packageresources a python package/module is identified by an url of the form pypackage:module_path, e.g. pypackage:Products.CMFCore or pypackage:Shared.DC.ZRDB.DA. A resource (e.g. a file or directory) local to a package is identified by an url pypackage:package_path/package_relative_file_path, e.g. pypackage:Products.CMFCore/skins As you can see: this allows to specifiy location independent skin directories. yeah... I could see something similar being done with setuptools entrypoints and then accessed later by using pkg_resources. Initially we could just assume cmfish eggs are unzippable. -w -- -- d. whit morriss -- - senior engineer, opencore - - http://www.openplans.org - - m: 415-710-8975 - If you don't know where you are, you don't know anything at all Dr. Edgar Spencer, Ph.D., 1995 ___ Zope-CMF maillist - Zope-CMF@lists.zope.org http://mail.zope.org/mailman/listinfo/zope-cmf See http://collector.zope.org/CMF for bug reports and feature requests
Re: [Zope-CMF] Re: Adding python packages to ProductsPath
yuppie wrote at 2007-1-23 18:55 +0100: ... Yes, I object. This is a hack that resolves the issue just for some special use cases. We need a solution that works with python packages anywhere in the python path. And packageresources (http://www.handshake.de/~dieter/pyprojects/packageresources.tgz; can show a way to do it. An alternative could be the upcoming egg's support for egg local resources. With packageresources a python package/module is identified by an url of the form pypackage:module_path, e.g. pypackage:Products.CMFCore or pypackage:Shared.DC.ZRDB.DA. A resource (e.g. a file or directory) local to a package is identified by an url pypackage:package_path/package_relative_file_path, e.g. pypackage:Products.CMFCore/skins As you can see: this allows to specifiy location independent skin directories. -- Dieter ___ Zope-CMF maillist - Zope-CMF@lists.zope.org http://mail.zope.org/mailman/listinfo/zope-cmf See http://collector.zope.org/CMF for bug reports and feature requests
[Zope-CMF] Re: Adding python packages to ProductsPath
Wichert Akkerman wrote: The patch below fixes this by adding $INSTANCE_HOME/lib/python to the ProductsPaths list. This allows minimalpath to find python packages installed there. Are there any objections to commiting this to trunk? I know we've had some larger discussions on this list regarding doing something with GenericSetup so it could handle things like this but it never really got anywhere. This seems like a very minimal change ... while I don't have a full handle out the far outreaching effects of this I would certainly give it a +1 knowing what it accomplishes. - Rocky ___ Zope-CMF maillist - Zope-CMF@lists.zope.org http://mail.zope.org/mailman/listinfo/zope-cmf See http://collector.zope.org/CMF for bug reports and feature requests
[Zope-CMF] Re: Adding python packages to ProductsPath
Hi Wichert! Wichert Akkerman wrote: At the moment it is not possible to use skin layers in pure python packages. This is caused by the DirectoryView implementation using a minimal path name for the layer id. This path name is created by CMFCore.utils.minimalpath, which uses the ProductsPaths list of directories to look for the filesystem directory and uses an absolute path if it can't find it. Since this absolute path will differ per install you can't use it in something like genericsetup profiles. The patch below fixes this by adding $INSTANCE_HOME/lib/python to the ProductsPaths list. This allows minimalpath to find python packages installed there. Are there any objections to commiting this to trunk? Yes, I object. This is a hack that resolves the issue just for some special use cases. We need a solution that works with python packages anywhere in the python path. Please read this thread: http://mail.zope.org/pipermail/zope-cmf/2006-July/024631.html And please note that we just need a human readable registry key, nothing that allows to look up the directories directly. Different keys are possible, e.g.: Products.MyProduct/skins/my_skin MyPackage.MySubPackage/skins/my_skin Products/MyProduct/skins/my_skin MyPackage/MySubPackage/skins/my_skin Products.MyProduct:skins/my_skin MyPackage.MySubPackage:skins/my_skin Products.MyProduct:my_skin MyPackage.MySubPackage:my_skin I think the old keys should become deprecated and replaced everywhere. Cheers, Yuppie ___ Zope-CMF maillist - Zope-CMF@lists.zope.org http://mail.zope.org/mailman/listinfo/zope-cmf See http://collector.zope.org/CMF for bug reports and feature requests