Skip to content

Commit 2b42453

Browse files
committed
Update to MAVSDK v2.11.0
This should bring native support for macOS on ARM (M1).
1 parent 789eaf1 commit 2b42453

File tree

3 files changed

+38
-17
lines changed

3 files changed

+38
-17
lines changed

.github/workflows/main.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,17 @@ jobs:
130130
twine upload dist/*.whl
131131
132132
macOS:
133-
name: macOS
134-
runs-on: macos-12
133+
name: macOS ${{ matrix.arch }}
134+
runs-on: ${{ matrix.runs_on }}
135+
strategy:
136+
matrix:
137+
include:
138+
- arch: x64
139+
wheel_arch: 10_9_x86_64
140+
runs_on: macos-13
141+
- arch: arm64
142+
wheel_arch: 11_0_arm64
143+
runs_on: macos-14
135144
steps:
136145
- uses: actions/checkout@v1
137146
with:
@@ -158,9 +167,8 @@ jobs:
158167
run: |
159168
python setup.py bdist_wheel
160169
export PATH="$(python -m site --user-base)/bin:$PATH"
161-
echo "PATH: $PATH"
162170
delocate-wheel -w wheelhouse -v dist/*.whl
163-
ls wheelhouse/*any.whl | sed -e 'p;s/any/macosx_10_9_x86_64/' | xargs -n2 mv
171+
ls wheelhouse/*any.whl | sed -e 'p;s/any/macosx_${{ matrix.wheel_arch }}/' | xargs -n2 mv
164172
165173
- name: Check the artifacts
166174
run: |

MAVSDK_SERVER_VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v2.10.2
1+
v2.11.0

setup.py

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import urllib.request
88
import os
99
import stat
10-
import sys
10+
import platform
1111
import subprocess
1212

1313

@@ -50,9 +50,10 @@ class custom_build(build):
5050
@property
5151
def platform_suffix(self):
5252
"""
53-
Trying to detect the platform to know which `mavsdk_server` executable to download
53+
Trying to detect the platform to know which `mavsdk_server` executable
54+
to download
5455
"""
55-
if sys.platform.startswith('linux') and 'MAVSDK_SERVER_ARCH' in os.environ:
56+
if platform.system() == 'Linux' and 'MAVSDK_SERVER_ARCH' in os.environ:
5657
if os.environ['MAVSDK_SERVER_ARCH'] == "armv6l":
5758
return 'linux-armv6-musl'
5859
elif os.environ['MAVSDK_SERVER_ARCH'] == "armv7l":
@@ -61,24 +62,34 @@ def platform_suffix(self):
6162
return 'linux-arm64-musl'
6263
else:
6364
raise NotImplementedError(
64-
f"Error: unknown MAVSDK_SERVER_ARCH: {os.environ['MAVSDK_SERVER_ARCH']}")
65-
elif sys.platform.startswith('linux'):
65+
"Error: unknown MAVSDK_SERVER_ARCH: "
66+
f"{os.environ['MAVSDK_SERVER_ARCH']}")
67+
elif platform.system() == 'Linux':
6668
return 'musl_x86_64'
67-
elif sys.platform.startswith('darwin'):
68-
return 'macos'
69-
elif sys.platform.startswith('win'):
69+
elif platform.system() == 'Darwin':
70+
if platform.processor() == 'i386':
71+
return 'macos_x64'
72+
elif platform.processor() == 'arm':
73+
return 'macos_arm64'
74+
raise NotImplementedError(
75+
f"Error: unknown macOS processor: {platform.processor()}")
76+
elif platform.system() == 'Windows' \
77+
and platform.processor() == 'AMD64':
7078
return 'win32.exe'
7179
else:
7280
raise NotImplementedError(
73-
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.")
81+
"Error: mavsdk_server is not distributed for platform "
82+
f"{platform.system()} (yet)!\n\nYou should set the "
83+
"'MAVSDK_BUILD_PURE=ON' environment variable and get "
84+
"mavsdk_server manually.")
7485

7586
@property
7687
def mavsdk_server_filepath(self):
7788
"""
7889
The location of the downloaded `mavsdk_server` binary
7990
For Windows this needs to be a .exe file
8091
"""
81-
if sys.platform.startswith('win'):
92+
if platform.system() == 'Windows':
8293
return 'mavsdk/bin/mavsdk_server.exe'
8394
else:
8495
return 'mavsdk/bin/mavsdk_server'
@@ -97,7 +108,8 @@ def mavsdk_server_url(self):
97108
"""
98109
Build the url of the `mavsdk_server` binary
99110
"""
100-
return f"https://github.com/mavlink/MAVSDK/releases/download/{self.mavsdk_server_tag}/mavsdk_server_{self.platform_suffix}"
111+
return "https://github.com/mavlink/MAVSDK/releases/download/" \
112+
f"{self.mavsdk_server_tag}/mavsdk_server_{self.platform_suffix}"
101113

102114
def run(self):
103115
if 'MAVSDK_BUILD_PURE' not in os.environ:
@@ -107,7 +119,8 @@ def run(self):
107119

108120
def download_mavsdk_server(self):
109121
print(
110-
f"downloading {self.mavsdk_server_url} into {self.mavsdk_server_filepath}")
122+
f"downloading {self.mavsdk_server_url} into "
123+
f"{self.mavsdk_server_filepath}")
111124
urllib.request.urlretrieve(
112125
self.mavsdk_server_url,
113126
filename=self.mavsdk_server_filepath)

0 commit comments

Comments
 (0)