utils.py: Add a new extend_deps() to easily merge two dependency lists

Add a new extend_deps function to more easily merge two dependency lists.
This avoids adding duplicates, unless the value of the dependency is
different.

Signed-off-by: Mark Hatle <mhatle@windriver.com>
This commit is contained in:
Mark Hatle 2010-08-20 09:27:22 -07:00 committed by Richard Purdie
parent 54e3a82d9c
commit 87dba4254b
1 changed files with 11 additions and 0 deletions

View File

@ -287,6 +287,17 @@ def join_deps(deps):
result.append(dep)
return ", ".join(result)
def extend_deps(dest, src):
"""
Extend the results from explode_dep_versions by appending all of the items
in the second list, avoiding duplicates.
"""
for dep in src:
if dep not in dest:
dest[dep] = src[dep]
elif dest[dep] != src[dep]:
dest[dep] = src[dep]
def _print_trace(body, line):
"""
Print the Environment of a Text Body