This is slightly unexpected. Absent from the .whl distribution are the __init__.pys with the proper declare_namespace declarations. Even more bizarrely:
PYTHONPATH=whl_dist python -c 'import pkg_resources'
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Users/wickman/Python/CPython-2.6.9/lib/python2.6/site-packages/pkg_resources.py", line 2736, in <module>
add_activation_listener(lambda dist: dist.activate())
File "/Users/wickman/Python/CPython-2.6.9/lib/python2.6/site-packages/pkg_resources.py", line 698, in subscribe
callback(dist)
File "/Users/wickman/Python/CPython-2.6.9/lib/python2.6/site-packages/pkg_resources.py", line 2736, in <lambda>
add_activation_listener(lambda dist: dist.activate())
File "/Users/wickman/Python/CPython-2.6.9/lib/python2.6/site-packages/pkg_resources.py", line 2274, in activate
list(map(declare_namespace, self._get_metadata('namespace_packages.txt')))
File "/Users/wickman/Python/CPython-2.6.9/lib/python2.6/site-packages/pkg_resources.py", line 1870, in declare_namespace
path = sys.modules[parent].__path__
KeyError: 'twitter'
So even pkg_resources is surprised as well. If I do the following:
PYTHONPATH=whl_dist python -c 'import site; site.addsitedir("whl_dist"); import twitter.common.python'
then it works, since the twitter.common.python-0.3.1-py2.6-nspkg.pth gets processed properly and module.__path__s populated accordingly. I would expect pkg_resources to handle this fine but apparently it doesn't.
Any ideas? Bug in pkg_resources, wheel or PEBKAC?
Thanks!
~brian