[Distutils] setuptools: bug in run_script

Ian Bicking ianb at colorstudy.com
Sun Sep 25 22:09:17 CEST 2005


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.

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:

pkg_resources.require('Package')
dist = pkg_resources.working_set.find(pkg_resources.Require('Package'))

at least that's the best combination I've figured out so far.


More information about the Distutils-SIG mailing list