summaryrefslogtreecommitdiff
path: root/bitbake-dev/lib
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake-dev/lib')
-rw-r--r--bitbake-dev/lib/bb/utils.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/bitbake-dev/lib/bb/utils.py b/bitbake-dev/lib/bb/utils.py
index 90ba9ac2e0..230e06ab95 100644
--- a/bitbake-dev/lib/bb/utils.py
+++ b/bitbake-dev/lib/bb/utils.py
@@ -393,3 +393,15 @@ def prunedir(topdir):
else:
os.rmdir(os.path.join(root, name))
os.rmdir(topdir)
+
+#
+# Could also use return re.compile("(%s)" % "|".join(map(re.escape, suffixes))).sub(lambda mo: "", var)
+# but thats possibly insane and suffixes is probably going to be small
+#
+def prune_suffix(var, suffixes, d):
+ # See if var ends with any of the suffixes listed and
+ # remove it if found
+ for suffix in suffixes:
+ if var.endswith(suffix):
+ return var.replace(suffix, "")
+ return var