[Grok-dev] Re: First Experience with Grok

Philipp von Weitershausen philipp at weitershausen.de
Mon Sep 17 16:57:18 EDT 2007


On 17 Sep 2007, at 22:50 , Shane Hathaway wrote:
> Philipp von Weitershausen wrote:
>> Shane wrote:
>>>> I'd like to point out one issue I stumbled on at first.  After  
>>>> running
>>>> grokproject, the server would not start.  The exception I got was
>>>> cryptic.  After studying it, I realized my system had an older  
>>>> version
>>>> of zope.interface and Twisted installed in site-packages, and  
>>>> that the
>>>> sys.path constructed by grokproject preferred the version in
>>>> site-packages.  I fixed the problem by removing my site-packages  
>>>> path
>>>> from the generated runzope.  I suspect site-packages should  
>>>> never be
>>>> preferred over anything from the buildout-eggs directory.
>>
>> Indeed. My suspicion is that Shane's running Ubuntu or Debian.  
>> Because
>> those and other distributions install certain packages as development
>> eggs into lib/python2.x/site-packages. I wish they wouldn't do  
>> that. For
>> the problem is that buildout (through setuptools) will find them as
>> regular eggs and put their "location" (which is site-packages) on
>> sys.path. That's why Shane is getting site-packages *before* other  
>> eggs
>> on sys.path.
>
> I'm running Gentoo, but Gentoo packages frequently follow Debian
> conventions, so you could be right.  I'm running Python 2.5.  My
> site-packages directory has 58 files and directories named *.egg-info.

Yup. That's it. They've installed some packages as development eggs  
(that's what they .egg-info directories are about).

> I'm looking at the grokproject package now.  I see a class named
> GrokProject, but I don't see anything that actually refers to that
> class.  What magic is happening?

grokproject is using PasteScript to spit out the directories and  
files from a template. The GrokProject class defines the template for  
PasteScript (in other words, it defines the question PasteScript will  
ask you, and what to do with the answers). You don't see it being  
used (even though it is) because it's registered using the entry- 
point mechanism (in setup.py if you have the tarball, or EGG-INFO/ 
entry_points.txt if you have the egg).

>> I think zc.buildout should gain such a feature proper: simply ignore
>> anything installed anywhere other than your own eggs directory.
>
> +1

Actually, this might be doable with virtualenv --no-site-packages  
[1]. What it does is create a virtual python installation, e.g. a  
directory with 'bin', 'lib/python2.x', etc. The 'bin/python' is a  
copy of the original one and 'lib/python2.x' contains a bunch of  
symlinks to original lib/python2.x. When using the --no-site- 
packages, it explicitly does not include the original site-packages.

Might be worth a shot.


[1] http://cheeseshop.python.org/pypi/virtualenv




More information about the Grok-dev mailing list