Mercurial > sat_docs
view scripts/list_plugins/list_plugins.py @ 80:686a8c982c3f
docker: updated Dockerfiles:
- use HTTPS URLs instead of HTTP
- prosody image know use prosody Debian repository instead of Debian Jessie version, prosody 0.10 is used
- prosody configuration is now in prosody directory next to Dockerfile, instead of using difficult to maintain sed calls
- community modules are downloaded from mercurial, and only needed ones are kept
- no more remote-roster hack \o/
- pubsub component is not at pubsub.[domain] (was sat-pubsub before)
- SàT media are gotten from hg instead of ftp, so they are up-to-date with SàT version
- libervia image now use pip for txJSON-RPC
- fixed now needed jinja2 installation
- fixed libervia/admin accounts auto-creation script
- fixed uid/gid for prosody in data image
- removed not needed anymore nox option in base image
- added python-pip in base image
- docker images now work with current dev version (0.6.0D)
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 12 Feb 2016 20:24:24 +0100 |
parents | cea50c3e94f0 |
children |
line wrap: on
line source
#!/usr/bin/python # -*- coding: utf-8 -*- """ SàT website: Salut à Toi's presentation website Copyright (C) 2015 Jérôme Poisson (goffi@goffi.org) Copyright (C) 2015 Adrien Cossa (souliane@mailoo.org) This file is part of SàT website. SàT website is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Foobar is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with Foobar. If not, see <http://www.gnu.org/licenses/>. """ from sat import plugins import pkgutil WEBSITE = "/home/souliane/workspace/sat_website" HEADER = u""" {% comment %} SàT website: Salut à Toi's presentation website Copyright (C) 2012 Jérôme Poisson (goffi@goffi.org) Copyright (C) 2015 Adrien Cossa (souliane@mailoo.org) This file is part of SàT website. SàT website is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Foobar is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with Foobar. If not, see <http://www.gnu.org/licenses/>. NOTE: this file has been automatically generated by the following script: http://repos.goffi.org/sat_docs/file/tip/scripts/list_plugins/list_plugins.py Please avoid manual modification, try to update the script instead! Before / after a regeneration, don't forget to save / merge the manual modifications. {% endcomment %} {% load i18n %} """ import urllib2 import lxml.html # use it to retrieve the XEP name from the official list XEPS_URL = "http://xmpp.org/xmpp-protocols/xmpp-extensions/" def get_infos(): 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'] setXEP(name) protocols = infos['protocols'] for protocol in protocols: if protocol != name: setXEP(protocol) else: name = '{% trans "' + infos['name'] + '" %}' setEXP(name) return result def print_infos(infos, file): with open(file, 'w',) as f: f.write(HEADER.encode("utf-8")) for name, url, desc in infos: name = ('<a href="%s" target="#">%s</a>' % (url, name)) if url else name entry = u""" <div class="row"> <div class="col-md-2">%s</div> <div class="col-md-7 feature">%s</div> </div>""" % (name, desc) f.write(entry.encode("utf-8")) infos = get_infos() for type_ in ("xep", "exp"): print_infos(infos[type_], "%s/templates/sat_website/specifications_%s.html" % (WEBSITE, type_))