From 306b7c7a9757ead077363074e7bbac2e5c03e7c5 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Thu, 16 Nov 2006 15:02:15 +0000 Subject: bitbake: Upgrade from 1.4 -> 1.7.4ish git-svn-id: https://svn.o-hand.com/repos/poky/trunk@863 311d38ba-8fff-0310-9ca6-ca027cbcb966 --- bitbake/lib/bb/parse/parse_py/ConfHandler.py | 33 ++++++++++++++-------------- 1 file changed, 16 insertions(+), 17 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 90978300af..4bc2bbc2b7 100644 --- a/bitbake/lib/bb/parse/parse_py/ConfHandler.py +++ b/bitbake/lib/bb/parse/parse_py/ConfHandler.py @@ -22,7 +22,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA.""" import re, bb.data, os, sys -from bb import debug, fatal from bb.parse import ParseError #__config_regexp__ = re.compile( r"(?Pexport\s*)?(?P[a-zA-Z0-9\-_+.${}]+)\s*(?P:)?(?P\?)?=\s*(?P['\"]?)(?P.*)(?P=apo)$") @@ -53,7 +52,7 @@ def localpath(fn, d): localfn = fn return localfn -def obtain(fn, data = bb.data.init()): +def obtain(fn, data): import sys, bb fn = bb.data.expand(fn, data) localfn = bb.data.expand(localpath(fn, data), data) @@ -61,30 +60,30 @@ def obtain(fn, data = bb.data.init()): if localfn != fn: dldir = bb.data.getVar('DL_DIR', data, 1) if not dldir: - debug(1, "obtain: DL_DIR not defined") + bb.msg.debug(1, bb.msg.domain.Parsing, "obtain: DL_DIR not defined") return localfn bb.mkdirhier(dldir) try: bb.fetch.init([fn]) except bb.fetch.NoMethodError: (type, value, traceback) = sys.exc_info() - debug(1, "obtain: no method: %s" % value) + bb.msg.debug(1, bb.msg.domain.Parsing, "obtain: no method: %s" % value) return localfn try: bb.fetch.go(data) except bb.fetch.MissingParameterError: (type, value, traceback) = sys.exc_info() - debug(1, "obtain: missing parameters: %s" % value) + bb.msg.debug(1, bb.msg.domain.Parsing, "obtain: missing parameters: %s" % value) return localfn except bb.fetch.FetchError: (type, value, traceback) = sys.exc_info() - debug(1, "obtain: failed: %s" % value) + bb.msg.debug(1, bb.msg.domain.Parsing, "obtain: failed: %s" % value) return localfn return localfn -def include(oldfn, fn, data = bb.data.init(), error_out = False): +def include(oldfn, fn, data, error_out): """ error_out If True a ParseError will be reaised if the to be included @@ -101,10 +100,10 @@ def include(oldfn, fn, data = bb.data.init(), error_out = False): ret = handle(fn, data, True) except IOError: if error_out: - raise ParseError("Could not include required file %(fn)s" % vars() ) - debug(2, "CONF file '%s' not found" % fn) + raise ParseError("Could not %(error_out)s file %(fn)s" % vars() ) + bb.msg.debug(2, bb.msg.domain.Parsing, "CONF file '%s' not found" % fn) -def handle(fn, data = bb.data.init(), include = 0): +def handle(fn, data, include = 0): if include: inc_string = "including" else: @@ -129,13 +128,13 @@ def handle(fn, data = bb.data.init(), include = 0): if os.access(currname, os.R_OK): f = open(currname, 'r') abs_fn = currname - debug(1, "CONF %s %s" % (inc_string, currname)) + bb.msg.debug(2, bb.msg.domain.Parsing, "CONF %s %s" % (inc_string, currname)) break if f is None: raise IOError("file '%s' not found" % fn) else: f = open(fn,'r') - debug(1, "CONF %s %s" % (inc_string,fn)) + bb.msg.debug(1, bb.msg.domain.Parsing, "CONF %s %s" % (inc_string,fn)) abs_fn = fn if include: @@ -161,7 +160,7 @@ def handle(fn, data = bb.data.init(), include = 0): bb.data.setVar('FILE', oldfile, data) return data -def feeder(lineno, s, fn, data = bb.data.init()): +def feeder(lineno, s, fn, data): m = __config_regexp__.match(s) if m: groupd = m.groupdict() @@ -185,7 +184,7 @@ def feeder(lineno, s, fn, data = bb.data.init()): else: val = groupd["value"] if 'flag' in groupd and groupd['flag'] != None: -# bb.note("setVarFlag(%s, %s, %s, data)" % (key, groupd['flag'], val)) + bb.msg.debug(3, bb.msg.domain.Parsing, "setVarFlag(%s, %s, %s, data)" % (key, groupd['flag'], val)) bb.data.setVarFlag(key, groupd['flag'], val, data) else: bb.data.setVar(key, val, data) @@ -194,14 +193,14 @@ def feeder(lineno, s, fn, data = bb.data.init()): m = __include_regexp__.match(s) if m: s = bb.data.expand(m.group(1), data) -# debug(2, "CONF %s:%d: including %s" % (fn, lineno, s)) - include(fn, s, data) + bb.msg.debug(3, bb.msg.domain.Parsing, "CONF %s:%d: including %s" % (fn, lineno, s)) + include(fn, s, data, False) return m = __require_regexp__.match(s) if m: s = bb.data.expand(m.group(1), data) - include(fn, s, data, True) + include(fn, s, data, "include required") return raise ParseError("%s:%d: unparsed line: '%s'" % (fn, lineno, s)); -- cgit v1.2.3-54-g00ecf