diff options
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | lib/bb/utils.py | 12 |
2 files changed, 13 insertions, 0 deletions
@@ -169,6 +169,7 @@ Changes in Bitbake 1.9.x: proxies to work better. (from Poky) - Also allow user and pswd options in SRC_URIs globally (from Poky) - Improve proxy handling when using mirrors (from Poky) + - Add bb.utils.prune_suffix function Changes in Bitbake 1.8.0: - Release 1.7.x as a stable series diff --git a/lib/bb/utils.py b/lib/bb/utils.py index 90ba9ac2e..230e06ab9 100644 --- a/lib/bb/utils.py +++ b/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 |