Skip to content

Commit 0c6cf99

Browse files
authored
add support for macOS arm64, build wheels (#92)
* handle platform.machine() == arm64 for macOS Upstream wasmtime releases use aarch64-macos as part of the file name. On aarch64 macOS, platform.machine() returns 'arm64' instead. With this change, download-wasmtime.py correctly downloads aarch64-macos binaries and _ffi.py correctly loads them. * ci: build wheels for macOS arm64 * setup.py: pin flake8 due to an incompatibility with pytest-flake8 pytest-flake8 is currently incompatible with 5.x flake8 releases. This downgrades flake8 to an older version which still works.
1 parent 8702823 commit 0c6cf99

File tree

4 files changed

+11
-0
lines changed

4 files changed

+11
-0
lines changed

.github/workflows/main.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ jobs:
6060
git clean -fdx wasmtime build
6161
python download-wasmtime.py darwin x86_64
6262
python setup.py bdist_wheel --plat-name macosx-10-13-x86_64
63+
- run: |
64+
git clean -fdx wasmtime build
65+
python download-wasmtime.py darwin arm64
66+
python setup.py bdist_wheel --plat-name macosx-11-0-arm64
6367
- run: |
6468
git clean -fdx wasmtime build
6569
python download-wasmtime.py win32 x86_64

download-wasmtime.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ def main(platform, arch):
1717
version = fh.read().strip()
1818
if arch == 'AMD64':
1919
arch = 'x86_64'
20+
if arch == 'arm64':
21+
arch = 'aarch64'
2022
if platform == 'linux':
2123
filename = 'wasmtime-v{}-{}-linux-c-api.tar.xz'.format(version, arch)
2224
libname = '_libwasmtime.so'

setup.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@
3939
extras_require={
4040
'testing': [
4141
'coverage',
42+
# remove flake8 once https://github.com/tholo/pytest-flake8/issues/87 is fixed
43+
# and the new version of pytest-flake8 is released
44+
'flake8==4.0.1',
4245
'pytest',
4346
'pycparser',
4447
'pytest-flake8',

wasmtime/_ffi.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
machine = platform.machine()
2222
if machine == 'AMD64':
2323
machine = 'x86_64'
24+
if machine == 'arm64':
25+
machine = 'aarch64'
2426
if machine != 'x86_64' and machine != 'aarch64':
2527
raise RuntimeError("unsupported architecture for wasmtime: {}".format(machine))
2628

0 commit comments

Comments
 (0)