[Zope-dev] Buildout - including per-user site-packages dir.

Alex Leach albl500 at york.ac.uk
Wed Jun 26 10:42:48 CEST 2013


Hi again,

I got the same error with zpasswd, so had to repeat the process with that  
section of buildout.cfg, too... Thought I'd explain the specifics, while I  
remember...


On Tue, 25 Jun 2013 19:44:48 +0100, Alex Leach <albl500 at york.ac.uk> wrote:
>
> The buildout configuration that seemed to fix this, was to add 'recipe =  
> zc.recipe.egg:scripts' to my package's section, and  
> 'allowed-eggs-from-site-packages = peak' to the `[buildout]` section.

I found the documentation on these options, unsurprisingly on the  
zc.recipe.egg and z3c.recipe.scripts PyPi pages.  
('allowed-eggs-from-site-packages = peak' is not what I thought it was  
yesterday, so please ignore it).

I don't think I had edited the zpasswd section before yesterday, so it  
should have been exactly as it was, when initially generated by  
`grokproject`:

[zpasswd]
recipe = z3c.recipe.scripts
eggs =
     my_package
     zope.password
entry-points =
     zpasswd=zope.password.zpasswd:main


I'm not entirely sure why zpasswd has to import every module in  
my_package, but it seems to try. So the above configuration causes zpasswd  
to fail, when a required package is installed into the user's  
site-packages folder.

It's worth mentioning, if you're unfamiliar with the user's site-packages  
folder, that it is supported by every Python build system I've tried:  
distutils, distutils2, numpy.distutils and setuptools. The following  
setup.py command, which works on all of these build systems, installs a  
package into the user's site-packages folder:-

$ python setup.py install --user



With the documentation in front of my, I added these options to zpasswd,  
but none of these add the user's site-packages folder to the search path:-

include-site-packages = true
exec-sitecustomize = true
relative-paths = true
extra-paths = ${buildout:directory}/eggs
interpreter = python-console


However, changing the recipe does:

recipe = zc.recipe.egg:script

So, my conclusion is that it's a feature / limitation / regression in  
z3c.recipe.scripts. I only say regression, because on the  
z3c.recipe.scripts PyPi page, I've just read:-

"The script recipe installs eggs into a buildout eggs directory, exactly  
like zc.recipe.egg [...]."

Well, not exactly... This is one difference. I'll continue to use  
zc.recipe.egg, as that works as desired in this situation, but it feels  
like I'm downgrading, which is never fun...

Hope that clarifies things, anyway.

Kind regards,
Alex


More information about the Zope-Dev mailing list