diff options
Diffstat (limited to 'bitbake/lib/bb/parse/parse_py/ConfHandler.py')
-rw-r--r-- | bitbake/lib/bb/parse/parse_py/ConfHandler.py | 19 |
1 files changed, 16 insertions, 3 deletions
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 | |||
28 | #__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)$") | 28 | #__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)$") |
29 | __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)$") | 29 | __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)$") |
30 | __include_regexp__ = re.compile( r"include\s+(.+)" ) | 30 | __include_regexp__ = re.compile( r"include\s+(.+)" ) |
31 | __require_regexp__ = re.compile( r"require\s+(.+)" ) | ||
31 | 32 | ||
32 | def init(data): | 33 | def init(data): |
33 | if not bb.data.getVar('TOPDIR', data): | 34 | if not bb.data.getVar('TOPDIR', data): |
@@ -83,7 +84,11 @@ def obtain(fn, data = bb.data.init()): | |||
83 | return localfn | 84 | return localfn |
84 | 85 | ||
85 | 86 | ||
86 | def include(oldfn, fn, data = bb.data.init()): | 87 | def include(oldfn, fn, data = bb.data.init(), error_out = False): |
88 | """ | ||
89 | |||
90 | error_out If True a ParseError will be reaised if the to be included | ||
91 | """ | ||
87 | if oldfn == fn: # prevent infinate recursion | 92 | if oldfn == fn: # prevent infinate recursion |
88 | return None | 93 | return None |
89 | 94 | ||
@@ -93,8 +98,10 @@ def include(oldfn, fn, data = bb.data.init()): | |||
93 | 98 | ||
94 | from bb.parse import handle | 99 | from bb.parse import handle |
95 | try: | 100 | try: |
96 | ret = handle(fn, data, 1) | 101 | ret = handle(fn, data, True) |
97 | except IOError: | 102 | except IOError: |
103 | if error_out: | ||
104 | raise ParseError("Could not include required file %(fn)s" % vars() ) | ||
98 | debug(2, "CONF file '%s' not found" % fn) | 105 | debug(2, "CONF file '%s' not found" % fn) |
99 | 106 | ||
100 | def handle(fn, data = bb.data.init(), include = 0): | 107 | def handle(fn, data = bb.data.init(), include = 0): |
@@ -125,7 +132,7 @@ def handle(fn, data = bb.data.init(), include = 0): | |||
125 | debug(1, "CONF %s %s" % (inc_string, currname)) | 132 | debug(1, "CONF %s %s" % (inc_string, currname)) |
126 | break | 133 | break |
127 | if f is None: | 134 | if f is None: |
128 | raise IOError("file not found") | 135 | raise IOError("file '%s' not found" % fn) |
129 | else: | 136 | else: |
130 | f = open(fn,'r') | 137 | f = open(fn,'r') |
131 | debug(1, "CONF %s %s" % (inc_string,fn)) | 138 | debug(1, "CONF %s %s" % (inc_string,fn)) |
@@ -191,6 +198,12 @@ def feeder(lineno, s, fn, data = bb.data.init()): | |||
191 | include(fn, s, data) | 198 | include(fn, s, data) |
192 | return | 199 | return |
193 | 200 | ||
201 | m = __require_regexp__.match(s) | ||
202 | if m: | ||
203 | s = bb.data.expand(m.group(1), data) | ||
204 | include(fn, s, data, True) | ||
205 | return | ||
206 | |||
194 | raise ParseError("%s:%d: unparsed line: '%s'" % (fn, lineno, s)); | 207 | raise ParseError("%s:%d: unparsed line: '%s'" % (fn, lineno, s)); |
195 | 208 | ||
196 | # Add us to the handlers list | 209 | # Add us to the handlers list |