From cc67d5a4045220ab6b0785b8e3b01cab488dc2fa Mon Sep 17 00:00:00 2001 From: Avimitin Date: Mon, 8 Aug 2022 15:32:43 +0800 Subject: [PATCH 1/4] Add riscv64 into archmap Signed-off-by: Avimitin --- nodeenv.py | 1 + 1 file changed, 1 insertion(+) diff --git a/nodeenv.py b/nodeenv.py index 7e57016..b68a506 100644 --- a/nodeenv.py +++ b/nodeenv.py @@ -547,6 +547,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(), From e2ca2ab08bbe2603a63090bd8862f6c391c2a08e Mon Sep 17 00:00:00 2001 From: Avimitin Date: Mon, 8 Aug 2022 16:12:30 +0800 Subject: [PATCH 2/4] Add unofficial mirror for riscv64 Signed-off-by: Avimitin --- nodeenv.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nodeenv.py b/nodeenv.py index b68a506..efa1b78 100644 --- a/nodeenv.py +++ b/nodeenv.py @@ -529,6 +529,8 @@ def get_root_url(version): 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 = { @@ -1083,7 +1085,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' From 20e11d745e92eb3f2271d4892293ddd04bc91f96 Mon Sep 17 00:00:00 2001 From: Avimitin Date: Mon, 8 Aug 2022 16:42:58 +0800 Subject: [PATCH 3/4] Check architecture in mirror test Signed-off-by: Avimitin --- tests/nodeenv_test.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/nodeenv_test.py b/tests/nodeenv_test.py index a623707..0422cfa 100644 --- a/tests/nodeenv_test.py +++ b/tests/nodeenv_test.py @@ -6,6 +6,7 @@ import subprocess import sys import sysconfig +import platform import mock import pytest @@ -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) From 9ee50cf9921fb1f319834510823d8b340e087e99 Mon Sep 17 00:00:00 2001 From: Avimitin Date: Mon, 22 Aug 2022 13:53:20 +0800 Subject: [PATCH 4/4] Fix ci Signed-off-by: Avimitin --- nodeenv.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nodeenv.py b/nodeenv.py index efa1b78..7f7bcb7 100644 --- a/nodeenv.py +++ b/nodeenv.py @@ -529,8 +529,10 @@ def get_root_url(version): 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" + return platform.machine() == 'riscv64' + def get_node_bin_url(version): archmap = {