Get rid of ez_setup.py and distribute_setup.py · Issue #202 · nedbat/coveragepy (original) (raw)
Originally reported by Chris McDonough (Bitbucket: chrism, GitHub: chrism)
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:
#!bash
[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
(/home/chrism/opt/tmp/Python-3.2.3/lib/python3.2/site-packages/distribute-0.6.24-py3.2.egg))
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.