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

🐍 Don't resolve node symlink #1420

Merged
merged 2 commits into from
Jul 31, 2024
Merged
Changes from all commits
Commits
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
18 changes: 12 additions & 6 deletions packages/mystmd-py/src/mystmd_py/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,29 @@ def main():
"We recommend installing the latest LTS release, using your preferred package manager\n"
"or following instructions here: https://nodejs.org/en/download"
)
node = pathlib.Path(NODE_LOCATION).resolve()
node = pathlib.Path(NODE_LOCATION).absolute()

_version = subprocess.run([node, "-v"], capture_output=True, check=True, text=True).stdout
_version = subprocess.run(
[node, "-v"], capture_output=True, check=True, text=True
).stdout
major_version_match = re.match(r"v(\d+).*", _version)

if major_version_match is None:
raise SystemExit(f"MyST could not determine the version of Node.js: {_version}")

major_version = int(major_version_match[1])
if not (major_version in {18, 20, 22} or major_version > 22):
raise SystemExit(
f"MyST requires node 18, 20, or 22+; you are running node {version[1:3]}.\n\n"
f"MyST requires node 18, 20, or 22+; you are running node {major_version}.\n\n"
"Please update to the latest LTS release, using your preferred package manager\n"
"or following instructions here: https://nodejs.org/en/download"
)
os.execve(node, [node.name, PATH_TO_BIN_JS, *sys.argv[1:]], {**os.environ, "MYST_LANG": "PYTHON"})

os.execve(
node,
[node.name, PATH_TO_BIN_JS, *sys.argv[1:]],
{**os.environ, "MYST_LANG": "PYTHON"},
)


if __name__ == "__main__":
main()
Loading