aboutsummaryrefslogtreecommitdiff
path: root/scripts/gcc-wrapper.py
diff options
context:
space:
mode:
authorGregory Bean <gbean@codeaurora.org>2011-06-07 20:29:10 -0700
committerStephen Boyd <sboyd@codeaurora.org>2013-02-20 02:49:35 -0800
commit74b9ffc4bc18b5691dbc98d62c776aebd01ca5a6 (patch)
tree4b12a4c6e8acf4437d6256d5960dce1967650b61 /scripts/gcc-wrapper.py
parentb5b907b61fdb8e2c1caa7c17ef53fa3aac7498d7 (diff)
gcc-wrapper: print friendlier errors.
Print something friendlier than a stack trace for OSErrors, and something helpful for 'file not found' errors. This prevents flummoxing people who build the kernel without the compiler in their path, which is far and away the most common error. Change-Id: If1a3dfdd0868abc8531a06a61f2f374b54c64cd0 Signed-off-by: Gregory Bean <gbean@codeaurora.org> (cherry picked from commit e1f91f8e6b38594caa30bf82c586674b83e9c0b4)
Diffstat (limited to 'scripts/gcc-wrapper.py')
-rwxr-xr-xscripts/gcc-wrapper.py19
1 files changed, 14 insertions, 5 deletions
diff --git a/scripts/gcc-wrapper.py b/scripts/gcc-wrapper.py
index a43983a61d8..dda561c47f8 100755
--- a/scripts/gcc-wrapper.py
+++ b/scripts/gcc-wrapper.py
@@ -30,6 +30,7 @@
# Invoke gcc, looking for warnings, and causing a failure if there are
# non-whitelisted warnings.
+import errno
import re
import os
import sys
@@ -93,12 +94,20 @@ def run_gcc():
compiler = sys.argv[0]
- proc = subprocess.Popen(args, stderr=subprocess.PIPE)
- for line in proc.stderr:
- print line,
- interpret_warning(line)
+ try:
+ proc = subprocess.Popen(args, stderr=subprocess.PIPE)
+ for line in proc.stderr:
+ print line,
+ interpret_warning(line)
- result = proc.wait()
+ result = proc.wait()
+ except OSError as e:
+ result = e.errno
+ if result == errno.ENOENT:
+ print args[0] + ':',e.strerror
+ print 'Is your PATH set correctly?'
+ else:
+ print ' '.join(args), str(e)
return result