bitbake utils.py: Add explode_dep_versions, an improved version of explode_deps
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@5128 311d38ba-8fff-0310-9ca6-ca027cbcb966
This commit is contained in:
parent
62094355a5
commit
5d24ea892f
|
@ -96,7 +96,34 @@ def explode_deps(s):
|
|||
#r[-1] += ' ' + ' '.join(j)
|
||||
return r
|
||||
|
||||
def explode_dep_versions(s):
|
||||
"""
|
||||
Take an RDEPENDS style string of format:
|
||||
"DEPEND1 (optional version) DEPEND2 (optional version) ..."
|
||||
and return a dictonary of dependencies and versions.
|
||||
"""
|
||||
r = {}
|
||||
l = s.split()
|
||||
lastdep = None
|
||||
lastver = ""
|
||||
inversion = False
|
||||
for i in l:
|
||||
if i[0] == '(':
|
||||
inversion = True
|
||||
lastver = i[1:] or ""
|
||||
#j = []
|
||||
elif inversion and i.endswith(')'):
|
||||
inversion = False
|
||||
lastver = lastver + " " + (i[:-1] or "")
|
||||
r[lastdep] = lastver
|
||||
elif not inversion:
|
||||
r[i] = None
|
||||
lastdep = i
|
||||
lastver = ""
|
||||
elif inversion:
|
||||
lastver = lastver + " " + i
|
||||
|
||||
return r
|
||||
|
||||
def _print_trace(body, line):
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue