From 4f80085c423844b38446f289d4a1855e19ffd1da Mon Sep 17 00:00:00 2001 From: Afonso Oliveira Date: Fri, 13 Nov 2026 18:18:09 +0000 Subject: [PATCH] Add linux-riscv64 as a known platform get_conda_subdir() has no entry for a linux riscv64 host, so vinca raises "Unsupported platform" there, and an explicit --platform linux-riscv64 fails in resolve_pkgname_from_indexes() with a KeyError because the platform is missing from map_platform_python_to_conda. Map ("linux", "riscv64") to linux-riscv64 and let linux-riscv64 use the "linux" entries of the dependency mappings, as linux-64 and linux-aarch64 do. Add test cases for the host detection and for the dependency lookup. Tested with the full vinca test suite on x86-64 Linux, Python 3.12 (352 passed, 4 skipped), and ruff format and ruff check on the touched test and platforms files. Not run: the pyrefly check as CI runs it, or anything on a riscv64 host. --- vinca/platforms.py | 1 + vinca/resolve.py | 1 + vinca/test_platforms.py | 11 ++++++++++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/vinca/platforms.py b/vinca/platforms.py index a80f04b..4d5e19b 100644 --- a/vinca/platforms.py +++ b/vinca/platforms.py @@ -7,6 +7,7 @@ _PLATFORM_BY_SYSTEM_AND_MACHINE = { ("linux", "aarch64"): "linux-aarch64", + ("linux", "riscv64"): "linux-riscv64", ("linux", "x86_64"): "linux-64", ("darwin", "arm64"): "osx-arm64", } diff --git a/vinca/resolve.py b/vinca/resolve.py index 6b0b6f7..7710dcc 100644 --- a/vinca/resolve.py +++ b/vinca/resolve.py @@ -8,6 +8,7 @@ map_platform_python_to_conda = { "linux-64": "linux", "linux-aarch64": "linux", + "linux-riscv64": "linux", "osx-64": "osx", "osx-arm64": "osx", "win-64": "win64", diff --git a/vinca/test_platforms.py b/vinca/test_platforms.py index d599d09..4117759 100644 --- a/vinca/test_platforms.py +++ b/vinca/test_platforms.py @@ -1,6 +1,6 @@ import pytest -from vinca import platforms +from vinca import config, platforms, resolve def test_explicit_conda_subdir_wins(monkeypatch): @@ -14,6 +14,7 @@ def test_explicit_conda_subdir_wins(monkeypatch): [ ("linux", "x86_64", "linux-64"), ("linux", "aarch64", "linux-aarch64"), + ("linux", "riscv64", "linux-riscv64"), ("darwin", "arm64", "osx-arm64"), ("darwin", "x86_64", "osx-64"), ("win32", "AMD64", "win-64"), @@ -42,3 +43,11 @@ def test_unknown_linux_machine_is_rejected(monkeypatch): with pytest.raises(RuntimeError, match="system='linux'.*machine='mips'"): platforms.get_conda_subdir() + + +@pytest.mark.parametrize("subdir", ["linux-64", "linux-aarch64", "linux-riscv64"]) +def test_linux_subdirs_use_the_linux_dependency_mapping(monkeypatch, subdir): + monkeypatch.setattr(config, "selected_platform", subdir) + conda_index = [{"pkg": {"robostack": {"linux": "linux-pkg", "osx": "osx-pkg"}}}] + + assert resolve.resolve_pkgname_from_indexes("pkg", conda_index) == "linux-pkg"