Chromium Code Reviews| Index: PRESUBMIT.py |
| diff --git a/PRESUBMIT.py b/PRESUBMIT.py |
| index 751ae525751be38445e4bca2fd0a02c0ac7dd03e..ad8f3753fffa9c41d3cd1f3845bfccfee215a7e4 100644 |
| --- a/PRESUBMIT.py |
| +++ b/PRESUBMIT.py |
| @@ -1784,29 +1784,28 @@ def CheckChangeOnCommit(input_api, output_api): |
| def GetPreferredTryMasters(project, change): |
| - import re |
| - files = change.LocalPaths() |
| - |
| - import os |
| import json |
| - with open(os.path.join( |
| - change.RepositoryRoot(), 'testing', 'commit_queue', 'config.json')) as f: |
| - cq_config = json.load(f) |
| - cq_verifiers = cq_config.get('verifiers_no_patch', {}) |
| - cq_try_jobs = cq_verifiers.get('try_job_verifier', {}) |
| - builders = cq_try_jobs.get('launched', {}) |
| - |
| - for master, master_config in cq_try_jobs.get('triggered', {}).iteritems(): |
| - for triggered_bot in master_config: |
| - builders.get(master, {}).pop(triggered_bot, None) |
| - |
| - # Explicitly iterate over copies of dicts since we mutate them. |
| - for master in builders.keys(): |
| - for builder in builders[master].keys(): |
| - # Do not trigger presubmit builders, since they're likely to fail |
| - # (e.g. OWNERS checks before finished code review), and we're |
| - # running local presubmit anyway. |
| - if 'presubmit' in builder: |
| - builders[master].pop(builder) |
| - |
| - return builders |
| + import os.path |
| + import subprocess |
| + |
| + cq_config_path = os.path.join( |
| + change.RepositoryRoot(), 'infra', 'config', 'cq.cfg') |
|
jam
2015/05/29 18:07:27
how does this work? i.e. if i do fetch chromium, I
pgervais
2015/05/29 18:14:45
Yes you do :-) CQ configuration now lives in proje
jam
2015/05/29 18:19:46
ah, looks like the checkout i checked was a day ol
pgervais
2015/05/29 18:23:32
sys.executable is missing on line 1796
Sergiy Byelozyorov
2015/05/29 18:57:55
This would help, because python doesn't use $PATH
Sergiy Byelozyorov
2015/05/29 19:04:20
Added binaries in https://codereview.chromium.org/
|
| + # commit_queue.py below is a script in depot_tools directory, which has a |
| + # 'builders' command to retrieve a list of CQ builders from the CQ config. |
| + masters = json.loads(subprocess.check_output( |
| + ['commit_queue.py', 'builders', cq_config_path])) |
| + |
| + # Explicitly iterate over copies of keys since we mutate them. |
| + for master in masters.keys(): |
| + for builder in masters[master].keys(): |
| + # Do not trigger presubmit builders, since they're likely to fail |
| + # (e.g. OWNERS checks before finished code review), and we're |
| + # running local presubmit anyway. |
| + if 'presubmit' in builder: |
| + masters[master].pop(builder) |
| + else: |
| + # Convert testfilter format to the one expected by git-cl-try. |
| + testfilter = masters[master][builder].get('testfilter', 'defaulttests') |
| + masters[master][builder] = [testfilter] |
| + |
| + return masters |