[EMAIL PROTECTED] wrote:
> Running C:\Python24\python.exe setup.py egg_info
> Error (exit code: 1)
> Traceback (most recent call last):
>   File "setup.py", line 2, in ?
>     from turbogears.finddata import find_package_data
>   File "d:\svn\turbogears\trunk\turbogears\__init__.py", line 11, in ?
>     from turbogears import startup
>   File "d:\svn\turbogears\trunk\turbogears\startup.py", line 8, in ?
>     pkg_resources.require("TurboGears")

It looks like TurboGears is trying to require() code from inside your
setup.py, which doesn't work right if your project hasn't got its
PKG-INFO built yet.  setuptools now has code to work around this
problem, but it only takes effect when you call setup().  If you
explicitly require() anything *before* calling setup(), it won't work
correctly.  TurboGears shouldn't be doing this with a newly-created
project directory.  Alternatively, it should create a PKG-INFO file for
you (it only needs one line, e.g. "Version: 0"), or else it should
*not* create the .egg-info subdirectory.  Any of these things would fix
the problem.

The only thing I can think of that would fix this problem on the
setuptools side (short of banning people from putting require() calls
in library code, which I'm tempted to do anyway) is to pretend that
.egg-info packages without PKG-INFO have a version number of 0.
However, this won't necessarily produce the desired results either when
you have a fresh checkout competing with installed eggs, and silently
masks the issue which could then bite you in other ways.  I think I'd
rather have it visibly fail than silently do strange things.

Maybe the right thing for me to do is to just have pkg_resources ignore
.egg-info eggs that don't have a PKG-INFO file, after issuing a warning
that it's doing so.  It's not perfect, because it might let you use the
wrong version for something, but at least it would warn you on every
run until you ran "setup.py develop" or "setup.py egg_info", and it
would allow you to run those commands even if some library code in
setup.py is calling require().

Reply via email to