From: Zac Medico Date: Mon, 7 Sep 2009 02:58:00 +0000 (-0000) Subject: Optimize catpkgsplit() by creating a tuple directly instead of generating it X-Git-Tag: v2.2_rc41~57 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=1dfce8bd9a1a64465efa30520ca0f62c58e6f03a;p=portage.git Optimize catpkgsplit() by creating a tuple directly instead of generating it from a list. Thanks to Marat Radchenko for this patch. svn path=/main/trunk/; revision=14211 --- 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