Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import os | |
| 6 import sys | 5 import sys |
| 7 | 6 |
| 8 | 7 |
| 9 def CheckChange(input_api, output_api, committing): | 8 def CheckChange(input_api, output_api, committing): |
| 10 # We need to change the path so that we can import ceee_presubmit | 9 # We need to change the path so that we can import ceee_presubmit |
| 11 # which lies at the root of the ceee folder. And we do it here so that | 10 # which lies at the root of the ceee folder. And we do it here so that |
| 12 # it doesn't pollute all the cases where we get imported yet not called. | 11 # it doesn't pollute all the cases where we get imported yet not called. |
| 13 sys.path.append(os.path.join(input_api.PresubmitLocalPath(), '../ceee')) | 12 old_sys_path = sys.path |
| 14 import ceee_presubmit | 13 try: |
| 15 return ceee_presubmit.CheckChange(input_api, | 14 sys.path = ([input_api.os_path.join(input_api.PresubmitLocalPath(), |
|
M-A Ruel
2011/01/18 16:06:23
nit: I think you should create a named variable si
Jakob Kummerow
2011/01/18 16:33:54
Done.
| |
| 16 output_api, | 15 '../ceee')] + |
| 17 committing) | 16 sys.path) |
| 17 import ceee_presubmit | |
| 18 result = ceee_presubmit.CheckChange(input_api, | |
|
M-A Ruel
2011/01/18 16:06:23
you can return here, the finally clause will still
Jakob Kummerow
2011/01/18 16:33:54
Done.
| |
| 19 output_api, | |
| 20 committing) | |
| 21 finally: | |
| 22 sys.path = old_sys_path | |
| 23 return result | |
| 24 | |
| 18 | 25 |
| 19 | 26 |
| 20 def CheckChangeOnUpload(input_api, output_api): | 27 def CheckChangeOnUpload(input_api, output_api): |
| 21 return CheckChange(input_api, output_api, False) | 28 return CheckChange(input_api, output_api, False) |
| 22 | 29 |
| 23 | 30 |
| 24 def CheckChangeOnCommit(input_api, output_api): | 31 def CheckChangeOnCommit(input_api, output_api): |
| 25 return CheckChange(input_api, output_api, True) | 32 return CheckChange(input_api, output_api, True) |
| OLD | NEW |