From f82a363a33aa8c70f0003cb8efd8c95ada2daf4e Mon Sep 17 00:00:00 2001 From: "Mehmet Ali \"Mali\" Akmanalp" Date: Tue, 14 Jul 2015 14:22:15 -0400 Subject: [PATCH] Fixes issues where keys missing from bower output Fixes #495 --- packaging/language/bower.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/packaging/language/bower.py b/packaging/language/bower.py index 7af8136a445..bd7d4b26159 100644 --- a/packaging/language/bower.py +++ b/packaging/language/bower.py @@ -116,11 +116,15 @@ class Bower(object): data = json.loads(self._exec(cmd, True, False)) if 'dependencies' in data: for dep in data['dependencies']: - if 'missing' in data['dependencies'][dep] and data['dependencies'][dep]['missing']: + dep_data = data['dependencies'][dep] + if dep_data.get('missing', False): missing.append(dep) - elif data['dependencies'][dep]['pkgMeta']['version'] != data['dependencies'][dep]['update']['latest']: + elif \ + 'version' in dep_data['pkgMeta'] and \ + 'update' in dep_data and \ + dep_data['pkgMeta']['version'] != dep_data['update']['latest']: outdated.append(dep) - elif 'incompatible' in data['dependencies'][dep] and data['dependencies'][dep]['incompatible']: + elif dep_data.get('incompatible', False): outdated.append(dep) else: installed.append(dep)