From f7cb5baee163a27e1af8e9483a8438b7a71aed08 Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Sun, 2 Jun 2024 21:20:14 +1200 Subject: [PATCH] Update to MAVSDK v2.11.0 This should bring native support for macOS on ARM (M1). --- MAVSDK_SERVER_VERSION | 2 +- setup.py | 21 +++++++++++++-------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/MAVSDK_SERVER_VERSION b/MAVSDK_SERVER_VERSION index 1e8349cd..b0c3c5ce 100644 --- a/MAVSDK_SERVER_VERSION +++ b/MAVSDK_SERVER_VERSION @@ -1 +1 @@ -v2.10.2 +v2.11.0 diff --git a/setup.py b/setup.py index ff704d3f..4c89e030 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ import urllib.request import os import stat -import sys +import platform import subprocess @@ -52,7 +52,7 @@ def platform_suffix(self): """ Trying to detect the platform to know which `mavsdk_server` executable to download """ - if sys.platform.startswith('linux') and 'MAVSDK_SERVER_ARCH' in os.environ: + if platform.system() == 'Linux' and 'MAVSDK_SERVER_ARCH' in os.environ: if os.environ['MAVSDK_SERVER_ARCH'] == "armv6l": return 'linux-armv6-musl' elif os.environ['MAVSDK_SERVER_ARCH'] == "armv7l": @@ -62,15 +62,20 @@ def platform_suffix(self): else: raise NotImplementedError( f"Error: unknown MAVSDK_SERVER_ARCH: {os.environ['MAVSDK_SERVER_ARCH']}") - elif sys.platform.startswith('linux'): + elif platform.platform() == 'Linux': return 'musl_x86_64' - elif sys.platform.startswith('darwin'): - return 'macos' - elif sys.platform.startswith('win'): + elif platform.system() == 'Darwin': + if platform.processor() == 'i386': + return 'macos_x64' + elif platform.processor() == 'arm': + return 'macos_arm64' + raise NotImplementedError( + f"Error: unknown macOS processor: {platform.processor()}") + elif platform.system() == 'Windows' and platform.processor() == 'AMD64':: return 'win32.exe' else: raise NotImplementedError( - f"Error: mavsdk_server is not distributed for platform {sys.platform} (yet)! You should set the 'MAVSDK_BUILD_PURE=ON' environment variable and get mavsdk_server manually.") + f"Error: mavsdk_server is not distributed for platform {platform.system()} with {platform.processor()} (yet)!\n\nYou should set the 'MAVSDK_BUILD_PURE=ON' environment variable and get mavsdk_server manually.") @property def mavsdk_server_filepath(self): @@ -78,7 +83,7 @@ def mavsdk_server_filepath(self): The location of the downloaded `mavsdk_server` binary For Windows this needs to be a .exe file """ - if sys.platform.startswith('win'): + if platform.system() == 'Windows': return 'mavsdk/bin/mavsdk_server.exe' else: return 'mavsdk/bin/mavsdk_server'