-
Notifications
You must be signed in to change notification settings - Fork 15k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
build: fail a build if "npm install" fails #16369
Conversation
DEPS
Outdated
@@ -107,7 +107,7 @@ hooks = [ | |||
'action': [ | |||
'python', | |||
'-c', | |||
'import os; os.chdir("src"); os.chdir("electron"); os.system("npm install")', | |||
'import os; os.chdir("src"); os.chdir("electron"); exit_code = os.system("npm instal"); import sys; sys.exit(exit_code)', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FIXME instal
@nornagon
I'll replace all |
3ba1aa0
to
969c98e
Compare
969c98e
to
05ed0b5
Compare
7e90ac8
to
3be1d2f
Compare
Done. |
DEPS
Outdated
@@ -107,7 +107,7 @@ hooks = [ | |||
'action': [ | |||
'python', | |||
'-c', | |||
'import os; os.chdir("src"); os.chdir("electron"); os.system("npm install")', | |||
'import os, subprocess, sys; os.chdir(os.path.join("src", "electron")); npm = "npm.cmd" if sys.platform == "win32" else "npm"; subprocess.check_call([npm, "install"]);', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how come npm.cmd
is now needed on windows? afaik just npm
was working fine previously.
If this is truly needed, then this has become too complicated for a one-liner & should be moved to a script.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
npm
was working fine previously
Only when you use os.system()
.
subprocess.call()
needs different npm
executable names on different platforms, see here for example
Lines 28 to 30 in 52fe92d
NPM = 'npm' | |
if sys.platform in ['win32', 'cygwin']: | |
NPM += '.cmd' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can move the npm
call to a Python script.
You think it would be better to move the whole thing to a new script?
It doesn't look that different now from those python setup.py build
calls for boto and requests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO the if
statement is enough to push it over the edge of "shouldn't be inlined in a string in a config file". The only reason these are in Python instead of just being direct commands is because there's no way to cd
in a cross-platform way, and npm doesn't have a -C
argument like make
and ninja
.
I'd be fine with having a script/cd-npm.py
that took a directory as its first argument and passed the rest of its arguments directly to npm
(or npm.cmd
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like calling os.chdir(...)
before calling the npm.py
is good enough. At least it's not worse than calling the same for boto and requests.
os.chdir(os.path.join("src", "electron"));
subprocess.check_call(["python", "script/lib/npm.py", "install"]);
This ^ change is already there btw )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nornagon Any thoughts?
3be1d2f
to
fb80ca7
Compare
@@ -107,7 +107,7 @@ hooks = [ | |||
'action': [ | |||
'python', | |||
'-c', | |||
'import os; os.chdir("src"); os.chdir("electron"); os.system("npm install")', | |||
'import os, subprocess; os.chdir(os.path.join("src", "electron")); subprocess.check_call(["python", "script/lib/npm.py", "install"]);', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's weird to invoke python to cd and then invoke python :/
Would the --prefix option work? i.e. npm install --prefix src/electron
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
6224090
to
16f2203
Compare
16f2203
to
d883686
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok fine :)
No Release Notes |
I have automatically backported this PR to "4-0-x", please check out #16505 |
Description of Change
It can fail you know.
Checklist
npm test
passesRelease Notes
Notes: no-notes