mojodna/oauth-proxy — pull request #5 by zooko (2013-09-27 04:14:57+00:00)
Title: add "twisted.plugins" to the list of "packages"

This is technically wrong, because "twisted.plugins" is not actually a Python
package in the oauth-proxy distribution. (A "Python package" is a directory
with an "__init__.py" file in it.)

But, this convinces installers like pip to create a directory named
"twisted/plugins" somewhere on the sys.path (in my manual test with pip 1.4, it
was "/usr/local/lib/python2.7/dist-packages/twisted/plugins/") and -- combined
with the "package_data" config option -- to copy the proxy.py file into it.
This is necessary and sufficient to let the oauth-proxy command load the
plugin.

Thanks to the author of this web page, from which I just now re-learned this
hack: http://chrismiles.livejournal.com/23399.html

Here is a ticket about an issue in pip which used to prevent this hack from
working but has been fixed:

https://github.com/pypa/pip/issues/355

Older versions of setuptools will print a warning every time you run the
oauth-proxy command. The warning says:

"""
/usr/lib/python2.7/dist-packages/zope/__init__.py:3: UserWarning: Module twisted was already imported from /usr/lib/python2.7/dist-packages/twisted/__init__.pyc, but /usr/local/lib/python2.7/dist-packages is being added to sys.path
"""

However, I just tested this with the current stable release of setuptools --
v1.1.6, and it no longer prints this warning.