[Distutils] setuptools: bug in run_script

Phillip J. Eby pje at telecommunity.com
Sun Sep 25 23:26:28 CEST 2005

At 03:09 PM 9/25/2005 -0500, Ian Bicking wrote:
>Ian Bicking wrote:
> > The __requires__ variable causes pkg_resources to require that package.
> >  So later when .run_script() is called, the package has already been
> > loaded, and .requires() returns [], and it fails.  I actually don't know
> > what situation it would work in.  But I also realize setuptools has had
> > a hard time updating my scripts, so I didn't notice it myself.
>Well, okay, maybe not quite that.  Anyway, I was able to confirm the
>problem after doing a more insulated install, and the attached diff
>against pkg_resources.py fixes it.

There wasn't a diff attached, but in the meantime I've sent a diff that 
fixes the problem.

>It would be nice if there was a require-and-find method, whenever I want
>to get a distribution I find I have to do:
>dist = pkg_resources.working_set.find(pkg_resources.Require('Package'))
>at least that's the best combination I've figured out so far.



The correct API is get_distribution(), but you need a correctly working 
pkg_resources, which sadly is not possible with 0.6a3.  Downgrade to a2 or 
use the patch I posted.

More information about the Distutils-SIG mailing list