Index: pylib/gyp/input.py |
diff --git a/pylib/gyp/input.py b/pylib/gyp/input.py |
index f694e57b9fe455197bcd5eb423c48b66a8f0376e..7bf9b4035e36cc97d1bcb4e52286cd31bca97fa7 100644 |
--- a/pylib/gyp/input.py |
+++ b/pylib/gyp/input.py |
@@ -1602,15 +1602,22 @@ class DependencyGraphNode(object): |
def DeepDependencies(self, dependencies=None): |
"""Returns a list of all of a target's dependencies, recursively.""" |
if dependencies == None: |
- dependencies = [] |
+ # Using a list to get ordered output and a set to do fast "is it |
+ # already added" checks. |
+ dependencies = ([], set()) |
+ |
+ dependency_list, dependency_set = dependencies |
for dependency in self.dependencies: |
# Check for None, corresponding to the root node. |
- if dependency.ref != None and dependency.ref not in dependencies: |
- dependencies.append(dependency.ref) |
+ if dependency.ref is None: |
+ continue |
+ if dependency.ref not in dependency_set: |
+ dependency_list.append(dependency.ref) |
+ dependency_set.add(dependency.ref) |
dependency.DeepDependencies(dependencies) |
- return dependencies |
+ return dependency_list |
def _LinkDependenciesInternal(self, targets, include_shared_libraries, |
dependencies=None, initial=True): |