summaryrefslogtreecommitdiff
path: root/main/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'main/models.py')
-rw-r--r--main/models.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/main/models.py b/main/models.py
index 577f11c6..f4ced350 100644
--- a/main/models.py
+++ b/main/models.py
@@ -245,13 +245,18 @@ class Package(models.Model):
deps = []
arches = None
# TODO: we can use list comprehension and an 'in' query to make this more effective
- for dep in self.depends.order_by('optional', 'name'):
+ for dep in self.depends.all():
pkg = dep.get_best_satisfier()
providers = None
if not pkg:
providers = dep.get_providers()
deps.append({'dep': dep, 'pkg': pkg, 'providers': providers})
- return deps
+ # sort the list; deptype sorting makes this tricker than expected
+ sort_order = {'D': 0, 'O': 1, 'M': 2, 'C': 3}
+ def sort_key(val):
+ dep = val['dep']
+ return (sort_order.get(dep.deptype, 1000), dep.name)
+ return sorted(deps, key=sort_key)
@cache_function(125)
def base_package(self):