diff options
Diffstat (limited to 'poky/meta/classes/npm.bbclass')
-rw-r--r-- | poky/meta/classes/npm.bbclass | 39 |
1 files changed, 25 insertions, 14 deletions
diff --git a/poky/meta/classes/npm.bbclass b/poky/meta/classes/npm.bbclass index 068032a1e..55a6985fb 100644 --- a/poky/meta/classes/npm.bbclass +++ b/poky/meta/classes/npm.bbclass @@ -17,8 +17,10 @@ # NPM_INSTALL_DEV: # Set to 1 to also install devDependencies. +inherit python3native + DEPENDS_prepend = "nodejs-native " -RDEPENDS_${PN}_prepend = "nodejs " +RDEPENDS_${PN}_append_class-target = " nodejs" NPM_INSTALL_DEV ?= "0" @@ -130,11 +132,17 @@ python npm_do_configure() { cached_manifest.pop("dependencies", None) cached_manifest.pop("devDependencies", None) - with open(orig_shrinkwrap_file, "r") as f: - orig_shrinkwrap = json.load(f) + has_shrinkwrap_file = True + + try: + with open(orig_shrinkwrap_file, "r") as f: + orig_shrinkwrap = json.load(f) + except IOError: + has_shrinkwrap_file = False - cached_shrinkwrap = copy.deepcopy(orig_shrinkwrap) - cached_shrinkwrap.pop("dependencies", None) + if has_shrinkwrap_file: + cached_shrinkwrap = copy.deepcopy(orig_shrinkwrap) + cached_shrinkwrap.pop("dependencies", None) # Manage the dependencies progress = OutOfProgressHandler(d, r"^(\d+)/(\d+)$") @@ -165,8 +173,10 @@ python npm_do_configure() { progress.write("%d/%d" % (progress_done, progress_total)) dev = bb.utils.to_boolean(d.getVar("NPM_INSTALL_DEV"), False) - foreach_dependencies(orig_shrinkwrap, _count_dependency, dev) - foreach_dependencies(orig_shrinkwrap, _cache_dependency, dev) + + if has_shrinkwrap_file: + foreach_dependencies(orig_shrinkwrap, _count_dependency, dev) + foreach_dependencies(orig_shrinkwrap, _cache_dependency, dev) # Configure the main package with tempfile.TemporaryDirectory() as tmpdir: @@ -181,16 +191,19 @@ python npm_do_configure() { cached_manifest[depkey] = {} cached_manifest[depkey][name] = version - _update_manifest("dependencies") + if has_shrinkwrap_file: + _update_manifest("dependencies") if dev: - _update_manifest("devDependencies") + if has_shrinkwrap_file: + _update_manifest("devDependencies") with open(cached_manifest_file, "w") as f: json.dump(cached_manifest, f, indent=2) - with open(cached_shrinkwrap_file, "w") as f: - json.dump(cached_shrinkwrap, f, indent=2) + if has_shrinkwrap_file: + with open(cached_shrinkwrap_file, "w") as f: + json.dump(cached_shrinkwrap, f, indent=2) } python npm_do_compile() { @@ -237,9 +250,7 @@ python npm_do_compile() { sysroot = d.getVar("RECIPE_SYSROOT_NATIVE") nodedir = os.path.join(sysroot, d.getVar("prefix_native").strip("/")) configs.append(("nodedir", nodedir)) - bindir = os.path.join(sysroot, d.getVar("bindir_native").strip("/")) - pythondir = os.path.join(bindir, "python-native", "python") - configs.append(("python", pythondir)) + configs.append(("python", d.getVar("PYTHON"))) # Add node-pre-gyp configuration args.append(("target_arch", d.getVar("NPM_ARCH"))) |