diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2012-02-23 17:38:08 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-02-23 22:52:15 +0000 |
commit | 99d326a818a49faf457c707ceeec6163bf8c8e16 (patch) | |
tree | 6e03dca72ed109a691356bd2d9feb172423da6ab /bitbake/lib/bb/parse/parse_py/ConfHandler.py | |
parent | ebc0d4252a19e6ab38052473e54138d29b172dfc (diff) | |
download | poky-99d326a818a49faf457c707ceeec6163bf8c8e16.tar.gz |
bitbake: add file and line number to ParseError
Ensure that a file and line number are reported for ParseError where
possible. This helps particularly in the case of inherit and require
which previously did not report either of these upon failure.
(Bitbake rev: f588ba69622a2df35417ced184e56c79ac1b40d5)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/parse/parse_py/ConfHandler.py')
-rw-r--r-- | bitbake/lib/bb/parse/parse_py/ConfHandler.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/bitbake/lib/bb/parse/parse_py/ConfHandler.py b/bitbake/lib/bb/parse/parse_py/ConfHandler.py index 6ae9d973e7..9242632c50 100644 --- a/bitbake/lib/bb/parse/parse_py/ConfHandler.py +++ b/bitbake/lib/bb/parse/parse_py/ConfHandler.py | |||
@@ -44,10 +44,11 @@ def init(data): | |||
44 | def supports(fn, d): | 44 | def supports(fn, d): |
45 | return fn[-5:] == ".conf" | 45 | return fn[-5:] == ".conf" |
46 | 46 | ||
47 | def include(oldfn, fn, data, error_out): | 47 | def include(oldfn, fn, lineno, data, error_out): |
48 | """ | 48 | """ |
49 | error_out If True a ParseError will be raised if the to be included | 49 | error_out: A string indicating the verb (e.g. "include", "inherit") to be |
50 | config-files could not be included. | 50 | used in a ParseError that will be raised if the file to be included could |
51 | not be included. Specify False to avoid raising an error in this case. | ||
51 | """ | 52 | """ |
52 | if oldfn == fn: # prevent infinite recursion | 53 | if oldfn == fn: # prevent infinite recursion |
53 | return None | 54 | return None |
@@ -68,7 +69,7 @@ def include(oldfn, fn, data, error_out): | |||
68 | ret = handle(fn, data, True) | 69 | ret = handle(fn, data, True) |
69 | except IOError: | 70 | except IOError: |
70 | if error_out: | 71 | if error_out: |
71 | raise ParseError("Could not %(error_out)s file %(fn)s" % vars() ) | 72 | raise ParseError("Could not %(error_out)s file %(fn)s" % vars(), oldfn, lineno) |
72 | logger.debug(2, "CONF file '%s' not found", fn) | 73 | logger.debug(2, "CONF file '%s' not found", fn) |
73 | 74 | ||
74 | def handle(fn, data, include): | 75 | def handle(fn, data, include): |
@@ -131,7 +132,7 @@ def feeder(lineno, s, fn, statements): | |||
131 | ast.handleExport(statements, fn, lineno, m) | 132 | ast.handleExport(statements, fn, lineno, m) |
132 | return | 133 | return |
133 | 134 | ||
134 | raise ParseError("%s:%d: unparsed line: '%s'" % (fn, lineno, s)); | 135 | raise ParseError("unparsed line: '%s'" % s, fn, lineno); |
135 | 136 | ||
136 | # Add us to the handlers list | 137 | # Add us to the handlers list |
137 | from bb.parse import handlers | 138 | from bb.parse import handlers |