twitter/commons — pull request #192 by teddziuba (2014-01-08 19:12:09+00:00)
Title: Staked bootstrapping distribute version

This commit stakes the version of `distribute` that Pants depends on to `0.6.34`. It also adds a guard check against failure to bootstrap `pkg_resources.py` or `setuptools` into the Pants build.

The problem with using `distribute>=0.6.24` as a requirement is that it's possible to pick up `distribute>=0.7` which is actually a meta-package, and does not contain `pkg_resources.py` or `setuptools`, it simply declares `setuptools` as a dependency. Since the iteration to choose the `distribute` package to bootstrap in is eager, and happens in no particular order, this is a thing that could happen easily (it did on my build).

In normal `pip` land, there is no problem with this, but the way that Pants bootstraps `distribute` makes it difficult, since it doesn't pull in the transitive closure of dependencies, it simply iterates over the files in the `distribute` package and copies them to chroot.

In the case that it picks up `distribute>=0.7`, this results in there being no `pkg_resources.py` or `setuptools` copied into subsequent .pex files. Normally this would not cause any obvious problems, since most environments where a .pex file would run include `setuptools` in their system Python installations.

However, if you work where I do, the production machines are very slimly configured, and do not include a reasonable system Python. This results in the bootstrap script inside the .pex file to fail to import `pkg_resources.py`.