diff options
author | Holger Freyther <ich@tamarin.(none)> | 2009-05-19 12:10:37 +0200 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2010-02-15 17:07:51 +0000 |
commit | 793c88dd92747890e910c598e19f1778865883d2 (patch) | |
tree | d34ec6e00aa689a985a0bb5f45050530c7234fd1 /bitbake/lib/bb/parse/parse_py/ConfHandler.py | |
parent | 3eb2e6cf02155c3fce0a49bd967545cacfc08fb3 (diff) | |
download | poky-793c88dd92747890e910c598e19f1778865883d2.tar.gz |
bitbake: [parser] Remove the "data" from feeder, evaluate after parsing a file
Evaluate the statements after having parsed one file. This is
referred to as "entwirren" and we can remove the direct evaluation
and postpone a bit, in the future we can use a cached copy instead
of parsing the original.
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'bitbake/lib/bb/parse/parse_py/ConfHandler.py')
-rw-r--r-- | bitbake/lib/bb/parse/parse_py/ConfHandler.py | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/bitbake/lib/bb/parse/parse_py/ConfHandler.py b/bitbake/lib/bb/parse/parse_py/ConfHandler.py index 69f2eea1b3..839a662024 100644 --- a/bitbake/lib/bb/parse/parse_py/ConfHandler.py +++ b/bitbake/lib/bb/parse/parse_py/ConfHandler.py | |||
@@ -49,7 +49,7 @@ def init(data): | |||
49 | def supports(fn, d): | 49 | def supports(fn, d): |
50 | return fn[-5:] == ".conf" | 50 | return fn[-5:] == ".conf" |
51 | 51 | ||
52 | def include(statements, oldfn, fn, data, error_out): | 52 | def include(oldfn, fn, data, error_out): |
53 | """ | 53 | """ |
54 | 54 | ||
55 | error_out If True a ParseError will be reaised if the to be included | 55 | error_out If True a ParseError will be reaised if the to be included |
@@ -70,13 +70,13 @@ def include(statements, oldfn, fn, data, error_out): | |||
70 | 70 | ||
71 | from bb.parse import handle | 71 | from bb.parse import handle |
72 | try: | 72 | try: |
73 | ret = handle(fn, data, True, statements) | 73 | ret = handle(fn, data, True) |
74 | except IOError: | 74 | except IOError: |
75 | if error_out: | 75 | if error_out: |
76 | raise ParseError("Could not %(error_out)s file %(fn)s" % vars() ) | 76 | raise ParseError("Could not %(error_out)s file %(fn)s" % vars() ) |
77 | bb.msg.debug(2, bb.msg.domain.Parsing, "CONF file '%s' not found" % fn) | 77 | bb.msg.debug(2, bb.msg.domain.Parsing, "CONF file '%s' not found" % fn) |
78 | 78 | ||
79 | def handle(fn, data, include, statements): | 79 | def handle(fn, data, include): |
80 | init(data) | 80 | init(data) |
81 | 81 | ||
82 | if include == 0: | 82 | if include == 0: |
@@ -89,8 +89,8 @@ def handle(fn, data, include, statements): | |||
89 | if include: | 89 | if include: |
90 | bb.parse.mark_dependency(data, abs_fn) | 90 | bb.parse.mark_dependency(data, abs_fn) |
91 | 91 | ||
92 | statements = ast.StatementGroup() | ||
92 | lineno = 0 | 93 | lineno = 0 |
93 | bb.data.setVar('FILE', fn, data) | ||
94 | while 1: | 94 | while 1: |
95 | lineno = lineno + 1 | 95 | lineno = lineno + 1 |
96 | s = f.readline() | 96 | s = f.readline() |
@@ -103,32 +103,36 @@ def handle(fn, data, include, statements): | |||
103 | s2 = f.readline()[:-1].strip() | 103 | s2 = f.readline()[:-1].strip() |
104 | lineno = lineno + 1 | 104 | lineno = lineno + 1 |
105 | s = s[:-1] + s2 | 105 | s = s[:-1] + s2 |
106 | feeder(lineno, s, fn, data, statements) | 106 | feeder(lineno, s, fn, statements) |
107 | 107 | ||
108 | # DONE WITH PARSING... time to evaluate | ||
109 | bb.data.setVar('FILE', fn, data) | ||
110 | statements.eval(data) | ||
108 | if oldfile: | 111 | if oldfile: |
109 | bb.data.setVar('FILE', oldfile, data) | 112 | bb.data.setVar('FILE', oldfile, data) |
113 | |||
110 | return data | 114 | return data |
111 | 115 | ||
112 | def feeder(lineno, s, fn, data, statements): | 116 | def feeder(lineno, s, fn, statements): |
113 | m = __config_regexp__.match(s) | 117 | m = __config_regexp__.match(s) |
114 | if m: | 118 | if m: |
115 | groupd = m.groupdict() | 119 | groupd = m.groupdict() |
116 | ast.handleData(statements, groupd, data) | 120 | ast.handleData(statements, groupd) |
117 | return | 121 | return |
118 | 122 | ||
119 | m = __include_regexp__.match(s) | 123 | m = __include_regexp__.match(s) |
120 | if m: | 124 | if m: |
121 | ast.handleInclude(statements, m, fn, lineno, data, False) | 125 | ast.handleInclude(statements, m, fn, lineno, False) |
122 | return | 126 | return |
123 | 127 | ||
124 | m = __require_regexp__.match(s) | 128 | m = __require_regexp__.match(s) |
125 | if m: | 129 | if m: |
126 | ast.handleInclude(statements, m, fn, lineno, data, True) | 130 | ast.handleInclude(statements, m, fn, lineno, True) |
127 | return | 131 | return |
128 | 132 | ||
129 | m = __export_regexp__.match(s) | 133 | m = __export_regexp__.match(s) |
130 | if m: | 134 | if m: |
131 | ast.handleExport(statements, m, data) | 135 | ast.handleExport(statements, m) |
132 | return | 136 | return |
133 | 137 | ||
134 | raise ParseError("%s:%d: unparsed line: '%s'" % (fn, lineno, s)); | 138 | raise ParseError("%s:%d: unparsed line: '%s'" % (fn, lineno, s)); |