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

Conversation

shlomif
Copy link
Contributor

@shlomif shlomif commented Dec 1, 2022

Fixes: #1142

Copy link
Collaborator

@sbc100 sbc100 left a comment

Choose a reason for hiding this comment

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

I don't know if this patch aligns with the approch that we discuessed in the bug, but if we do take this approach I think you would just want to modify get_required_path. We still want to install and activate our own version of node, we just don't want to add it to the users path, right?

emsdk.py Outdated Show resolved Hide resolved
emsdk.py Outdated
# 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'):

emsdk.py Outdated
@@ -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).

emsdk.py Outdated
@@ -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).

@@ -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
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.

Per the comments on the pullreq
@shlomif
Copy link
Contributor Author

shlomif commented Dec 6, 2022

@sbc100 : thx. i fixed some low-hanging fruit

shlomif and others added 24 commits December 23, 2022 15:23
fastcomp can only be install using explicit versions names so this name
doesn't work.
Folks that want to work with fastcomp will now need to use an older
checkout of emsdk.
This name existed to distinguish the SDK from fastcomp, but as of emscripten-core#1165,
we no longer support fastcomp.
These function already returns a string.
* Add support for Visual Studio 2022 and migrate to using cmake --build when building on Windows. Leverage the VS2019 MSBuild 'Multi-ToolTask' feature CL_MPCount to saturate project builds properly to 100% CPU usage so building LLVM builds different cpp files in parallel. Clean up some code duplication around Visual Studio support.

* flake

* Work around Linux bot not having 'cmake --build . -j' flag.
…22, upstream LLVM has required VS2019 or VS2022 to build. So it has not been possible to build emsdk from source with VS2017 for a year. llvm/llvm-project@058c5df (emscripten-core#1178)
We have an existing `version_key` helper function for sorting versions.

It also does a better job, producing output like:

```
All recent (non-legacy) installable versions are:
         3.1.31
         3.1.31-asserts
         3.1.30
         3.1.30-asserts
         3.1.29
         3.1.29-asserts
```

Rather than:

```
All recent (non-legacy) installable versions are:
         3.1.31
         3.1.30
         3.1.29
         3.1.28
         3.1.27
```

(with -assert versions listed after 3.1.0)
- Remove reference to `~/.emscripten`.  We no longer use the home
  directory to store config information by default, either in
  emscripten or in emsdk.
- Remove some references to `The Emscripten Command Prompt`.  While I
  suppose this is referring to the windows-only `emcmdprompt.bat`, and I
  suppose it means "any shell where `activate` has been run", I think
  its more clear to simply avoid using the term.
…ten-core#1189)

If the user already has a version of node in their PATH don't clobber
it.  This doesn't effect emscripten since the version of node we use
there is controlled via the config file, not via PATH.

Part of fix for emscripten-core#705.
dschuff and others added 29 commits September 29, 2023 21:18
…1222)

This runner is faster and more efficient.
Also factor the mac configuration into an executor.
Signed-off-by: Pedro Kaj Kjellerup Nacht <pnacht@google.com>
The fastcomp backend was removed in Emscripten v2.0.0.
This allows us to use the native ARM64 version on MacOS.
Also update the test scripts to work on ARM64 mac, and skip tests that aren't relevant.
This seems like more commonly known/used name for the architecture
these days.
…ripten-core#1250)

The first time around `node` was being correctly added to the PATH, but
the second time around this code was observing the emsdk copy of node
in the PATH and assuming it could be skipped.

Fixes: emscripten-core#1240
In favor of `/etc/bash.bashrc`, which is only read for interactive
shells.
…core#1255)

Having used this script for a while now I'm not sure there is any
point if leaving this last step as a manual push.
…m. (emscripten-core#1262)

* wasm_cc_binary: Specify a default OS. Allow users to override platform.

Problem: proxy-wasm/proxy-wasm-cpp-sdk#157 (comment)

This is solving the problem in two different ways. Please let me know
your thoughts about both approaches, as either will work.

Signed-off-by: Martijn Stevenson <mstevenson@google.com>

* Rework platform selection to trigger os:wasi off standalone attr

Signed-off-by: Martijn Stevenson <mstevenson@google.com>

---------

Signed-off-by: Martijn Stevenson <mstevenson@google.com>
Mark the build files as using the starlark language so they have the correct syntax highlighting.
Also update emscripten include dir to v18, and change 17 to wildcard in emscripten deps
…from the py2 linter (emscripten-core#1272)

Flake8's INI config file format requires commas after each line. Because our file didn't have them, the exclude list
wasn't set up correctly, and the --extend-exclude flag wasn't working. This PR fixes the .flake8 file.

Also, update flake8 to the latest version available (because version 3.8 is required to get the --extend-exclude flag)
and use the flag to exclude the files in the scripts/ directory from the python2 linter (since the scripts are python3).
…re#1271)

This script is (IMO) more readable, but the real reason for this change is that
it raises an error message when the binary package fails to download. (The shell
script silently generated a bogus hash instead, because the shell's `set -e`
builtin does not affect commands executing inside a $() context.
It seemed just as easy to rewrite the script in Python as to fix that.

This change also updates some outdated filename references.
Fixes emscripten-core#1273. This was broken by emscripten-core#1045 with the comment "* all_files not needed?" They were needed.
This is a bit of a hack but I can't think of another way to do it.
Basically when downloading SDKs, we first try the new `.xz` extension.
If that fails, we fall back to the old `.tbz2`.  Both these first two
download attempts we run in "silent" mode.  If both of them fail we
re-run the original request in non-silent mode so that the error message
will always contain the original `.xz` extension.

See emscripten-core#1235
@sbc100
Copy link
Collaborator

sbc100 commented Nov 17, 2023

I think this can be closed now that #1189 has landed emsdk will no longer add its node to the PATH if you already have one .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Installing emsdk overwrites node on PATH