Make prune_suffix prune a suffix
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/1 Make prune_suffix prune a suffix
From: Andre Rosa <[email protected]>
... instead of replacing a substring that could happen more than once and not only when it ends with it.
Signed-off-by Andre Rosa <[email protected]>
lib/bb/utils.py +2 -2
@@ -722,8 +722,8 @@ 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, "") + if suffix and var.endswith(suffix): + return var[:-len(suffix)] return var def mkdirhier(directory):
--
2.20.1
PATCH 1/1 Make prune_suffix prune a suffix
In reply to a message not in the archiveFrom: Andre Rosa <[email protected]>
... instead of replacing a substring that could happen more than once and not only when it ends with it.
Signed-off-by Andre Rosa <[email protected]>
lib/bb/utils.py +2 -2
@@ -722,8 +722,8 @@ 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, "") + if suffix and var.endswith(suffix): + return var[:-len(suffix)] return var def mkdirhier(directory):
--
2.20.1