From 5f33f7d81a9c2d2990044fbd9ffa6b535cbda528 Mon Sep 17 00:00:00 2001 From: Dale <1363082+dalemyers@users.noreply.github.com> Date: Wed, 13 Oct 2021 16:20:40 +0100 Subject: [PATCH] Use x86_64 version of artifact tool for M1 macs (using Rosetta) (#1210) * Use x86_64 version of artifact tool for M1 macs (using Rosetta) * Update artifacttool_updater.py --- .../azext_devops/dev/common/artifacttool_updater.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/azure-devops/azext_devops/dev/common/artifacttool_updater.py b/azure-devops/azext_devops/dev/common/artifacttool_updater.py index 4f9c1588..abea392c 100644 --- a/azure-devops/azext_devops/dev/common/artifacttool_updater.py +++ b/azure-devops/azext_devops/dev/common/artifacttool_updater.py @@ -158,10 +158,18 @@ def _get_current_release(organization, override_version): # Distro returns empty strings on Windows currently, so don't even send distro_name = distro.id() or None distro_version = distro.version() or None + os_name = platform.system() + arch = platform.machine() + + # For M1 macs, there is no version of artifact tool. However, the x86_64 + # version can run under Rosetta, so we use that instead. + if os_name == "Darwin" and arch in ["amd64", "arm64"]: + arch = "x86_64" + release = client.get_clienttool_release( "ArtifactTool", - os_name=platform.system(), - arch=platform.machine(), + os_name=os_name, + arch=arch, distro_name=distro_name, distro_version=distro_version, version=override_version)