[bitbake-devel,2/3] fetch2/npm: handle items only in optionalDependencies

Submitted by Paul Eggleton on Feb. 6, 2017, 8:08 p.m. | Patch ID: 136803

Details

Message ID f499f8c82a0692a68a54daa884c658eb2c65742a.1486411669.git.paul.eggleton@linux.intel.com
State New
Headers show

Commit Message

Paul Eggleton Feb. 6, 2017, 8:08 p.m.
An npm package.json file has two dependency fields: dependencies and
optionalDependencies. An item in optionalDependencies *may* also be
listed in dependencies, but this is not required (and not necessary
since if it's in optionalDependencies it will be optional, adding it to
dependencies won't do anything). The code here was assuming that an
optional dependency would always be in both, that's probably because
that was true of the examples I was looking at at the time. To fix it,
just add the optional ones to the list we're iterating over.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
 lib/bb/fetch2/npm.py | 1 +
 1 file changed, 1 insertion(+)

Patch hide | download patch | download mbox

diff --git a/lib/bb/fetch2/npm.py b/lib/bb/fetch2/npm.py
index 3e35292..8c32f81 100644
--- a/lib/bb/fetch2/npm.py
+++ b/lib/bb/fetch2/npm.py
@@ -195,6 +195,7 @@  class Npm(FetchMethod):
 
         dependencies = pdata.get('dependencies', {})
         optionalDependencies = pdata.get('optionalDependencies', {})
+        dependencies.update(optionalDependencies)
         depsfound = {}
         optdepsfound = {}
         data[pkg]['deps'] = {}