| OLD | NEW |
| 1 # Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 1 # Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. |
| 2 # | 2 # |
| 3 # Use of this source code is governed by a BSD-style license | 3 # Use of this source code is governed by a BSD-style license |
| 4 # that can be found in the LICENSE file in the root of the source | 4 # that can be found in the LICENSE file in the root of the source |
| 5 # tree. An additional intellectual property rights grant can be found | 5 # tree. An additional intellectual property rights grant can be found |
| 6 # in the file PATENTS. All contributing project authors may | 6 # in the file PATENTS. All contributing project authors may |
| 7 # be found in the AUTHORS file in the root of the source tree. | 7 # be found in the AUTHORS file in the root of the source tree. |
| 8 | 8 |
| 9 | 9 |
| 10 def _CommonChecks(input_api, output_api): | 10 def _CommonChecks(input_api, output_api): |
| 11 results = [] | 11 results = [] |
| 12 | 12 |
| 13 # Run Pylint over the files in the directory. | 13 # Run Pylint over the files in the directory. |
| 14 pylint_checks = input_api.canned_checks.GetPylint(input_api, output_api) | 14 pylint_checks = input_api.canned_checks.GetPylint(input_api, output_api) |
| 15 results.extend(input_api.RunTests(pylint_checks)) | 15 results.extend(input_api.RunTests(pylint_checks)) |
| 16 | 16 |
| 17 # Run the MB unittests. | 17 # Run the MB unittests. |
| 18 results.extend(input_api.canned_checks.RunUnitTestsInDirectory( | 18 results.extend(input_api.canned_checks.RunUnitTestsInDirectory( |
| 19 input_api, output_api, '.', [ r'^.+_unittest\.py$'])) | 19 input_api, output_api, '.', [ r'^.+_unittest\.py$'])) |
| 20 | 20 |
| 21 # Validate the format of the mb_config.pyl file. | 21 # Validate the format of the mb_config.pyl file. |
| 22 mb_config_path = input_api.os_path.join(input_api.PresubmitLocalPath(), | 22 cmd = [input_api.python_executable, 'mb.py', 'validate'] |
| 23 '..', '..', 'webrtc', 'build', | |
| 24 'mb_config.pyl') | |
| 25 cmd = [input_api.python_executable, 'mb.py', 'validate', '--config-file', | |
| 26 mb_config_path] | |
| 27 kwargs = {'cwd': input_api.PresubmitLocalPath()} | 23 kwargs = {'cwd': input_api.PresubmitLocalPath()} |
| 28 results.extend(input_api.RunTests([ | 24 results.extend(input_api.RunTests([ |
| 29 input_api.Command(name='mb_validate', | 25 input_api.Command(name='mb_validate', |
| 30 cmd=cmd, kwargs=kwargs, | 26 cmd=cmd, kwargs=kwargs, |
| 31 message=output_api.PresubmitError)])) | 27 message=output_api.PresubmitError)])) |
| 32 | 28 |
| 33 results.extend( | 29 results.extend( |
| 34 input_api.canned_checks.CheckLongLines( | 30 input_api.canned_checks.CheckLongLines( |
| 35 input_api, | 31 input_api, |
| 36 output_api, | 32 output_api, |
| 37 maxlen=80, | 33 maxlen=80, |
| 38 source_file_filter=lambda x: 'mb_config.pyl' in x.LocalPath())) | 34 source_file_filter=lambda x: 'mb_config.pyl' in x.LocalPath())) |
| 39 | 35 |
| 40 return results | 36 return results |
| 41 | 37 |
| 42 | 38 |
| 43 def CheckChangeOnUpload(input_api, output_api): | 39 def CheckChangeOnUpload(input_api, output_api): |
| 44 return _CommonChecks(input_api, output_api) | 40 return _CommonChecks(input_api, output_api) |
| 45 | 41 |
| 46 | 42 |
| 47 def CheckChangeOnCommit(input_api, output_api): | 43 def CheckChangeOnCommit(input_api, output_api): |
| 48 return _CommonChecks(input_api, output_api) | 44 return _CommonChecks(input_api, output_api) |
| OLD | NEW |