sort using cmpfunc, not by key
authorTimo Savola <tsavola@movial.fi>
Tue, 8 Apr 2008 14:25:42 +0000 (17:25 +0300)
committerTimo Savola <tsavola@movial.fi>
Tue, 8 Apr 2008 14:25:44 +0000 (17:25 +0300)
(Python 2.3 doesn't support key.)

matrix/build.py

index f25e294..d5c3561 100644 (file)
@@ -28,7 +28,7 @@ def build(targets, build_jobs=1, make_jobs=1):
 
        if config.debug:
                l = list(flat)
-               l.sort(key=lambda c: c.name)
+               l.sort(compare_name)
 
                print 'Building components:'
                for c in l:
@@ -89,6 +89,12 @@ def flatten(rdepends, all=set()):
 
        return all
 
+def compare_name(a, b):
+       return cmp(a.name, b.name)
+
+def compare_weight(a, b):
+       return cmp(a.weight, b.weight)
+
 class Builder(object):
        def __init__(self, roots, count, max_jobs, max_make_jobs):
                self.max_jobs = max_jobs
@@ -202,7 +208,7 @@ class Builder(object):
                        c.clear_rdepends()
 
                        if wait_build_changed:
-                               self.wait_build.sort(key=lambda c: c.weight)
+                               self.wait_build.sort(compare_weight)
 
                elif c.state == 'in-install':
                        assert c == self.in_install