Commit 488d0431 authored by maruel@chromium.org's avatar maruel@chromium.org

Improve PRESUBMIT.py error messages.

TEST=presubmit.py
BUG=none

Review URL: http://codereview.chromium.org/4279002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@64903 0039d316-1c4b-4281-b951-d872f2087c98
parent ed68d975
...@@ -57,15 +57,18 @@ def RunPylint(input_api, output_api): ...@@ -57,15 +57,18 @@ def RunPylint(input_api, output_api):
# It uses non-standard pylint exceptions that makes pylint always fail. # It uses non-standard pylint exceptions that makes pylint always fail.
files.remove('cpplint.py') files.remove('cpplint.py')
try: try:
proc = input_api.subprocess.Popen(['pylint', '-E'] + files) proc = input_api.subprocess.Popen(['pylint', '-E'] + sorted(files))
except OSError: proc.communicate()
if proc.returncode:
return [output_api.PresubmitError('Fix pylint errors first.')]
return []
except OSError, e:
if input_api.platform == 'win32': if input_api.platform == 'win32':
# It's windows, give up. return [output_api.PresubmitNotifyResult(
return [] 'Warning: Can\'t run pylint because it is not installed. Please '
else: 'install manually\n'
return [output_api.PresubmitError( 'Cannot do static analysis of python files.')]
'Please install pylint with "easy_install pylint"')] return [output_api.PresubmitError(
proc.communicate() 'Please install pylint with "sudo apt-get install python-setuptools; '
if proc.returncode: 'sudo easy_install pylint"\n'
return [output_api.PresubmitError('Fix pylint errors first.')] 'Cannot do static analysis of python files.')]
return []
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment