Benjamin Schubert pushed to branch bschubert/rework-sort at BuildStream / buildstream
Commits:
-
4400bbc1
by Benjamin Schubert at 2019-02-04T15:26:54Z
1 changed file:
Changes:
... | ... | @@ -390,8 +390,6 @@ class Loader(): |
390 | 390 |
return meta_element
|
391 | 391 |
|
392 | 392 |
def _collect_elements(self, elements):
|
393 |
- elements_to_load = deque(reversed(elements))
|
|
394 |
- |
|
395 | 393 |
def compare_unprocessed(dep_a, dep_b):
|
396 | 394 |
if dep_a.dep_type != dep_b.dep_type:
|
397 | 395 |
if dep_a.dep_type == Symbol.RUNTIME:
|
... | ... | @@ -425,8 +423,10 @@ class Loader(): |
425 | 423 |
def not_visited(element):
|
426 | 424 |
return not element.visited
|
427 | 425 |
|
426 |
+ elements_to_load = deque(elements)
|
|
427 |
+ |
|
428 | 428 |
while elements_to_load:
|
429 |
- element = elements_to_load.popleft()
|
|
429 |
+ element = elements_to_load.pop()
|
|
430 | 430 |
|
431 | 431 |
if element.visited:
|
432 | 432 |
continue
|
... | ... | @@ -450,9 +450,9 @@ class Loader(): |
450 | 450 |
if dep.element.tried_visit:
|
451 | 451 |
# This element has already been requested, we should treat
|
452 | 452 |
# it as soon as possible
|
453 |
- elements_to_load.appendleft(dep.element)
|
|
454 |
- else:
|
|
455 | 453 |
elements_to_load.append(dep.element)
|
454 |
+ else:
|
|
455 |
+ elements_to_load.appendleft(dep.element)
|
|
456 | 456 |
|
457 | 457 |
for element in self._meta_elements.values():
|
458 | 458 |
element.build_dependencies.sort(key=attrgetter("index"), reverse=True)
|