diff --git a/tools/local_run.py b/tools/local_run.py index 4f5b7929f0c9c8765a9b2f989b2d145d74b109ae..d7dbbc05619e0734397522ef0a42267e6c776278 100644 --- a/tools/local_run.py +++ b/tools/local_run.py @@ -43,13 +43,14 @@ # Hide output unless there is an error p = subprocess.Popen( - [sys.executable, os.path.join(project, 'scripts', 'weboob-config'), 'update'], + [sys.executable, os.path.join(project, 'scripts', 'weboob-config'), 'update', '-d'], env=env, - stdout=subprocess.PIPE) + stdout=subprocess.PIPE, stderr=subprocess.STDOUT) s = p.communicate() if p.returncode != 0: print(s[0]) - sys.exit(p.returncode) + if p.returncode > 1: + sys.exit(p.returncode) if os.path.exists(script): spath = script diff --git a/weboob/applications/weboobcfg/weboobcfg.py b/weboob/applications/weboobcfg/weboobcfg.py index 53b6b61d2cc45e932e0026beb3d9805a75f63969..fcef93375158d58d8af3a0b12adab1b5d9143cda 100644 --- a/weboob/applications/weboobcfg/weboobcfg.py +++ b/weboob/applications/weboobcfg/weboobcfg.py @@ -320,3 +320,8 @@ def do_update(self, line): Update weboob. """ self.weboob.update(ConsoleProgress(self)) + if self.weboob.repositories.errors: + print('Errors building modules: %s' % ', '.join(self.weboob.repositories.errors.keys()), file=self.stderr) + if not self.options.debug: + print('Use --debug to get more information.', file=self.stderr) + return 1 diff --git a/weboob/core/repositories.py b/weboob/core/repositories.py index dc8cbe80c0e0aa683f2266a18e5e87c252994f13..47942be5fb82f5c86b554d290009701197c1a93f 100644 --- a/weboob/core/repositories.py +++ b/weboob/core/repositories.py @@ -132,6 +132,7 @@ def __init__(self, url): self.key_update = 0 self.obsolete = False self.logger = getLogger('repository') + self.errors = {} self.modules = {} @@ -275,6 +276,7 @@ def build_index(self, path, filename): """ self.logger.debug('Rebuild index') self.modules.clear() + self.errors.clear() if os.path.isdir(os.path.join(path, self.KEYDIR)): self.signed = True @@ -296,8 +298,10 @@ def build_index(self, path, filename): if fp: fp.close() except Exception as e: - print('Unable to build module %s: [%s] %s' % (name, type(e).__name__, e), file=sys.stderr) - self.logger.debug(get_backtrace(e)) + self.logger.warning('Unable to build module %s: [%s] %s' % (name, type(e).__name__, e)) + bt = get_backtrace(e) + self.logger.debug(bt) + self.errors[name] = bt else: m = ModuleInfo(module.name) m.version = self.get_tree_mtime(module_path) @@ -745,6 +749,17 @@ def url2filename(url): """ return ''.join([l if l.isalnum() else '_' for l in url]) + def __iter__(self): + for repository in self.repositories: + yield repository + + @property + def errors(self): + errors = {} + for repository in self: + errors.update(repository.errors) + return errors + class InvalidSignature(Exception): def __init__(self, filename):