--- a/checker.py Sat Jul 30 13:35:44 2016 +0800
+++ b/checker.py Sat Jul 30 13:40:27 2016 +0800
-def combined_env(lenv, penv):
+def process_config(lc, pc):
+ 'env': combined(lc.get('env'), pc.get('env')),
+ 'vars': combined(lc.get('vars', {}), pc.get('vars', {}))
+ return [item % c['vars'] for item in items]
+ for key in ('flags', 'post_flags'):
+ c[key] = render(lc.get(key, []) + pc.get(key, []))
+ c['setup'] = [render(steps) for steps in lc.get('setup', [])]
+ c['exec'] = render(lc['exec'])
+ c['version'] = render(lc['version'])
def git_clone(url, dest):
- print('# C&O installing linters: {}'.format(' '.join(distinct)))
if name in linter_config:
lc = read_linter_config(name)
print("# C&O skipping '{}': no config".format(name))
print("# C&O skipping '{}': no 'exec' in config".format(name))
- for item in lc.get('setup', []):
+ installing = [name for name in distinct if name in linter_config]
+ print('# C&O installing linters: {}'.format(' '.join(installing)))
+ if name not in linter_config:
+ lc = process_config(linter_config[name], linter)
+ if 'setup' in lc and str(lc['setup']) not in setup_cache:
+ for item in lc['setup']:
+ setup_cache.add(str(lc['setup']))
- env = combined_env(lc.get('env'), linter.get('env'))
- if not run(lc['exec'] + lc['version'], env=env):
+ if not run(lc['exec'] + lc['version'], env=lc['env']):
- print('# C&O linters installed: {}'.format(' '.join(linter_config.keys())))
+ if name not in installed:
+ print('# C&O linters installed: {}'.format(' '.join(installed)))
print('# C&O task: checks')
- if linter['name'] not in linter_config:
+ if name not in linter_config:
if config['scm'] == 'git':
- lc = linter_config[linter['name']]
+ lc = process_config(linter_config[name], linter)
- flags = lc.get('flags', []) + linter.get('flags', [])
- pf = lc.get('post_flags', []) + linter.get('post_flags', [])
+ cmd = lc['exec'] + lc['flags'] + [f] + lc['post_flags']
codes = lc.get('codes', (1,))
- env = combined_env(lc.get('env'), linter.get('env'))
- if not run(cmd + flags + [f] + pf, ignore_codes=codes, env=env):
+ if not run(cmd, ignore_codes=codes, env=lc['env']):