[Distutils] [setuptools] "setup.py develop" should bootstrap

Bob Ippolito bob at redivi.com
Fri Aug 4 23:35:48 CEST 2006


On Aug 4, 2006, at 1:37 PM, Leif Strand wrote:

> Hi,
>
> I think the 'develop' command should bootstrap 'setuptools' itself --
> like 'install' does.
>
> I was Googling around for a possible work-around, but instead I only
> found others who ran into the same problem:
>
>     http://www.djangoproject.com/documentation/install/
>
> (See the comments at the bottom of the page.) They try to use  
> 'develop'
> to install Django, but get "ImportError: No module named  
> pkg_resources"
> when they try to run it. (Come to think of it, I may have used  
> 'develop'
> to install Django the first time, but it only worked because I had  
> used
> 'setuptools' before.)
>
> The users of my 'setup.py' script will likely encounter the exact same
> scenario: their first encounter with 'setuptools' will be checking- 
> out a
> project from Subversion, and then running "setup.py develop".
>
> Anyway, I developed a crude work-around -- just force the  
> setuptools egg
> to be installed, before calling setup() for real:
>
>     import setuptools
>
>     if setuptools.bootstrap_install_from:
>         egg = setuptools.bootstrap_install_from
>         setuptools.bootstrap_install_from = None
>         setuptools.setup(script_args=['easy_install', egg])
>
>     setuptools.setup(...)

Adding setuptools to the install_requires=[] list of the package's  
setup.py should work. I guess that could be implicit all the time,  
because most setuptools-using packages want that (and anything with  
entry points is going to need it).

-bob



More information about the Distutils-SIG mailing list