Skip to content

Commit

Permalink
Merge pull request #705 from mavlink/pr-v2.11.0
Browse files Browse the repository at this point in the history
Update to MAVSDK v2.11.0
  • Loading branch information
julianoes authored Jun 2, 2024
2 parents 789eaf1 + e3ea841 commit 348982b
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 17 deletions.
16 changes: 12 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,17 @@ jobs:
twine upload dist/*.whl
macOS:
name: macOS
runs-on: macos-12
name: macOS ${{ matrix.arch }}
runs-on: ${{ matrix.runs_on }}
strategy:
matrix:
include:
- arch: x64
wheel_arch: 10_9_x86_64
runs_on: macos-13
- arch: arm64
wheel_arch: 11_0_arm64
runs_on: macos-14
steps:
- uses: actions/checkout@v1
with:
Expand All @@ -158,9 +167,8 @@ jobs:
run: |
python setup.py bdist_wheel
export PATH="$(python -m site --user-base)/bin:$PATH"
echo "PATH: $PATH"
delocate-wheel -w wheelhouse -v dist/*.whl
ls wheelhouse/*any.whl | sed -e 'p;s/any/macosx_10_9_x86_64/' | xargs -n2 mv
ls wheelhouse/*any.whl | sed -e 'p;s/any/macosx_${{ matrix.wheel_arch }}/' | xargs -n2 mv
- name: Check the artifacts
run: |
Expand Down
2 changes: 1 addition & 1 deletion MAVSDK_SERVER_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v2.10.2
v2.11.0
37 changes: 25 additions & 12 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import urllib.request
import os
import stat
import sys
import platform
import subprocess


Expand Down Expand Up @@ -50,9 +50,10 @@ class custom_build(build):
@property
def platform_suffix(self):
"""
Trying to detect the platform to know which `mavsdk_server` executable to download
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":
Expand All @@ -61,24 +62,34 @@ def platform_suffix(self):
return 'linux-arm64-musl'
else:
raise NotImplementedError(
f"Error: unknown MAVSDK_SERVER_ARCH: {os.environ['MAVSDK_SERVER_ARCH']}")
elif sys.platform.startswith('linux'):
"Error: unknown MAVSDK_SERVER_ARCH: "
f"{os.environ['MAVSDK_SERVER_ARCH']}")
elif platform.system() == '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().startswith('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.")
"Error: mavsdk_server is not distributed for platform "
f"{platform.system()} ({platform.processor()}) (yet)!\n\n"
"You should set the 'MAVSDK_BUILD_PURE=ON' environment "
"variable and get mavsdk_server manually.")

@property
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'
Expand All @@ -97,7 +108,8 @@ def mavsdk_server_url(self):
"""
Build the url of the `mavsdk_server` binary
"""
return f"https://github.com/mavlink/MAVSDK/releases/download/{self.mavsdk_server_tag}/mavsdk_server_{self.platform_suffix}"
return "https://github.com/mavlink/MAVSDK/releases/download/" \
f"{self.mavsdk_server_tag}/mavsdk_server_{self.platform_suffix}"

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

def download_mavsdk_server(self):
print(
f"downloading {self.mavsdk_server_url} into {self.mavsdk_server_filepath}")
f"downloading {self.mavsdk_server_url} into "
f"{self.mavsdk_server_filepath}")
urllib.request.urlretrieve(
self.mavsdk_server_url,
filename=self.mavsdk_server_filepath)
Expand Down

0 comments on commit 348982b

Please sign in to comment.