"weboob-config update" installs missing modules referenced in ~/.weboob/backends

This commit is contained in:
Romain Bignon 2012-01-17 17:59:03 +01:00
commit 9d87c8bc37
2 changed files with 13 additions and 1 deletions

View file

@ -267,7 +267,7 @@ class WeboobCfg(ReplApplication):
def progress(self, percent, message):
print '=== [%3.0f%%] %s' % (percent*100, message)
self.weboob.repositories.update(Progress())
self.weboob.update(Progress())
def do_install(self, line):
"""

View file

@ -83,6 +83,18 @@ class Weboob(object):
def deinit(self):
self.unload_backends()
def update(self, progress=None):
"""
Update modules.
"""
self.repositories.update(progress)
modules_to_check = set([module_name for name, module_name, params in self.backends_config.iter_backends()])
for module_name in modules_to_check:
minfo = self.repositories.get_module_info(module_name)
if minfo and not minfo.is_installed():
self.repositories.install(minfo, progress)
class LoadError(Exception):
def __init__(self, backend_name, exception):
Exception.__init__(self, unicode(exception))