Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(563)

Unified Diff: presubmit_canned_checks.py

Issue 1208743002: Changes to improve multiprocessing PRESUBMIT support in Windows (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: fix tests Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | presubmit_support.py » ('j') | presubmit_support.py » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: presubmit_canned_checks.py
diff --git a/presubmit_canned_checks.py b/presubmit_canned_checks.py
index edd63321963227ed690b344b408005c74bfa236e..620661f38e96b7a71a80eb73d4f8edf39a8de5de 100644
--- a/presubmit_canned_checks.py
+++ b/presubmit_canned_checks.py
@@ -771,29 +771,30 @@ def GetPylint(input_api, output_api, white_list=None, black_list=None,
env['PYTHONPATH'] = input_api.os_path.pathsep.join(
extra_paths_list + sys.path).encode('utf8')
- def GetPylintCmd(files, extra, parallel):
+ def GetPylintCmd(flist, extra, parallel):
# Windows needs help running python files so we explicitly specify
# the interpreter to use. It also has limitations on the size of
# the command-line, so we pass arguments via a pipe.
cmd = [input_api.python_executable,
input_api.os_path.join(_HERE, 'third_party', 'pylint.py'),
'--args-on-stdin']
- if len(files) == 1:
- description = files[0]
+ if len(flist) == 1:
+ description = flist[0]
else:
- description = '%s files' % len(files)
+ description = '%s files' % len(flist)
+ args = extra_args[:]
if extra:
- cmd.extend(extra)
+ args.extend(extra)
description += ' using %s' % (extra,)
if parallel:
- cmd.append('--jobs=%s' % input_api.cpu_count)
+ args.append('--jobs=%s' % input_api.cpu_count)
description += ' on %d cores' % input_api.cpu_count
return input_api.Command(
name='Pylint (%s)' % description,
cmd=cmd,
- kwargs={'env': env, 'stdin': '\n'.join(files + extra_args)},
+ kwargs={'env': env, 'stdin': '\n'.join(args + flist)},
message=error_type)
# Always run pylint and pass it all the py files at once.
@@ -807,12 +808,18 @@ def GetPylint(input_api, output_api, white_list=None, black_list=None,
if True:
# pylint's cycle detection doesn't work in parallel, so spawn a second,
# single-threaded job for just that check.
- return [
- GetPylintCmd(files, ["--disable=cyclic-import"], True),
- GetPylintCmd(files, ["--disable=all", "--enable=cyclic-import"], False)
- ]
+
+ # Some PRESUBMITs explicitly mention cycle detection.
+ if not any('R0401' in a or 'cyclic-import' in a for a in extra_args):
+ return [
+ GetPylintCmd(files, ["--disable=cyclic-import"], True),
+ GetPylintCmd(files, ["--disable=all", "--enable=cyclic-import"], False)
+ ]
+ else:
+ return [ GetPylintCmd(files, [], True) ]
+
else:
- return map(lambda x: GetPylintCmd([x], extra_args, 1), files)
+ return map(lambda x: GetPylintCmd([x], [], 1), files)
def RunPylint(input_api, *args, **kwargs):
« no previous file with comments | « no previous file | presubmit_support.py » ('j') | presubmit_support.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698