From dc9263a77ce3892f944b2ea08dc79e8e2f44d895 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 19 Jan 2015 00:50:18 +0100 Subject: [PATCH] Revert "run_checks: Run pep257 via subprocess." This reverts commit 380537d49c1ce04d184ab424a893559e6b0a6d5b. Conflicts: scripts/run_checks.py This is needed because it seems pep257 doesn't install a binary on Windows. --- scripts/run_checks.py | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/scripts/run_checks.py b/scripts/run_checks.py index e65bb44a5..1fb7f9d04 100755 --- a/scripts/run_checks.py +++ b/scripts/run_checks.py @@ -102,6 +102,27 @@ def run(name, target=None, print_version=False): return status +def check_pep257(target): + """Run pep257 checker with args passed.""" + # pylint: disable=assignment-from-no-return,no-member + args = _get_args('pep257') + sys.argv = ['pep257', target] + if args is not None: + sys.argv += args + try: + if hasattr(pep257, 'run_pep257'): + # newer pep257 versions + status = pep257.run_pep257() + else: + # older pep257 versions + status = pep257.main(*pep257.parse_options()) + print() + return status + except Exception: + traceback.print_exc() + return None + + def check_unittest(): """Run the unittest checker.""" suite = unittest.TestLoader().discover('.') @@ -231,7 +252,7 @@ def _get_checkers(args): # "Dynamic" checkers which exist once for each target. for target in config.get('DEFAULT', 'targets').split(','): checkers[target] = collections.OrderedDict([ - ('pep257', functools.partial(run, 'pep257', target, args.version)), + ('pep257', functools.partial(check_pep257, target)), ('flake8', functools.partial(run, 'flake8', target, args.version)), ('vcs', functools.partial(check_vcs_conflict, target)), ('pylint', functools.partial(run, 'pylint', target, args.version)),