From e9da358b9c10f443aae4b79fc6cd13d6ed927e0b Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Fri, 19 Aug 2022 18:14:03 +0200 Subject: [PATCH 1/3] 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. --- download-wasmtime.py | 2 ++ wasmtime/_ffi.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/download-wasmtime.py b/download-wasmtime.py index ea60a217..c5131241 100644 --- a/download-wasmtime.py +++ b/download-wasmtime.py @@ -17,6 +17,8 @@ def main(platform, arch): version = fh.read().strip() if arch == 'AMD64': arch = 'x86_64' + if arch == 'arm64': + arch = 'aarch64' if platform == 'linux': filename = 'wasmtime-v{}-{}-linux-c-api.tar.xz'.format(version, arch) libname = '_libwasmtime.so' diff --git a/wasmtime/_ffi.py b/wasmtime/_ffi.py index 90cf7c77..736c3ca9 100644 --- a/wasmtime/_ffi.py +++ b/wasmtime/_ffi.py @@ -21,6 +21,8 @@ machine = platform.machine() if machine == 'AMD64': machine = 'x86_64' +if machine == 'arm64': + machine = 'aarch64' if machine != 'x86_64' and machine != 'aarch64': raise RuntimeError("unsupported architecture for wasmtime: {}".format(machine)) From 830597caed07d41a4943a578d5c020cfca29783d Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Fri, 19 Aug 2022 18:14:50 +0200 Subject: [PATCH 2/3] ci: build wheels for macOS arm64 --- .github/workflows/main.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7cfe2b79..9987bd26 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -60,6 +60,10 @@ jobs: git clean -fdx wasmtime build python download-wasmtime.py darwin x86_64 python setup.py bdist_wheel --plat-name macosx-10-13-x86_64 + - run: | + git clean -fdx wasmtime build + python download-wasmtime.py darwin arm64 + python setup.py bdist_wheel --plat-name macosx-11-0-arm64 - run: | git clean -fdx wasmtime build python download-wasmtime.py win32 x86_64 From 3c46e7dfee41e82d3354ad1aed560bb448900de1 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Fri, 19 Aug 2022 18:39:46 +0200 Subject: [PATCH 3/3] 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. --- setup.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/setup.py b/setup.py index 5e370ff6..1426e528 100644 --- a/setup.py +++ b/setup.py @@ -39,6 +39,9 @@ extras_require={ 'testing': [ 'coverage', + # remove flake8 once https://github.com/tholo/pytest-flake8/issues/87 is fixed + # and the new version of pytest-flake8 is released + 'flake8==4.0.1', 'pytest', 'pycparser', 'pytest-flake8',