From 82b0a1c0504e7c4916d3e5e08113bb64a67c2357 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Tue, 9 Dec 2008 07:52:36 +0000 Subject: [PATCH] For py3k compat, avoid using list.sort(cmp). svn path=/main/trunk/; revision=12184 --- bin/dispatch-conf | 18 +++++++++++------- 1 file 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 -- 2.26.2