summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-12-09 07:52:36 +0000
committerZac Medico <zmedico@gentoo.org>2008-12-09 07:52:36 +0000
commit82b0a1c0504e7c4916d3e5e08113bb64a67c2357 (patch)
tree7f07c77aff2e58d90ca3f5a9f4001cd4cc7a77dd
parent1e722a137d9d40c0c21eb090512bcf79f26ccca5 (diff)
downloadportage-82b0a1c0504e7c4916d3e5e08113bb64a67c2357.tar.gz
portage-82b0a1c0504e7c4916d3e5e08113bb64a67c2357.tar.bz2
portage-82b0a1c0504e7c4916d3e5e08113bb64a67c2357.zip
For py3k compat, avoid using list.sort(cmp).
svn path=/main/trunk/; revision=12184
-rwxr-xr-xbin/dispatch-conf18
1 files changed, 11 insertions, 7 deletions
diff --git a/bin/dispatch-conf b/bin/dispatch-conf
index 4f2fc09b7..0b96ee54a 100755
--- a/bin/dispatch-conf
+++ b/bin/dispatch-conf
@@ -326,24 +326,28 @@ class dispatch:
We keep ._cfg0002_conf over ._cfg0001_conf and ._cfg0000_conf.
"""
h = {}
-
+ configs = []
newconfigs.sort ()
for nconf in newconfigs:
nconf = nconf.rstrip ()
conf = re.sub (r'\._cfg\d+_', '', nconf)
- dir = re.match (r'^(.+)/', nconf).group (1)
+ dirname = os.path.dirname(nconf)
+ conf_map = {
+ 'current' : conf,
+ 'dir' : dirname,
+ 'new' : nconf,
+ }
if conf in h:
mrgconf = re.sub(r'\._cfg', '._mrg', h[conf]['new'])
if os.path.exists(mrgconf):
os.unlink(mrgconf)
os.unlink(h[conf]['new'])
-
- h [conf] = { 'current' : conf, 'dir' : dir, 'new' : nconf }
-
- configs = h.values ()
- configs.sort (lambda a, b: cmp(a ['current'], b ['current']))
+ h[conf].update(conf_map)
+ else:
+ h[conf] = conf_map
+ configs.append(conf_map)
return configs