On 11/4/05, Phillip J. Eby <[EMAIL PROTECTED]> wrote:
> > > asimov:~/turbogears jeremy$ sudo python setup.py develop
> > > --script-dir=/usr/local/bin
> > > Traceback (most recent call last):
> > > File "setup.py", line 14, in ?
> > > from docgen import GenSite
> > > File "/Users/jeremy/turbogears/docgen.py", line 7, in ?
> > > pkg_resources.require("Kid >= 0.6.4")
>
> Your setup script imports docgen, which in turn runs the require().
> Modules really shouldn't require() in this way.
I'm puzzled as to why explicitly asking for Kid >= 0.6.4 cares about
the TurboGears egg info... I had put this import in a try/except
DistributionNotFound to handle the initial install case, and I think
this used to work.
Is your suggestion that the module should just import kid?
> But you're not entirely at fault; the key problems here are that:
>
> 1. A project that hasn't run egg_info is essentially broken
> 2. A project that has its source code in the project root (as opposed
> to a lib or src subdirectory) is always on sys.path
>
> If you change either of these things, the problem goes away. Using a
> subdirectory makes it go away altogether.I hadn't actually thought
> about this before, it's just that my projects usually have a 'src'
> directory, so I haven't run into this issue. Plus it only happens when
> you start a project, unless you're a user working from a checkout.
> Users working from an sdist never see an issue.
I hadn't put the source under an src directory because I knew there
would only be one directory there. It seemed kind of overkill... we
certainly *could* move the source down a level...
Kevin