Skip to content
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

--skip-npm flag to Skip putting emsdk's npm on PATH #1141

Open
wants to merge 67 commits into
base: main
Choose a base branch
from
Open
Changes from 3 commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
156dccb
skip-npm
shlomif May 18, 2022
9cc8ed7
cleanup
shlomif May 18, 2022
787da0b
Refactoring / code cleanup.
shlomif May 19, 2022
e6d333b
Rename to skip_node and cleanup.
shlomif Dec 2, 2022
bac1329
refactor
shlomif Dec 23, 2022
65bc87d
Add standalone_wasm feature to bazel emscripten_toolchain (#1145)
robbertvanginkel Dec 6, 2022
7d76e9e
3.1.28 (#1149)
sbc100 Dec 9, 2022
0d1238e
Upgrade to rules_nodejs 5.8.0 (#1150)
jfirebaugh Dec 20, 2022
f999f4d
3.1.29 (#1160)
sbc100 Jan 3, 2023
f3bc9f2
Pin Windows CI to Bazel 5.4.0 (#1163)
jfirebaugh Jan 4, 2023
346e233
Remove reference to fastcomp-latest. NFC (#1164)
sbc100 Jan 5, 2023
c299f67
Remove fastcomp SDK and fastcomp build rules. NFC (#1165)
sbc100 Jan 9, 2023
c25efd6
3.1.30 (#1167)
dschuff Jan 12, 2023
5991457
Remove `-upstream` component of SDK names (#1166)
sbc100 Jan 14, 2023
8c09461
Remove uneeded str. NFC (#1170)
sbc100 Jan 14, 2023
ba3a3c8
Update README.md after #1166. NFC (#1172)
sbc100 Jan 17, 2023
3009923
3.1.31 (#1176)
sbc100 Jan 27, 2023
0a03e63
Add support for Visual Studio 2022 (#1177)
juj Jan 28, 2023
22f2521
Fix args ordering in LLVM build from previous commit (#1179)
juj Jan 28, 2023
f90d188
Remove support for building with Visual Studio 2017. Since Jan 29, 20…
juj Jan 30, 2023
72bca9f
Improve ordering in `emsdk list` (#1180)
sbc100 Jan 30, 2023
c98ba98
Add Windows Arm64 support for compiling from source (#1186)
Blackhex Feb 15, 2023
7c66ba7
Remove unused build_target_platform parameter from make_build (#1187)
Blackhex Feb 16, 2023
31c28db
3.1.32 (#1188)
sbc100 Feb 18, 2023
09992a5
Update some stale information in README.md (#1190)
sbc100 Feb 24, 2023
7a71a71
Add missing binaries for bazel (#1082)
kon72 Feb 25, 2023
ee175ad
Only add node/bin to user's PATH if one is not already found (#1189)
sbc100 Mar 3, 2023
adc2846
3.1.33 (#1200)
tlively Mar 9, 2023
6b248a3
v3.1.34 (#1203)
sbc100 Mar 15, 2023
97ffba1
Update arm64 linux release (#1204)
sbc100 Mar 15, 2023
acd8abd
Add linux/arm64 support to bazel rules (#1156)
robbertvanginkel Mar 30, 2023
1507c59
3.1.35 (#1208)
dschuff Apr 4, 2023
1f284ad
Add `activated_path_skip` to node v14.18.2 packages (#1209)
sbc100 Apr 10, 2023
1cadcc8
Update node version 14.15.5 -> 15.14.0 (#829)
sbc100 Apr 11, 2023
1147c9d
3.1.36 (#1210)
sbc100 Apr 17, 2023
1355cd7
3.1.37 (#1212)
sbc100 Apr 26, 2023
19c2dd7
3.1.38 (#1215)
sbc100 May 10, 2023
7500b15
3.1.39 (#1217)
dschuff May 19, 2023
bda6e3d
3.1.40 (#1221)
dschuff May 31, 2023
b5fb454
Update mac builders to use Circle's gen2 mac runner (#1222)
dschuff May 31, 2023
d59bea6
Add security policy (#1224)
pnacht May 31, 2023
41a6db6
Docker: remove remnant of fastcomp (#1226)
kleisauke Jun 1, 2023
e2f87da
Docker: remove redundant `EMSDK_NODE` env (#1225)
kleisauke Jun 1, 2023
fcbbb5c
3.1.41 (#1230)
sbc100 Jun 6, 2023
d094326
Update node, 15.14.0 -> 16.20.0 (#1232)
dschuff Jun 20, 2023
5690fde
3.1.42 (#1238)
sbc100 Jun 23, 2023
6fb20c4
Prefer `arm64` over `aarch64` internally. NFC (#1246)
sbc100 Jun 27, 2023
6dbcaff
Add some basic testing of arm64 linux (#1247)
sbc100 Jun 27, 2023
ab10d25
Add a warning when trying to install linux-arm64 binaries (#1249)
sbc100 Jun 27, 2023
dbaed53
Fix `activated_path_skip` on repeated running of `emsdk_env.sh` (#1250)
sbc100 Jun 27, 2023
2933da6
Fix a typo (#1251)
kripken Jun 27, 2023
42b482c
Docker: use a entrypoint script (#1227)
kleisauke Jul 6, 2023
a971fe4
3.1.43 (#1254)
sbc100 Jul 10, 2023
a2ca455
Have create_release.py push the new branch automatically (#1255)
sbc100 Jul 10, 2023
c3870d4
Update linux arm64 to 3.1.41 (#1256)
sbc100 Jul 10, 2023
8c1d600
Rename `zipfile` to `archive` or `download` as appropriate. NFC (#1257)
sbc100 Jul 10, 2023
a760086
Update linux arm64 to 3.1.43 (#1258)
sbc100 Jul 11, 2023
b25d87e
3.1.44 (#1260)
sbc100 Jul 25, 2023
c5e02fa
wasm_cc_binary: Specify a default OS. Allow users to override platfor…
martijneken Jul 28, 2023
d27c69b
Add starlark highlighting to Bazel readme (#1264)
mattsoulanille Aug 8, 2023
d021b3d
3.1.45 (#1269)
dschuff Aug 23, 2023
dd94117
Update linux arm64 build. NFC (#1270)
sbc100 Aug 23, 2023
b3b0121
Fix the format of the .flake8 file, and exclude the script directory …
dschuff Aug 24, 2023
16d3178
Replace update_bazel_workspace.sh with a python script (#1271)
dschuff Aug 24, 2023
0b10952
[bazel] populate all_files (#1274)
walkingeyerobot Aug 29, 2023
f9f0ba3
3.1.46 (#1279)
sbc100 Sep 15, 2023
1285434
Switch to .xz by default for SDK downloads (#1281)
sbc100 Sep 21, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion emsdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
from urllib2 import urlopen


skip_npm = False

emsdk_packages_url = 'https://storage.googleapis.com/webassembly/emscripten-releases-builds/deps/'

emscripten_releases_repo = 'https://chromium.googlesource.com/emscripten-releases'
Expand Down Expand Up @@ -1398,6 +1400,9 @@ def find_latest_installed_tool(name):

# npm install in Emscripten root directory
def emscripten_npm_install(tool, directory):
global skip_npm
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to global here (its only needed if you want to update a global).

if skip_npm:
return True
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the goal is just to avoid putting the emscripten version of not in the path, you don't need to return early here. You will want to run npm install after installing emscripten.

node_tool = find_latest_installed_tool('node')
if not node_tool:
npm_fallback = which('npm')
Expand Down Expand Up @@ -1870,10 +1875,14 @@ def update_installed_version(self):
return None

def is_installed(self, skip_version_check=False):
global skip_npm
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to global here (its only needed if you want to update a global).

# If this tool/sdk depends on other tools, require that all dependencies are
# installed for this tool to count as being installed.
if hasattr(self, 'uses'):
for tool_name in self.uses:
if skip_npm:
if tool_name.startswith('node') or tool_name.startswith('npm'):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to the second part of this condition.

How about just if skip_npm and ool_name.startswith('node'):

continue
tool = find_tool(tool_name)
if tool is None:
errlog("Manifest error: No tool by name '" + tool_name + "' found! This may indicate an internal SDK error!")
Expand Down Expand Up @@ -2521,6 +2530,9 @@ def process_tool_list(tools_to_activate):
tools_to_activate = tools_to_activate[:i] + deps + tools_to_activate[i:]
i += len(deps) + 1

if skip_npm:
tools_to_activate = [t for t in tools_to_activate if (not t.name.startswith("node-"))]

for tool in tools_to_activate:
if not tool.is_installed():
exit_with_error("error: tool is not installed and therefore cannot be activated: '%s'" % tool)
Expand Down Expand Up @@ -2987,7 +2999,9 @@ def extract_string_arg(name):
value = args[i + 1]
del args[i:i + 2]
return value

global skip_npm
skip_npm = extract_bool_arg('--skip-npm')
sbc100 marked this conversation as resolved.
Show resolved Hide resolved
# errlog("--skip-npm found")
arg_old = extract_bool_arg('--old')
arg_uses = extract_bool_arg('--uses')
arg_permanent = extract_bool_arg('--permanent')
Expand Down