summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/parse/__init__.py
diff options
context:
space:
mode:
authorHolger Freyther <ich@tamarin.(none)>2009-05-19 13:59:50 +0200
committerRichard Purdie <rpurdie@linux.intel.com>2010-02-15 17:07:55 +0000
commit7b57ad901af2ded02995d22718ec6f280a9edd7f (patch)
tree81b9b3909460269bdd60744a255ac923775fa71c /bitbake/lib/bb/parse/__init__.py
parent83ec5eaed411225d16a4fc4dc92323e3acc9f5cd (diff)
downloadpoky-7b57ad901af2ded02995d22718ec6f280a9edd7f.tar.gz
bitbake: [parser] Make resolve_file only resolve the path
Do not attempt to open the file in the resolve_file method (a lot like bb.which... maybe bb.which can be used). This way we don't need to open/close a file which we have already parsed. 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__.py18
1 files changed, 6 insertions, 12 deletions
diff --git a/bitbake/lib/bb/parse/__init__.py b/bitbake/lib/bb/parse/__init__.py
index 6737e061ea..5e74afd9ac 100644
--- a/bitbake/lib/bb/parse/__init__.py
+++ b/bitbake/lib/bb/parse/__init__.py
@@ -82,22 +82,16 @@ def init(fn, data):
82 82
83def resolve_file(fn, d): 83def resolve_file(fn, d):
84 if not os.path.isabs(fn): 84 if not os.path.isabs(fn):
85 f = None
86 bbpath = (bb.data.getVar('BBPATH', d, 1) or '').split(':') 85 bbpath = (bb.data.getVar('BBPATH', d, 1) or '').split(':')
87 for p in bbpath: 86 for p in bbpath:
88 j = os.path.join(p, fn) 87 j = os.path.join(p, fn)
89 if os.access(j, os.R_OK): 88 if os.access(j, os.R_OK):
90 abs_fn = j 89 bb.msg.debug(2, bb.msg.domain.Parsing, "LOAD %s" % j)
91 f = open(j, 'r') 90 return j
92 break 91 raise IOError("file %s not found" % fn)
93 if f is None: 92
94 raise IOError("file %s not found" % fn) 93 bb.msg.debug(2, bb.msg.domain.Parsing, "LOAD %s" % fn)
95 else: 94 return fn
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 95
102# Used by OpenEmbedded metadata 96# Used by OpenEmbedded metadata
103__pkgsplit_cache__={} 97__pkgsplit_cache__={}