diff options
author | Richard Purdie <richard@openedhand.com> | 2006-02-10 10:11:32 +0000 |
---|---|---|
committer | Richard Purdie <richard@openedhand.com> | 2006-02-10 10:11:32 +0000 |
commit | 62dc8f47b3c17cf0b1a5d4bf4f0173d5d4fb4c1a (patch) | |
tree | 947a632b694a9a6d561f0df0a768a622e1364570 /bitbake/lib/bb/parse | |
parent | 9a262964c8b5c5a21a68d9b66ab9259b3737999f (diff) | |
download | openembedded-core-62dc8f47b3c17cf0b1a5d4bf4f0173d5d4fb4c1a.tar.gz openembedded-core-62dc8f47b3c17cf0b1a5d4bf4f0173d5d4fb4c1a.tar.bz2 openembedded-core-62dc8f47b3c17cf0b1a5d4bf4f0173d5d4fb4c1a.zip |
Update bitbake to latest bitbake svn
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@262 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'bitbake/lib/bb/parse')
-rw-r--r-- | bitbake/lib/bb/parse/__init__.py | 9 | ||||
-rw-r--r-- | bitbake/lib/bb/parse/parse_py/ConfHandler.py | 19 |
2 files changed, 22 insertions, 6 deletions
diff --git a/bitbake/lib/bb/parse/__init__.py b/bitbake/lib/bb/parse/__init__.py index b8839c09fd..cb27416061 100644 --- a/bitbake/lib/bb/parse/__init__.py +++ b/bitbake/lib/bb/parse/__init__.py @@ -26,6 +26,8 @@ __all__ = [ 'ParseError', 'SkipPackage', 'cached_mtime', 'mark_dependency', 'supports', 'handle', 'init' ] handlers = [] +import bb, os + class ParseError(Exception): """Exception raised when parsing fails""" @@ -34,13 +36,14 @@ class SkipPackage(Exception): __mtime_cache = {} def cached_mtime(f): - import os if not __mtime_cache.has_key(f): - __mtime_cache[f] = os.stat(f)[8] + update_mtime(f) return __mtime_cache[f] +def update_mtime(f): + __mtime_cache[f] = os.stat(f)[8] + def mark_dependency(d, f): - import bb, os if f.startswith('./'): f = "%s/%s" % (os.getcwd(), f[2:]) deps = (bb.data.getVar('__depends', d) or "").split() diff --git a/bitbake/lib/bb/parse/parse_py/ConfHandler.py b/bitbake/lib/bb/parse/parse_py/ConfHandler.py index 41ef96d557..90978300af 100644 --- a/bitbake/lib/bb/parse/parse_py/ConfHandler.py +++ b/bitbake/lib/bb/parse/parse_py/ConfHandler.py @@ -28,6 +28,7 @@ from bb.parse import ParseError #__config_regexp__ = re.compile( r"(?P<exp>export\s*)?(?P<var>[a-zA-Z0-9\-_+.${}]+)\s*(?P<colon>:)?(?P<ques>\?)?=\s*(?P<apo>['\"]?)(?P<value>.*)(?P=apo)$") __config_regexp__ = re.compile( r"(?P<exp>export\s*)?(?P<var>[a-zA-Z0-9\-_+.${}/]+)(\[(?P<flag>[a-zA-Z0-9\-_+.]+)\])?\s*((?P<colon>:=)|(?P<ques>\?=)|(?P<append>\+=)|(?P<prepend>=\+)|(?P<predot>=\.)|(?P<postdot>\.=)|=)\s*(?P<apo>['\"]?)(?P<value>.*)(?P=apo)$") __include_regexp__ = re.compile( r"include\s+(.+)" ) +__require_regexp__ = re.compile( r"require\s+(.+)" ) def init(data): if not bb.data.getVar('TOPDIR', data): @@ -83,7 +84,11 @@ def obtain(fn, data = bb.data.init()): return localfn -def include(oldfn, fn, data = bb.data.init()): +def include(oldfn, fn, data = bb.data.init(), error_out = False): + """ + + error_out If True a ParseError will be reaised if the to be included + """ if oldfn == fn: # prevent infinate recursion return None @@ -93,8 +98,10 @@ def include(oldfn, fn, data = bb.data.init()): from bb.parse import handle try: - ret = handle(fn, data, 1) + 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) def handle(fn, data = bb.data.init(), include = 0): @@ -125,7 +132,7 @@ def handle(fn, data = bb.data.init(), include = 0): debug(1, "CONF %s %s" % (inc_string, currname)) break if f is None: - raise IOError("file not found") + raise IOError("file '%s' not found" % fn) else: f = open(fn,'r') debug(1, "CONF %s %s" % (inc_string,fn)) @@ -191,6 +198,12 @@ def feeder(lineno, s, fn, data = bb.data.init()): include(fn, s, data) return + m = __require_regexp__.match(s) + if m: + s = bb.data.expand(m.group(1), data) + include(fn, s, data, True) + return + raise ParseError("%s:%d: unparsed line: '%s'" % (fn, lineno, s)); # Add us to the handlers list |