diff options
author | Holger Freyther <ich@tamarin.(none)> | 2009-05-17 06:19:39 +0200 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2010-02-10 16:31:33 +0000 |
commit | 913e78898e65e1d95c6313e86854cdc2ab9e35aa (patch) | |
tree | 4ca35dd670b79167b8bdaec9cab1b80e11d1719c /bitbake/lib/bb/parse/parse_py/BBHandler.py | |
parent | 242a03607d752c228e909a65bf4dfbe8661d5355 (diff) | |
download | poky-913e78898e65e1d95c6313e86854cdc2ab9e35aa.tar.gz |
bitbake: [parse] Unify opening a file...
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'bitbake/lib/bb/parse/parse_py/BBHandler.py')
-rw-r--r-- | bitbake/lib/bb/parse/parse_py/BBHandler.py | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/bitbake/lib/bb/parse/parse_py/BBHandler.py b/bitbake/lib/bb/parse/parse_py/BBHandler.py index 7707705aaf..c6931650da 100644 --- a/bitbake/lib/bb/parse/parse_py/BBHandler.py +++ b/bitbake/lib/bb/parse/parse_py/BBHandler.py | |||
@@ -30,7 +30,7 @@ import bb.fetch, bb.build, bb.utils | |||
30 | from bb import data, fetch, methodpool | 30 | from bb import data, fetch, methodpool |
31 | 31 | ||
32 | from ConfHandler import include, init | 32 | from ConfHandler import include, init |
33 | from bb.parse import ParseError | 33 | from bb.parse import ParseError, resolve_file |
34 | 34 | ||
35 | __func_start_regexp__ = re.compile( r"(((?P<py>python)|(?P<fr>fakeroot))\s*)*(?P<func>[\w\.\-\+\{\}\$]+)?\s*\(\s*\)\s*{$" ) | 35 | __func_start_regexp__ = re.compile( r"(((?P<py>python)|(?P<fr>fakeroot))\s*)*(?P<func>[\w\.\-\+\{\}\$]+)?\s*\(\s*\)\s*{$" ) |
36 | __inherit_regexp__ = re.compile( r"inherit\s+(.+)" ) | 36 | __inherit_regexp__ = re.compile( r"inherit\s+(.+)" ) |
@@ -145,20 +145,7 @@ def handle(fn, d, include = 0): | |||
145 | else: | 145 | else: |
146 | oldfile = None | 146 | oldfile = None |
147 | 147 | ||
148 | bbpath = (data.getVar('BBPATH', d, 1) or '').split(':') | 148 | (f, abs_fn) = resolve_file(fn, d) |
149 | if not os.path.isabs(fn): | ||
150 | f = None | ||
151 | for p in bbpath: | ||
152 | j = os.path.join(p, fn) | ||
153 | if os.access(j, os.R_OK): | ||
154 | abs_fn = j | ||
155 | f = open(j, 'r') | ||
156 | break | ||
157 | if f is None: | ||
158 | raise IOError("file %s not found" % fn) | ||
159 | else: | ||
160 | f = open(fn,'r') | ||
161 | abs_fn = fn | ||
162 | 149 | ||
163 | if include: | 150 | if include: |
164 | bb.parse.mark_dependency(d, abs_fn) | 151 | bb.parse.mark_dependency(d, abs_fn) |
@@ -203,7 +190,6 @@ def handle(fn, d, include = 0): | |||
203 | darray[cls] = based | 190 | darray[cls] = based |
204 | return darray | 191 | return darray |
205 | 192 | ||
206 | bbpath.pop(0) | ||
207 | if oldfile: | 193 | if oldfile: |
208 | bb.data.setVar("FILE", oldfile, d) | 194 | bb.data.setVar("FILE", oldfile, d) |
209 | 195 | ||