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

Add support for riscv64 #313

Merged
merged 4 commits into from
Mar 16, 2023
Merged
Show file tree
Hide file tree
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
7 changes: 6 additions & 1 deletion nodeenv.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,10 @@ def is_x86_64_musl():
return sysconfig.get_config_var('HOST_GNU_TYPE') == 'x86_64-pc-linux-musl'


def is_riscv64():
return platform.machine() == 'riscv64'


def get_node_bin_url(version):
archmap = {
'x86': 'x86', # Windows Vista 32
Expand All @@ -547,6 +551,7 @@ def get_node_bin_url(version):
'armv8.4': 'arm64',
'ppc64le': 'ppc64le', # Power PC
's390x': 's390x', # IBM S390x
'riscv64': 'riscv64', # RISCV 64
}
sysinfo = {
'system': platform.system().lower(),
Expand Down Expand Up @@ -1082,7 +1087,7 @@ def main():
else:
src_domain = args.mirror
# use unofficial builds only if musl and no explicitly chosen mirror
elif is_x86_64_musl():
elif is_x86_64_musl() or is_riscv64():
src_domain = 'unofficial-builds.nodejs.org'
else:
src_domain = 'nodejs.org'
Expand Down
3 changes: 3 additions & 0 deletions tests/nodeenv_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import subprocess
import sys
import sysconfig
import platform

import mock
import pytest
Expand Down Expand Up @@ -112,6 +113,8 @@ def test_mirror_option():
# Check if running on musl system and delete last mirror if it is
if sys_type in musl_type:
urls.pop()
elif platform.machine() == "riscv64":
urls.pop()
with open(os.path.join(HERE, 'nodejs_index.json'), 'rb') as f:
def rewind(_):
f.seek(0)
Expand Down