#!/usr/bin/env python
# -*- Mode: Python -*-
# vi:si:et:sw=4:sts=4:ts=4

# this program regenerates the dropin.cache file for twisted,
# or for the modules specified on the command line

import sys
from twisted.plugin import IPlugin, getPlugins

which = None
if len(sys.argv) > 1:
    which = sys.argv[1:]

if not which:
    list(getPlugins(IPlugin))
else:
    from twisted.python import reflect
    for w in which:
        try:
            module = reflect.namedAny(w)
        except AttributeError:
            sys.stderr.write("No module '%s' found.\n" % w)
            continue
        list(getPlugins(IPlugin, module))
