aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2017-11-16 08:20:32 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2017-11-16 08:20:32 +0000
commit4ea0d0e9afbeec91b538897ea463e3e08dc28044 (patch)
tree908da16226aadb660ae177c672dd6b0a1c920938
parent590695e3c1023bf92d1f44a9a998c2c13b7e953b (diff)
parent54a38df79b508cf7566c7e50f298bf64917e3d45 (diff)
downloadrepohooks-4ea0d0e9afbeec91b538897ea463e3e08dc28044.tar.gz
Snap for 4455093 from 54a38df79b508cf7566c7e50f298bf64917e3d45 to pi-release
Change-Id: Ic6409f39208eba7f6598c48f5aa52816e2d4da23
-rwxr-xr-xtools/pylint.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/tools/pylint.py b/tools/pylint.py
index 6091c1d..1c8e6f7 100755
--- a/tools/pylint.py
+++ b/tools/pylint.py
@@ -19,12 +19,15 @@
from __future__ import print_function
import argparse
+import errno
import os
import sys
+
DEFAULT_PYLINTRC_PATH = os.path.join(
os.path.dirname(os.path.realpath(__file__)), 'pylintrc')
+
def get_parser():
"""Return a command line parser."""
parser = argparse.ArgumentParser(description=__doc__)
@@ -62,7 +65,17 @@ def main(argv):
if opts.init_hook:
cmd += ['--init-hook', opts.init_hook]
- os.execvp(cmd[0], cmd)
+ try:
+ os.execvp(cmd[0], cmd)
+ except OSError as e:
+ if e.errno == errno.ENOENT:
+ print('%s: unable to run `%s`: %s' % (__file__, cmd[0], e),
+ file=sys.stderr)
+ print('%s: Try installing pylint: sudo apt-get install pylint' %
+ (__file__,), file=sys.stderr)
+ return 1
+ else:
+ raise
if __name__ == '__main__':