diff options
Diffstat (limited to 'bitbake/lib/bb/parse/parse_py/ConfHandler.py')
-rw-r--r-- | bitbake/lib/bb/parse/parse_py/ConfHandler.py | 33 |
1 files changed, 16 insertions, 17 deletions
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 @@ | |||
22 | Place, Suite 330, Boston, MA 02111-1307 USA.""" | 22 | Place, Suite 330, Boston, MA 02111-1307 USA.""" |
23 | 23 | ||
24 | import re, bb.data, os, sys | 24 | import re, bb.data, os, sys |
25 | from bb import debug, fatal | ||
26 | from bb.parse import ParseError | 25 | from bb.parse import ParseError |
27 | 26 | ||
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)$") | 27 | #__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)$") |
@@ -53,7 +52,7 @@ def localpath(fn, d): | |||
53 | localfn = fn | 52 | localfn = fn |
54 | return localfn | 53 | return localfn |
55 | 54 | ||
56 | def obtain(fn, data = bb.data.init()): | 55 | def obtain(fn, data): |
57 | import sys, bb | 56 | import sys, bb |
58 | fn = bb.data.expand(fn, data) | 57 | fn = bb.data.expand(fn, data) |
59 | localfn = bb.data.expand(localpath(fn, data), data) | 58 | localfn = bb.data.expand(localpath(fn, data), data) |
@@ -61,30 +60,30 @@ def obtain(fn, data = bb.data.init()): | |||
61 | if localfn != fn: | 60 | if localfn != fn: |
62 | dldir = bb.data.getVar('DL_DIR', data, 1) | 61 | dldir = bb.data.getVar('DL_DIR', data, 1) |
63 | if not dldir: | 62 | if not dldir: |
64 | debug(1, "obtain: DL_DIR not defined") | 63 | bb.msg.debug(1, bb.msg.domain.Parsing, "obtain: DL_DIR not defined") |
65 | return localfn | 64 | return localfn |
66 | bb.mkdirhier(dldir) | 65 | bb.mkdirhier(dldir) |
67 | try: | 66 | try: |
68 | bb.fetch.init([fn]) | 67 | bb.fetch.init([fn]) |
69 | except bb.fetch.NoMethodError: | 68 | except bb.fetch.NoMethodError: |
70 | (type, value, traceback) = sys.exc_info() | 69 | (type, value, traceback) = sys.exc_info() |
71 | debug(1, "obtain: no method: %s" % value) | 70 | bb.msg.debug(1, bb.msg.domain.Parsing, "obtain: no method: %s" % value) |
72 | return localfn | 71 | return localfn |
73 | 72 | ||
74 | try: | 73 | try: |
75 | bb.fetch.go(data) | 74 | bb.fetch.go(data) |
76 | except bb.fetch.MissingParameterError: | 75 | except bb.fetch.MissingParameterError: |
77 | (type, value, traceback) = sys.exc_info() | 76 | (type, value, traceback) = sys.exc_info() |
78 | debug(1, "obtain: missing parameters: %s" % value) | 77 | bb.msg.debug(1, bb.msg.domain.Parsing, "obtain: missing parameters: %s" % value) |
79 | return localfn | 78 | return localfn |
80 | except bb.fetch.FetchError: | 79 | except bb.fetch.FetchError: |
81 | (type, value, traceback) = sys.exc_info() | 80 | (type, value, traceback) = sys.exc_info() |
82 | debug(1, "obtain: failed: %s" % value) | 81 | bb.msg.debug(1, bb.msg.domain.Parsing, "obtain: failed: %s" % value) |
83 | return localfn | 82 | return localfn |
84 | return localfn | 83 | return localfn |
85 | 84 | ||
86 | 85 | ||
87 | def include(oldfn, fn, data = bb.data.init(), error_out = False): | 86 | def include(oldfn, fn, data, error_out): |
88 | """ | 87 | """ |
89 | 88 | ||
90 | error_out If True a ParseError will be reaised if the to be included | 89 | 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): | |||
101 | ret = handle(fn, data, True) | 100 | ret = handle(fn, data, True) |
102 | except IOError: | 101 | except IOError: |
103 | if error_out: | 102 | if error_out: |
104 | raise ParseError("Could not include required file %(fn)s" % vars() ) | 103 | raise ParseError("Could not %(error_out)s file %(fn)s" % vars() ) |
105 | debug(2, "CONF file '%s' not found" % fn) | 104 | bb.msg.debug(2, bb.msg.domain.Parsing, "CONF file '%s' not found" % fn) |
106 | 105 | ||
107 | def handle(fn, data = bb.data.init(), include = 0): | 106 | def handle(fn, data, include = 0): |
108 | if include: | 107 | if include: |
109 | inc_string = "including" | 108 | inc_string = "including" |
110 | else: | 109 | else: |
@@ -129,13 +128,13 @@ def handle(fn, data = bb.data.init(), include = 0): | |||
129 | if os.access(currname, os.R_OK): | 128 | if os.access(currname, os.R_OK): |
130 | f = open(currname, 'r') | 129 | f = open(currname, 'r') |
131 | abs_fn = currname | 130 | abs_fn = currname |
132 | debug(1, "CONF %s %s" % (inc_string, currname)) | 131 | bb.msg.debug(2, bb.msg.domain.Parsing, "CONF %s %s" % (inc_string, currname)) |
133 | break | 132 | break |
134 | if f is None: | 133 | if f is None: |
135 | raise IOError("file '%s' not found" % fn) | 134 | raise IOError("file '%s' not found" % fn) |
136 | else: | 135 | else: |
137 | f = open(fn,'r') | 136 | f = open(fn,'r') |
138 | debug(1, "CONF %s %s" % (inc_string,fn)) | 137 | bb.msg.debug(1, bb.msg.domain.Parsing, "CONF %s %s" % (inc_string,fn)) |
139 | abs_fn = fn | 138 | abs_fn = fn |
140 | 139 | ||
141 | if include: | 140 | if include: |
@@ -161,7 +160,7 @@ def handle(fn, data = bb.data.init(), include = 0): | |||
161 | bb.data.setVar('FILE', oldfile, data) | 160 | bb.data.setVar('FILE', oldfile, data) |
162 | return data | 161 | return data |
163 | 162 | ||
164 | def feeder(lineno, s, fn, data = bb.data.init()): | 163 | def feeder(lineno, s, fn, data): |
165 | m = __config_regexp__.match(s) | 164 | m = __config_regexp__.match(s) |
166 | if m: | 165 | if m: |
167 | groupd = m.groupdict() | 166 | groupd = m.groupdict() |
@@ -185,7 +184,7 @@ def feeder(lineno, s, fn, data = bb.data.init()): | |||
185 | else: | 184 | else: |
186 | val = groupd["value"] | 185 | val = groupd["value"] |
187 | if 'flag' in groupd and groupd['flag'] != None: | 186 | if 'flag' in groupd and groupd['flag'] != None: |
188 | # bb.note("setVarFlag(%s, %s, %s, data)" % (key, groupd['flag'], val)) | 187 | bb.msg.debug(3, bb.msg.domain.Parsing, "setVarFlag(%s, %s, %s, data)" % (key, groupd['flag'], val)) |
189 | bb.data.setVarFlag(key, groupd['flag'], val, data) | 188 | bb.data.setVarFlag(key, groupd['flag'], val, data) |
190 | else: | 189 | else: |
191 | bb.data.setVar(key, val, data) | 190 | bb.data.setVar(key, val, data) |
@@ -194,14 +193,14 @@ def feeder(lineno, s, fn, data = bb.data.init()): | |||
194 | m = __include_regexp__.match(s) | 193 | m = __include_regexp__.match(s) |
195 | if m: | 194 | if m: |
196 | s = bb.data.expand(m.group(1), data) | 195 | s = bb.data.expand(m.group(1), data) |
197 | # debug(2, "CONF %s:%d: including %s" % (fn, lineno, s)) | 196 | bb.msg.debug(3, bb.msg.domain.Parsing, "CONF %s:%d: including %s" % (fn, lineno, s)) |
198 | include(fn, s, data) | 197 | include(fn, s, data, False) |
199 | return | 198 | return |
200 | 199 | ||
201 | m = __require_regexp__.match(s) | 200 | m = __require_regexp__.match(s) |
202 | if m: | 201 | if m: |
203 | s = bb.data.expand(m.group(1), data) | 202 | s = bb.data.expand(m.group(1), data) |
204 | include(fn, s, data, True) | 203 | include(fn, s, data, "include required") |
205 | return | 204 | return |
206 | 205 | ||
207 | raise ParseError("%s:%d: unparsed line: '%s'" % (fn, lineno, s)); | 206 | raise ParseError("%s:%d: unparsed line: '%s'" % (fn, lineno, s)); |