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

Leif Strand leif at geodynamics.org
Fri Aug 4 22:37:46 CEST 2006


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(...)

(The above snippet has no warranty of any kind.)

--Leif Strand



More information about the Distutils-SIG mailing list