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-07-08 06:59:40 -0700
commitf90b0188fe60062f326fccdfcda8605c7184b58a (patch)
tree65a271485f311f0f911fa60771e9432feebb8e7b /scripts/gcc-wrapper.py
parent048e48924e6d09e77b0c48536812c3c6f52610fc (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 923127cfef1..3ef485742a8 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