setuptools plugin for bzr support

Comment 3 for bug 239574

To clarify the above statement from Servilio: the setuptools_bzr 2.1 release on PyPI is itself affected by this, so this version cannot be installed. Full traceback here (with python2.4; python2.6 is similar):

$ bin/easy_install setuptools_bzr
Searching for setuptools-bzr
Best match: setuptools-bzr 2.1
Processing setuptools_bzr-2.1.tar.gz
Running setuptools_bzr-2.1/ -q bdist_egg --dist-dir /var/folders/KA/KAXdMSFEHom0r8QU1jW-Jk+++TI/-Tmp-/easy_install-_FF58A/setuptools_bzr-2.1/egg-dist-tmp-Tu2Nrz
Traceback (most recent call last):
  File "bin/easy_install", line 8, in ?
  File "/Users/mauritsvanrees/envs/py24/lib/python2.4/site-packages/distribute-0.6.24-py2.4.egg/setuptools/command/", line 1883, in main
  File "/Users/mauritsvanrees/envs/py24/lib/python2.4/site-packages/distribute-0.6.24-py2.4.egg/setuptools/command/", line 1864, in with_ei_usage
    return f()
  File "/Users/mauritsvanrees/envs/py24/lib/python2.4/site-packages/distribute-0.6.24-py2.4.egg/setuptools/command/", line 1887, in <lambda>
    distclass=DistributionWithoutHelpCommands, **kw
  File "/Users/mauritsvanrees/buildout/python/parts/opt/lib/python2.4/distutils/", line 149, in setup
  File "/Users/mauritsvanrees/buildout/python/parts/opt/lib/python2.4/distutils/", line 946, in run_commands
  File "/Users/mauritsvanrees/buildout/python/parts/opt/lib/python2.4/distutils/", line 966, in run_command
  File "/Users/mauritsvanrees/envs/py24/lib/python2.4/site-packages/distribute-0.6.24-py2.4.egg/setuptools/command/", line 349, in run
    self.easy_install(spec, not self.no_deps)
  File "/Users/mauritsvanrees/envs/py24/lib/python2.4/site-packages/distribute-0.6.24-py2.4.egg/setuptools/command/", line 589, in easy_install
    return self.install_item(spec, dist.location, tmpdir, deps)
  File "/Users/mauritsvanrees/envs/py24/lib/python2.4/site-packages/distribute-0.6.24-py2.4.egg/setuptools/command/", line 619, in install_item
    dists = self.install_eggs(spec, download, tmpdir)
  File "/Users/mauritsvanrees/envs/py24/lib/python2.4/site-packages/distribute-0.6.24-py2.4.egg/setuptools/command/", line 809, in install_eggs
    return self.build_and_install(setup_script, setup_base)
  File "/Users/mauritsvanrees/envs/py24/lib/python2.4/site-packages/distribute-0.6.24-py2.4.egg/setuptools/command/", line 1086, in build_and_install
    self.run_setup(setup_script, setup_base, args)
  File "/Users/mauritsvanrees/envs/py24/lib/python2.4/site-packages/distribute-0.6.24-py2.4.egg/setuptools/command/", line 1075, in run_setup
    run_setup(setup_script, args)
  File "/Users/mauritsvanrees/envs/py24/lib/python2.4/site-packages/distribute-0.6.24-py2.4.egg/setuptools/", line 29, in run_setup
  File "/Users/mauritsvanrees/envs/py24/lib/python2.4/site-packages/distribute-0.6.24-py2.4.egg/setuptools/", line 72, in run
    return func()
  File "/Users/mauritsvanrees/envs/py24/lib/python2.4/site-packages/distribute-0.6.24-py2.4.egg/setuptools/", line 32, in <lambda>
    {'__file__':setup_script, '__name__':'__main__'}
  File "", line 19, in ?
ImportError: No module named ez_setup

This is strange, because by default setuptools already adds all .py files, even when no extra helpers like setuptools-bzr are installed. Ah, no, only Python source files implied by the py_modules and packages options are included, as mentioned in the docs:

This snippet in the of setuptools-bzr would fix that for the setuptools-bzr package itself, by only importing ez_setup when needed:

    from setuptools import setup, find_packages
except ImportError:
    from ez_setup import use_setuptools
    from setuptools import setup, find_packages

It would seem that the setuptools-bzr release in PyPI should have included the file though, as this file is included in the bzr code. Possibly the latest release has been made with a python version that erroneously did not have setuptools-bzr itself installed. I get an error on trunk btw, which might also have something to do with it, but I will open a separate ticket for that.

Note that in some packages I see a line in like this, which explicitly excludes ez_setup:

  packages=find_packages(exclude=['ez_setup', 'examples', 'tests'])

If things go wrong that might be an explanation as well, though it seems it has no effect because ez_setup is not included by default anyway: it is not a package or module.

BTW, as note for others: the not vcs dependent way of saying you want to include in your source distribution would be to add a file with this line: