Comment 3 for bug 239574

Revision history for this message
Maurits van Rees (maurits-vanrees) wrote :

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
Reading http://pypi.python.org/simple/setuptools_bzr/
Reading https://launchpad.net/setuptoolsbzr
Best match: setuptools-bzr 2.1
Downloading http://pypi.python.org/packages/source/s/setuptools_bzr/setuptools_bzr-2.1.tar.gz#md5=f296133b7e3ffce1d6a2ad31787de0bf
Processing setuptools_bzr-2.1.tar.gz
Running setuptools_bzr-2.1/setup.py -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 ?
    sys.exit(
  File "/Users/mauritsvanrees/envs/py24/lib/python2.4/site-packages/distribute-0.6.24-py2.4.egg/setuptools/command/easy_install.py", line 1883, in main
    with_ei_usage(lambda:
  File "/Users/mauritsvanrees/envs/py24/lib/python2.4/site-packages/distribute-0.6.24-py2.4.egg/setuptools/command/easy_install.py", 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/easy_install.py", line 1887, in <lambda>
    distclass=DistributionWithoutHelpCommands, **kw
  File "/Users/mauritsvanrees/buildout/python/parts/opt/lib/python2.4/distutils/core.py", line 149, in setup
    dist.run_commands()
  File "/Users/mauritsvanrees/buildout/python/parts/opt/lib/python2.4/distutils/dist.py", line 946, in run_commands
    self.run_command(cmd)
  File "/Users/mauritsvanrees/buildout/python/parts/opt/lib/python2.4/distutils/dist.py", line 966, in run_command
    cmd_obj.run()
  File "/Users/mauritsvanrees/envs/py24/lib/python2.4/site-packages/distribute-0.6.24-py2.4.egg/setuptools/command/easy_install.py", 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/easy_install.py", 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/easy_install.py", 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/easy_install.py", 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/easy_install.py", 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/easy_install.py", 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/sandbox.py", line 29, in run_setup
    DirectorySandbox(setup_dir).run(
  File "/Users/mauritsvanrees/envs/py24/lib/python2.4/site-packages/distribute-0.6.24-py2.4.egg/setuptools/sandbox.py", line 72, in run
    return func()
  File "/Users/mauritsvanrees/envs/py24/lib/python2.4/site-packages/distribute-0.6.24-py2.4.egg/setuptools/sandbox.py", line 32, in <lambda>
    {'__file__':setup_script, '__name__':'__main__'}
  File "setup.py", 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: http://docs.python.org/distutils/sourcedist.html#specifying-the-files-to-distribute

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

try:
    from setuptools import setup, find_packages
except ImportError:
    from ez_setup import use_setuptools
    use_setuptools()
    from setuptools import setup, find_packages

It would seem that the setuptools-bzr release in PyPI should have included the ez_setup.py 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 setup.py 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 ez_setup.py in your source distribution would be to add a MANIFEST.in file with this line:
include ez_setup.py