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/__init__.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/__init__.py')
-rw-r--r-- | bitbake/lib/bb/parse/__init__.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/bitbake/lib/bb/parse/__init__.py b/bitbake/lib/bb/parse/__init__.py index 5dd96c4136..c6a925c7a8 100644 --- a/bitbake/lib/bb/parse/__init__.py +++ b/bitbake/lib/bb/parse/__init__.py | |||
@@ -80,5 +80,24 @@ def init(fn, data): | |||
80 | if h['supports'](fn): | 80 | if h['supports'](fn): |
81 | return h['init'](data) | 81 | return h['init'](data) |
82 | 82 | ||
83 | def resolve_file(fn, d): | ||
84 | if not os.path.isabs(fn): | ||
85 | f = None | ||
86 | bbpath = (bb.data.getVar('BBPATH', d, 1) or '').split(':') | ||
87 | for p in bbpath: | ||
88 | j = os.path.join(p, fn) | ||
89 | if os.access(j, os.R_OK): | ||
90 | abs_fn = j | ||
91 | f = open(j, 'r') | ||
92 | break | ||
93 | if f is None: | ||
94 | raise IOError("file %s not found" % fn) | ||
95 | else: | ||
96 | f = open(fn,'r') | ||
97 | abs_fn = fn | ||
98 | |||
99 | bb.msg.debug(2, bb.msg.domain.Parsing, "LOAD %s" % abs_fn) | ||
100 | return (f, abs_fn) | ||
101 | |||
83 | 102 | ||
84 | from parse_py import __version__, ConfHandler, BBHandler | 103 | from parse_py import __version__, ConfHandler, BBHandler |