Skip to content

Commit e9df0cd

Browse files
committed
Merge pull request kivy#521 from hottwaj/fix-redundant-dependency-graphs
Fix for kivy#515 - dependency graph issue
2 parents 237df9d + 3e025c7 commit e9df0cd

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

pythonforandroid/toolchain.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -610,15 +610,22 @@ def __init__(self):
610610
def remove_redundant_graphs(self):
611611
'''Removes possible graphs if they are equivalent to others.'''
612612
graphs = self.graphs
613-
initial_num_graphs = len(graphs)
614613
# Walk the list backwards so that popping elements doesn't
615-
# mess up indexing
616-
for i in range(len(graphs) - 1):
617-
graph = graphs[initial_num_graphs - 1 - i]
618-
for j in range(1, len(graphs)):
619-
comparison_graph = graphs[initial_num_graphs - 1 - j]
614+
# mess up indexing.
615+
616+
# n.b. no need to test graph 0 as it will have been tested against
617+
# all others by the time we get to it
618+
for i in range(len(graphs) - 1, 0, -1):
619+
graph = graphs[i]
620+
621+
#test graph i against all graphs 0 to i-1
622+
for j in range(0, i):
623+
comparison_graph = graphs[j]
624+
620625
if set(comparison_graph.keys()) == set(graph.keys()):
621-
graphs.pop(initial_num_graphs - 1 - i)
626+
#graph[i] == graph[j]
627+
#so remove graph[i] and continue on to testing graph[i-1]
628+
graphs.pop(i)
622629
break
623630

624631
def add(self, dependent, dependency):

0 commit comments

Comments
 (0)