diff options
author | Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com> | 2021-10-08 09:48:34 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-10-14 11:48:35 +0100 |
commit | 6490de38ba9563181653ef223224de066faf9166 (patch) | |
tree | b8b8540b6f9ba38f946404ad75bbeec6c94c747a /meta/classes/npm.bbclass | |
parent | f0a47afb43bd63b66c565ba3d084e20d6725495e (diff) | |
download | openembedded-core-contrib-6490de38ba9563181653ef223224de066faf9166.tar.gz |
npm: Use configs for npm environment and args for npm run command
Use parameter configs of class NpmEnvironment and parameter args of
function run to support a common npmrc for all run calls of a single
NpmEnvironment.
Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/npm.bbclass')
-rw-r--r-- | meta/classes/npm.bbclass | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/meta/classes/npm.bbclass b/meta/classes/npm.bbclass index 05bb9f578d..547c531883 100644 --- a/meta/classes/npm.bbclass +++ b/meta/classes/npm.bbclass @@ -61,8 +61,8 @@ def npm_pack(env, srcdir, workdir): """Run 'npm pack' on a specified directory""" import shlex cmd = "npm pack %s" % shlex.quote(srcdir) - configs = [("ignore-scripts", "true")] - tarball = env.run(cmd, configs=configs, workdir=workdir).strip("\n") + args = [("ignore-scripts", "true")] + tarball = env.run(cmd, args=args, workdir=workdir).strip("\n") return os.path.join(workdir, tarball) python npm_do_configure() { @@ -228,15 +228,11 @@ python npm_do_compile() { bb.utils.remove(d.getVar("NPM_BUILD"), recurse=True) - env = NpmEnvironment(d, configs=npm_global_configs(d)) - - dev = bb.utils.to_boolean(d.getVar("NPM_INSTALL_DEV"), False) - with tempfile.TemporaryDirectory() as tmpdir: args = [] - configs = [] + configs = npm_global_configs(d) - if dev: + if bb.utils.to_boolean(d.getVar("NPM_INSTALL_DEV"), False): configs.append(("also", "development")) else: configs.append(("only", "production")) @@ -254,6 +250,8 @@ python npm_do_compile() { configs.append(("nodedir", d.getVar("NPM_NODEDIR"))) configs.append(("python", d.getVar("PYTHON"))) + env = NpmEnvironment(d, configs) + # Add node-pre-gyp configuration args.append(("target_arch", d.getVar("NPM_ARCH"))) args.append(("build-from-source", "true")) |