# HG changeset patch # User souliane # Date 1449011671 -3600 # Node ID cea50c3e94f01aa1a69b4f650600fd64dab8626a # Parent 831c4f264650bc2e805966c5382c96a454c562a4 list_plugins script also takes in consideration the XEPs that are defined in the "protocols" field of PLUGIN_INFO diff -r 831c4f264650 -r cea50c3e94f0 scripts/list_plugins/list_plugins.py --- a/scripts/list_plugins/list_plugins.py Tue Dec 01 17:50:15 2015 +0100 +++ b/scripts/list_plugins/list_plugins.py Wed Dec 02 00:14:31 2015 +0100 @@ -69,25 +69,34 @@ result = {} doc = lxml.html.parse(XEPS_URL) + def setXEP(name): + url = "http://xmpp.org/extensions/%s.html" % name.lower() + # use the XEP name as description + desc = doc.xpath("//tr[@id='%s']/td" % name.lower().replace("-", ""))[1].text + desc = '{% trans "' + desc.replace('"', '\\"') + '" %}' + result.setdefault("xep", []).append((name, url, desc)) + + def setEXP(name): + desc = infos['description'] + if desc.startswith('Implementation of '): + desc = desc[18:] + desc = '{% trans "' + desc.replace('"', '\\"') + '" %}' + result.setdefault("exp", []).append((name, None, desc)) + for loader, module_name, is_pkg in pkgutil.walk_packages(plugins.__path__): module = loader.find_module(module_name).load_module(module_name) infos = getattr(module, 'PLUGIN_INFO') if infos['type'] == 'XEP': name = infos['import_name'] - url = "http://xmpp.org/extensions/%s.html" % name.lower() - key = "xep" - # use the XEP name as description - desc = doc.xpath("//tr[@id='%s']/td" % name.lower().replace("-", ""))[1].text + setXEP(name) + protocols = infos['protocols'] + for protocol in protocols: + if protocol != name: + setXEP(protocol) else: name = '{% trans "' + infos['name'] + '" %}' - url = None - key = "exp" - desc = infos['description'] - if desc.startswith('Implementation of '): - desc = desc[18:] - desc = '{% trans "' + desc.replace('"', '\\"') + '" %}' - result.setdefault(key, []).append((name, url, desc)) + setEXP(name) return result