diff options
| author | Richard Purdie <rpurdie@linux.intel.com> | 2008-12-31 22:58:57 +0000 | 
|---|---|---|
| committer | Richard Purdie <rpurdie@linux.intel.com> | 2008-12-31 22:58:57 +0000 | 
| commit | 7695704eab36ac44e7f02cf4c59a5c4cb86ebead (patch) | |
| tree | 70afc86cf1b52114cc1c81b830cfe6ad00f5cfae | |
| parent | 2c70bf49c1c9822d813cc29805079ee1197af874 (diff) | |
| download | openembedded-core-7695704eab36ac44e7f02cf4c59a5c4cb86ebead.tar.gz openembedded-core-7695704eab36ac44e7f02cf4c59a5c4cb86ebead.tar.bz2 openembedded-core-7695704eab36ac44e7f02cf4c59a5c4cb86ebead.zip | |
bitbake: Add bb.utils.prune_suffix()
| -rw-r--r-- | bitbake-dev/lib/bb/utils.py | 12 | ||||
| -rw-r--r-- | bitbake/lib/bb/utils.py | 11 | 
2 files changed, 23 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 diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py index 5015779f8d..2469bd7ee2 100644 --- a/bitbake/lib/bb/utils.py +++ b/bitbake/lib/bb/utils.py @@ -394,3 +394,14 @@ def prunedir(topdir):                  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 | 
