1. Ned Batchelder
  2. coverage.py
  3. Issues
Issue #202 resolved

Get rid of ez_setup.py and distribute_setup.py

Chris McDonough
created an issue

I'd suggest getting rid of setup.py dependency on ez_setup.py and distribute_setup.py.

If someone has an older setup of Python 3.2.3 that has eg. distribute 0.6.24 installed:

[chrism@perspire Python-3.2.3]$ bin/easy_install coverage
Searching for coverage
Reading http://pypi.python.org/simple/coverage/
Reading http://nedbatchelder.com/code/modules/coverage.html
Reading http://nedbatchelder.com/code/coverage
Reading http://nedbatchelder.com/code/coverage/3.5.1b1
Reading http://nedbatchelder.com/code/coverage/3.5.2b1
Reading http://nedbatchelder.com/code/coverage/3.4b1
Reading http://nedbatchelder.com/code/coverage/3.4b2
Reading http://nedbatchelder.com/code/coverage/3.5b1
Best match: coverage 3.5.3
Downloading http://pypi.python.org/packages/source/c/coverage/coverage-3.5.3.tar.gz#md5=5f1f523940c473faa8a9f6ca29f78efc
Processing coverage-3.5.3.tar.gz
Running coverage-3.5.3/setup.py -q bdist_egg --dist-dir /tmp/easy_install-s8o1kl/coverage-3.5.3/egg-dist-tmp-hyw4pc
The required version of distribute (>=0.6.27) is not available, and can't be installed while this script is running. Please install a more recent version first, using 'easy_install -U distribute'.

(Currently using distribute 0.6.24     
error: Setup script exited with 2

This is a bogus error, because that version of distribute would work just fine to install that version of coverage if distribute_setup.py were not used.

This isn't a terrible hardship interactively but it was a real problem for me while running tox, which creates a virtualenv under the hood using whatever version of virtualenv is installed. Since older virtualenvs ship with older distribute versions, there was be about a half hour of headscratching when this error occured during a tox run. The solution was to upgrade virtualenv to brandnewshiny, but this isn't always possible or desirable.

The reason to get rid of ez_setup.py is because it will have similar problems when executed and the version of setuptools/distribute installed doesn't match its worldview. (Grep for "was_imported" in ez_setup.py).

And of course the other reason is that you don't want to continually need to bump the versions of these files over time; it's a losing game.

Instead of relying on these files and "use_setuptools" in the setup.py, I'd either a) document that folks need either setuptools or distribute to install coverage or b) rely only on distutils.

Comments (4)

  1. Ned Batchelder repo owner

    I would love to use only distutils. If you could help with that, or just point me to a project that provides a command-line script without needing setuptools etc, that would be great.

    As a last resort, I could use setuptools without an auto-installation, but I'd like to understand my options for doing without it first.

  2. Daniel Holth

    I think the right thing to do is to assume setuptools is available without including the bootstrap in setup.py. Everyone has setuptools, and if they don't, they do not want you to install it for them.

    p.s. pip will run setup.py with setuptools, even if you do not import it.

  3. Log in to comment