[Twisted-Python] How do you write a setup.py that installs plugins?

Laurens Van Houtven _ at lvh.io
Fri Jun 28 08:50:06 MDT 2013


How are you supposed to write a setup.py that installs twistd plugins?

I have this piece of tribal knowledge:

from setuptools.command import egg_info

def _top_level(name):
    return name.split('.', 1)[0]

def _hacked_write_toplevel_names(cmd, basename, filename):
    names = map(_top_level, cmd.distribution.iter_distribution_names())
    pkgs = dict.fromkeys(set(names) - set(["twisted"]))
    cmd.write_file("top-level names", filename, '\n'.join(pkgs) + '\n')

egg_info.write_toplevel_names = _hacked_write_toplevel_names

But I don't actually know what's actually required, and I don't actually
know where this is documented (if at all). Plus, it looks pretty
unsanitary, and appears to introduce a dependency to setuptools.

So, how am I supposed to do this?

Thanks in advance
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://twistedmatrix.com/pipermail/twisted-python/attachments/20130628/370cba6b/attachment.html>

More information about the Twisted-Python mailing list