aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/buildgen/plugins/transitive_dependencies.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/buildgen/plugins/transitive_dependencies.py')
-rw-r--r--tools/buildgen/plugins/transitive_dependencies.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/tools/buildgen/plugins/transitive_dependencies.py b/tools/buildgen/plugins/transitive_dependencies.py
index c2d3da3a3b..01e7f61ea9 100644
--- a/tools/buildgen/plugins/transitive_dependencies.py
+++ b/tools/buildgen/plugins/transitive_dependencies.py
@@ -1,4 +1,4 @@
-# Copyright 2015, Google Inc.
+# Copyright 2015-2016, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -36,10 +36,13 @@ of the list of dependencies.
"""
def get_lib(libs, name):
- return next(lib for lib in libs if lib['name']==name)
+ try:
+ return next(lib for lib in libs if lib['name']==name)
+ except StopIteration:
+ return None
def transitive_deps(lib, libs):
- if 'deps' in lib:
+ if lib is not None and 'deps' in lib:
# Recursively call transitive_deps on each dependency, and take the union
return set.union(set(lib['deps']),
*[set(transitive_deps(get_lib(libs, dep), libs))
@@ -58,6 +61,10 @@ def mako_plugin(dictionary):
node_modules = dictionary.get('node_modules')
targets = dictionary.get('targets')
- for target_list in (libs, node_modules, targets):
+ for target_list in (libs, targets, node_modules):
for target in target_list:
target['transitive_deps'] = transitive_deps(target, libs)
+
+ python_dependencies = dictionary.get('python_dependencies')
+ python_dependencies['transitive_deps'] = (
+ transitive_deps(python_dependencies, libs))