nanonyme commented on code in PR #1989:
URL: https://github.com/apache/buildstream/pull/1989#discussion_r1937685750
##########
src/buildstream/_loader/loadelement.pyx:
##########
@@ -379,44 +377,11 @@ cdef class LoadElement:
self._dep_cache = FrozenBitMap(self._dep_cache)
-def _dependency_cmp(Dependency dep_a, Dependency dep_b):
- cdef LoadElement element_a = dep_a.element
- cdef LoadElement element_b = dep_b.element
-
- # Sort on inter element dependency first
- if element_a.depends(element_b):
- return 1
- elif element_b.depends(element_a):
- return -1
-
- # If there are no inter element dependencies, place
- # runtime only dependencies last
- if dep_a.dep_type != dep_b.dep_type:
- if dep_a.dep_type == DependencyType.RUNTIME:
- return 1
- elif dep_b.dep_type == DependencyType.RUNTIME:
- return -1
-
- # All things being equal, string comparison.
- if element_a.name > element_b.name:
- return 1
- elif element_a.name < element_b.name:
- return -1
-
- # Sort local elements before junction elements
- # and use string comparison between junction elements
- if element_a.junction and element_b.junction:
- if element_a.junction > element_b.junction:
- return 1
- elif element_a.junction < element_b.junction:
- return -1
- elif element_a.junction:
- return -1
- elif element_b.junction:
- return 1
-
- # This wont ever happen
- return 0
+def _cmp_key(Dependency dep):
+ if element.junction:
Review Comment:
If it's desired to use DependencyType, we could make first item in tuple an
integer with value 0, 1, 2 corresponding build vs runtime vs all types.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]