summaryrefslogtreecommitdiffstats
path: root/bitbake-dev
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@linux.intel.com>2008-12-31 22:58:57 +0000
committerRichard Purdie <rpurdie@linux.intel.com>2008-12-31 22:58:57 +0000
commit7695704eab36ac44e7f02cf4c59a5c4cb86ebead (patch)
tree70afc86cf1b52114cc1c81b830cfe6ad00f5cfae /bitbake-dev
parent2c70bf49c1c9822d813cc29805079ee1197af874 (diff)
downloadpoky-7695704eab36ac44e7f02cf4c59a5c4cb86ebead.tar.gz
bitbake: Add bb.utils.prune_suffix()
Diffstat (limited to 'bitbake-dev')
-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):
393 else: 393 else:
394 os.rmdir(os.path.join(root, name)) 394 os.rmdir(os.path.join(root, name))
395 os.rmdir(topdir) 395 os.rmdir(topdir)
396
397#
398# Could also use return re.compile("(%s)" % "|".join(map(re.escape, suffixes))).sub(lambda mo: "", var)
399# but thats possibly insane and suffixes is probably going to be small
400#
401def prune_suffix(var, suffixes, d):
402 # See if var ends with any of the suffixes listed and
403 # remove it if found
404 for suffix in suffixes:
405 if var.endswith(suffix):
406 return var.replace(suffix, "")
407 return var