aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorChris Larson <chris_larson@mentor.com>2010-10-16 22:32:06 -0700
committerChris Larson <chris_larson@mentor.com>2010-10-16 22:32:07 -0700
commit16011461a11c3408a81983b5f719e5e9da9c7ff6 (patch)
tree5e5fb9951e9ff64833157a36009eca83c1816184 /lib
parentf6fa9298359781393ed2466c45cf42da56068bb1 (diff)
downloadopenembedded-16011461a11c3408a81983b5f719e5e9da9c7ff6.tar.gz
utils, oe.utils: add 'uniq' function
Ignore duplicates in an iterable. Signed-off-by: Chris Larson <chris_larson@mentor.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/oe/utils.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/oe/utils.py b/lib/oe/utils.py
index 3469700726..2169ed212e 100644
--- a/lib/oe/utils.py
+++ b/lib/oe/utils.py
@@ -1,3 +1,10 @@
+def uniq(iterable):
+ seen = set()
+ for i in iterable:
+ if i not in seen:
+ yield i
+ seen.add(i)
+
def read_file(filename):
try:
f = file( filename, "r" )