mirror of
https://git.yoctoproject.org/poky
synced 2026-04-17 18:32:12 +02:00
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. (From OE-Core rev: 6490de38ba9563181653ef223224de066faf9166) 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>
This commit is contained in:
committed by
Richard Purdie
parent
9f452b4831
commit
fe87ab0a6a
@@ -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"))
|
||||
|
||||
Reference in New Issue
Block a user