[OE-core] [PATCH 11/12] npm: Use configs for npm environment and args for npm run command
From: Stefan Herbrechtsmeier 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 --- (no changes since v1) meta/classes/npm.bbclass | 14 ++ 1 file 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")) -- 2.20.1 -=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#156756): https://lists.openembedded.org/g/openembedded-core/message/156756 Mute This Topic: https://lists.openembedded.org/mt/86165234/21656 Group Owner: openembedded-core+ow...@lists.openembedded.org Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[OE-core] [PATCH 11/12] npm: Use configs for npm environment and args for npm run command
From: Stefan Herbrechtsmeier 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 --- meta/classes/npm.bbclass | 14 ++ 1 file 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")) -- 2.20.1 -=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#156720): https://lists.openembedded.org/g/openembedded-core/message/156720 Mute This Topic: https://lists.openembedded.org/mt/86141424/21656 Group Owner: openembedded-core+ow...@lists.openembedded.org Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-