diff options
author | Zac Medico <zmedico@gentoo.org> | 2007-05-20 19:59:53 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2007-05-20 19:59:53 +0000 |
commit | 544d9a24d05465a00b05d52c428041abb4e0739c (patch) | |
tree | 4e7f9bdd0c8bae0e12e74e60fc0a64a3ecbe4b86 | |
parent | 354a199f48d247fdabfcf49f2edf4183be770001 (diff) | |
download | portage-544d9a24d05465a00b05d52c428041abb4e0739c.tar.gz portage-544d9a24d05465a00b05d52c428041abb4e0739c.tar.bz2 portage-544d9a24d05465a00b05d52c428041abb4e0739c.zip |
For bug #179206, improve efficiency by using a containment test instead of str.count inside update_dbentry. Thanks to Jason Lai <jason.lai@gmail.com>.
svn path=/main/trunk/; revision=6560
-rw-r--r-- | pym/portage/update.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/pym/portage/update.py b/pym/portage/update.py index 472eebe96..34c91224b 100644 --- a/pym/portage/update.py +++ b/pym/portage/update.py @@ -16,7 +16,7 @@ ignored_dbentries = ("CONTENTS", "environment.bz2") def update_dbentry(update_cmd, mycontent): if update_cmd[0] == "move": old_value, new_value = update_cmd[1], update_cmd[2] - if mycontent.count(old_value): + if old_value in mycontent: old_value = re.escape(old_value); mycontent = re.sub(old_value+"(:|$|\\s)", new_value+"\\1", mycontent) def myreplace(matchobj): @@ -28,7 +28,7 @@ def update_dbentry(update_cmd, mycontent): elif update_cmd[0] == "slotmove" and get_operator(update_cmd[1]) is None: pkg, origslot, newslot = update_cmd[1:] old_value = "%s:%s" % (pkg, origslot) - if mycontent.count(old_value): + if old_value in mycontent: old_value = re.escape(old_value) new_value = "%s:%s" % (pkg, newslot) mycontent = re.sub(old_value+"($|\\s)", new_value+"\\1", mycontent) |