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

Unified Diff: presubmit_canned_checks.py

Issue 5995003: Workaround the fact that pylint calls sys.exit(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: fix presubmit check while at it Created 10 years 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 | trychange.py » ('j') | no next file with comments »
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 51dfcff37e40cf1ebeff077845fb3b541485675b..bfbf52e94220c0a3f9328932db82419874edd2be 100644
--- a/presubmit_canned_checks.py
+++ b/presubmit_canned_checks.py
@@ -494,9 +494,10 @@ def RunPylint(input_api, output_api, white_list=None, black_list=None):
# were listed, try to run pylint.
try:
from pylint import lint
- if lint.Run(sorted(files)):
- return [output_api.PresubmitPromptWarning('Fix pylint errors first.')]
- return []
+ result = lint.Run(sorted(files))
+ except SystemExit, e:
+ # pylint has the bad habit of calling sys.exit(), trap it here.
+ result = e.code
except ImportError:
if input_api.platform == 'win32':
return [output_api.PresubmitNotifyResult(
@@ -507,6 +508,9 @@ def RunPylint(input_api, output_api, white_list=None, black_list=None):
'Please install pylint with "sudo apt-get install python-setuptools; '
'sudo easy_install pylint"\n'
'Cannot do static analysis of python files.')]
+ if result:
+ return [output_api.PresubmitPromptWarning('Fix pylint errors first.')]
+ return []
finally:
warnings.filterwarnings('default', category=DeprecationWarning)
« no previous file with comments | « no previous file | trychange.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698