summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-09-07 02:58:00 +0000
committerZac Medico <zmedico@gentoo.org>2009-09-07 02:58:00 +0000
commit1dfce8bd9a1a64465efa30520ca0f62c58e6f03a (patch)
treefb62570529235522bafc9a99a2c6016dd2cf3dcc
parent9fde774720c2552e187f58a6395e40fe12dd88cd (diff)
downloadportage-1dfce8bd9a1a64465efa30520ca0f62c58e6f03a.tar.gz
portage-1dfce8bd9a1a64465efa30520ca0f62c58e6f03a.tar.bz2
portage-1dfce8bd9a1a64465efa30520ca0f62c58e6f03a.zip
Optimize catpkgsplit() by creating a tuple directly instead of generating it
from a list. Thanks to Marat Radchenko <slonopotamusorama@gmail.com> for this patch. svn path=/main/trunk/; revision=14211
-rw-r--r--pym/portage/versions.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/pym/portage/versions.py b/pym/portage/versions.py
index abd85d273..f434ff768 100644
--- a/pym/portage/versions.py
+++ b/pym/portage/versions.py
@@ -274,16 +274,15 @@ def catpkgsplit(mydata,silent=1):
mysplit = mydata.split('/', 1)
p_split=None
if len(mysplit)==1:
- retval=["null"]
+ cat = "null"
p_split=pkgsplit(mydata,silent=silent)
elif len(mysplit)==2:
- retval=[mysplit[0]]
+ cat = mysplit[0]
p_split=pkgsplit(mysplit[1],silent=silent)
if not p_split:
catcache[mydata]=None
return None
- retval.extend(p_split)
- retval = tuple(retval)
+ retval = (cat, p_split[0], p_split[1], p_split[2])
catcache[mydata]=retval
return retval