--- a/checker.py Mon Jun 13 23:05:22 2016 +0800
+++ b/checker.py Mon Jun 13 23:35:59 2016 +0800
from argparse import ArgumentParser, FileType
from datetime import datetime
from shutil import rmtree
-from subprocess import check_call, CalledProcessError
+from subprocess import check_call, check_output, CalledProcessError
from tempfile import mkdtemp
def run_ignore_1(fn, args):
except CalledProcessError as e:
-def run(args, silent=False, ignore_1=False):
+def run(args, silent=False, get_output=False, ignore_1=False):
+ print('$ ' + ' '.join(args))
+ result = run_ignore_1(fn, args)
print('# C&O error: {}'.format(e))
print('# C&O job failed')
+ print('# C&O task: checks')
+ for linter in config['linters']:
+ if 'cmd' not in linter or 'files' not in linter:
+ for fpat in linter['files']:
+ args.extend(['-I', fpat])
+ cmd = ['hg', 'files'] + args
+ files = run(cmd, silent=True, get_output=True, ignore_1=True)
print('# C&O task: cleanup')