From e1474e8f318b5a699a4cf9516387ae198ac5ebb0 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Fri, 12 Dec 2008 21:24:53 +0000 Subject: For py3k compat, avoid using list.sort(cmp). (trunk r12184) svn path=/main/branches/2.1.6/; revision=12219 --- bin/dispatch-conf | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'bin/dispatch-conf') 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 -- cgit v1.2.3-1-g7c22