From 99d326a818a49faf457c707ceeec6163bf8c8e16 Mon Sep 17 00:00:00 2001 From: Paul Eggleton Date: Thu, 23 Feb 2012 17:38:08 +0000 Subject: 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 Signed-off-by: Richard Purdie --- bitbake/lib/bb/parse/parse_py/ConfHandler.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'bitbake/lib/bb/parse/parse_py/ConfHandler.py') 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): def supports(fn, d): return fn[-5:] == ".conf" -def include(oldfn, fn, data, error_out): +def include(oldfn, fn, lineno, data, error_out): """ - error_out If True a ParseError will be raised if the to be included - config-files could not be included. + error_out: A string indicating the verb (e.g. "include", "inherit") to be + used in a ParseError that will be raised if the file to be included could + not be included. Specify False to avoid raising an error in this case. """ if oldfn == fn: # prevent infinite recursion return None @@ -68,7 +69,7 @@ def include(oldfn, fn, data, error_out): ret = handle(fn, data, True) except IOError: if error_out: - raise ParseError("Could not %(error_out)s file %(fn)s" % vars() ) + raise ParseError("Could not %(error_out)s file %(fn)s" % vars(), oldfn, lineno) logger.debug(2, "CONF file '%s' not found", fn) def handle(fn, data, include): @@ -131,7 +132,7 @@ def feeder(lineno, s, fn, statements): ast.handleExport(statements, fn, lineno, m) return - raise ParseError("%s:%d: unparsed line: '%s'" % (fn, lineno, s)); + raise ParseError("unparsed line: '%s'" % s, fn, lineno); # Add us to the handlers list from bb.parse import handlers -- cgit v1.2.3-54-g00ecf