From d8086e0442843430f9b63fa58ff1d7afdbabeecb Mon Sep 17 00:00:00 2001 From: Rot127 Date: Mon, 19 Aug 2024 00:33:17 -0500 Subject: [PATCH 1/4] Enable verbose twine upload. --- .github/workflows/python-publish-release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/python-publish-release.yml b/.github/workflows/python-publish-release.yml index 4d2da07f2d..a70028cae5 100644 --- a/.github/workflows/python-publish-release.yml +++ b/.github/workflows/python-publish-release.yml @@ -81,5 +81,6 @@ jobs: if: ${{ success() }} uses: pypa/gh-action-pypi-publish@release/v1 with: + verbose: true user: __token__ password: ${{ secrets.pypi_pass }} From 6ff8ed5773678e883184765a128f1f7d948a5dc9 Mon Sep 17 00:00:00 2001 From: Rot127 Date: Mon, 19 Aug 2024 01:03:29 -0500 Subject: [PATCH 2/4] Add step to show downloaded artifacts for debugging. --- .github/workflows/python-publish-release.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/python-publish-release.yml b/.github/workflows/python-publish-release.yml index a70028cae5..0b6f70e4c8 100644 --- a/.github/workflows/python-publish-release.yml +++ b/.github/workflows/python-publish-release.yml @@ -77,6 +77,9 @@ jobs: with: path: dist + - name: Show downloaded artifacts + run: ls -laR dist + - name: Publish distribution 📦 to PyPI if: ${{ success() }} uses: pypa/gh-action-pypi-publish@release/v1 From d33c5233deee89d96026617bad72e4d38a2b6366 Mon Sep 17 00:00:00 2001 From: Rot127 Date: Mon, 19 Aug 2024 01:29:52 -0500 Subject: [PATCH 3/4] Sync with next --- .github/workflows/python-publish-release.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/python-publish-release.yml b/.github/workflows/python-publish-release.yml index 0b6f70e4c8..ebf0a2a386 100644 --- a/.github/workflows/python-publish-release.yml +++ b/.github/workflows/python-publish-release.yml @@ -1,6 +1,6 @@ name: RELEASE BUILD - PyPI 📦 Distribution -on: [push, pull_request, workflow_dispatch] +on: [push, pull_request, release, workflow_dispatch] jobs: build_wheels: @@ -26,7 +26,7 @@ jobs: uses: pypa/cibuildwheel@v2.20.0 env: CIBW_ARCHS_MACOS: "x86_64 universal2 arm64" - CIBW_ARCHS_LINUX: "x86_64 i686" # ppc64le s390x really slow + CIBW_ARCHS_LINUX: "x86_64 i686 aarch64" # ppc64le s390x really slow CIBW_ARCHS_WINDOWS: "AMD64" # ARM64 Seems ARM64 will rebuild amd64 wheel for unknow reason. CIBW_BUILD: "cp38-* cp39-* cp310-* cp311-* cp312-*" CIBW_SKIP: "" @@ -69,12 +69,13 @@ jobs: publish: needs: [build_wheels] runs-on: ubuntu-latest - if: startsWith(github.ref, 'refs/tags') + if: github.event_name == 'release' && github.event.prerelease == false && github.event.action == 'published' permissions: id-token: write steps: - uses: actions/download-artifact@v4 with: + merge-multiple: true path: dist - name: Show downloaded artifacts From 39b87767502965e0a25e5406a0bf4e103b1395e0 Mon Sep 17 00:00:00 2001 From: Rot127 Date: Mon, 19 Aug 2024 02:00:05 -0500 Subject: [PATCH 4/4] Sync with next. --- bindings/python/setup.py | 22 ++++++++++++---------- suite/check_wheel_bin_arch.py | 3 ++- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/bindings/python/setup.py b/bindings/python/setup.py index 1b285a21d4..a5cb08c8be 100755 --- a/bindings/python/setup.py +++ b/bindings/python/setup.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import glob import os @@ -135,6 +135,7 @@ def build_libraries(): os.chdir(BUILD_DIR) # platform description refers at https://docs.python.org/3/library/sys.html#sys.platform + # Use cmake for both Darwin and Windows since it can generate fat binaries if SYSTEM == "win32" or SYSTEM == 'darwin': # Windows build: this process requires few things: # - CMake + MSVC installed @@ -203,18 +204,19 @@ def run(self): print("Proper 'develop' support unavailable.") if 'bdist_wheel' in sys.argv and '--plat-name' not in sys.argv: + # Inject the platform identifier into argv. + # Platform tags are described here: + # https://packaging.python.org/en/latest/specifications/platform-compatibility-tags + # + # I couldn't really find out in time why we need to inject the platform here? + # The cibuildwheel doesn't need it for the Windows job. But for Mac and Linux. + # This here is very dirty and will maybe break in the future. + # Sorry if this is the case and you read this. + # See: https://github.com/capstone-engine/capstone/issues/2445 idx = sys.argv.index('bdist_wheel') + 1 sys.argv.insert(idx, '--plat-name') name = get_platform() - if 'linux' in name: - # linux_* platform tags are disallowed because the python ecosystem is fubar - # linux builds should be built in the centos 5 vm for maximum compatibility - # see https://github.com/pypa/manylinux - # see also https://github.com/angr/angr-dev/blob/master/bdist.sh - sys.argv.insert(idx + 1, 'manylinux1_' + platform.machine()) - else: - # https://www.python.org/dev/peps/pep-0425/ - sys.argv.insert(idx + 1, name.replace('.', '_').replace('-', '_')) + sys.argv.insert(idx + 1, name.replace('.', '_').replace('-', '_')) setup( provides=['capstone'], diff --git a/suite/check_wheel_bin_arch.py b/suite/check_wheel_bin_arch.py index a805d84ad2..22a1db5a11 100755 --- a/suite/check_wheel_bin_arch.py +++ b/suite/check_wheel_bin_arch.py @@ -33,6 +33,7 @@ filename = { "macosx": "libcapstone.dylib", "manylinux": "libcapstone.so", + "musllinux": "libcapstone.so", "win": "capstone.dll", } @@ -45,7 +46,7 @@ continue wheel_seen = True target = re.search(r"py3-none-(.+).whl", f"{f}").group(1) - platform = re.search("^(win|manylinux|macosx)", target).group(1) + platform = re.search("^(win|manylinux|musllinux|macosx)", target).group(1) arch = re.search( "(universal2|x86_64|arm64|aarch64|i686|win32|amd64)$", target