Comment 6 for bug 755025

Revision history for this message
Jean-Paul Calderone (exarkun) wrote :

The third one is an example of the plugin feature supported by twistd. One way to map this back to a file (which can then be mapped to a packet, I suppose) is like this:

    from twisted.plugin import getPlugins
    from twisted.application.service import IServiceMaker
    from twisted.python.modules import getModule

    [plg] = [p for p in getPlugins(IServiceMaker) if p.tapname == 'pokerserver']
    print getModule(plg.tapname).filePath.path

I think this is a fairly good way, but I haven't tested it extensively. One issue with it is that it is pointing to the file that contains the code implementing the plugin, not the file that contains the actual plugin definition itself. Usually these two files belong to the same package, but one could imagine someone doing something funny and breaking this assumption. It's probably a pretty good heuristic for apport, at least.