Skip to content

Commit 42d3acf

Browse files
authored
[next] Wheel build fixes: manylinux1, trigger upload on release, Linux AArch64... (#2444)
* Add AArch64 linux build again. * Enable package build also for PRs and pushes. * Fix: don't append python version to injected platform name. * Add musllinux build to wheel checking script * Trigger wheel upload only on published full-releases. * Remove duplicate workflow file * Ensure all artifacts are moved to the same directory 'dist' * Enable verbose twine upload. * Add step to show downloaded artifacts for debugging.
1 parent 7149ec8 commit 42d3acf

File tree

4 files changed

+20
-92
lines changed

4 files changed

+20
-92
lines changed

.github/workflows/python-publish-release.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: RELEASE BUILD - PyPI 📦 Distribution
22

3-
on: [release, workflow_dispatch]
3+
on: [push, pull_request, release, workflow_dispatch]
44

55
jobs:
66
build_wheels:
@@ -26,7 +26,7 @@ jobs:
2626
uses: pypa/[email protected]
2727
env:
2828
CIBW_ARCHS_MACOS: "x86_64 universal2 arm64"
29-
CIBW_ARCHS_LINUX: "x86_64 i686" # ppc64le s390x really slow
29+
CIBW_ARCHS_LINUX: "x86_64 i686 aarch64" # ppc64le s390x really slow
3030
CIBW_ARCHS_WINDOWS: "AMD64" # ARM64 Seems ARM64 will rebuild amd64 wheel for unknow reason.
3131
CIBW_BUILD: "cp38-* cp39-* cp310-* cp311-* cp312-*"
3232
CIBW_SKIP: ""
@@ -69,17 +69,22 @@ jobs:
6969
publish:
7070
needs: [build_wheels]
7171
runs-on: ubuntu-latest
72-
if: startsWith(github.ref, 'refs/tags')
72+
if: github.event_name == 'release' && github.event.prerelease == false && github.event.action == 'published'
7373
permissions:
7474
id-token: write
7575
steps:
7676
- uses: actions/download-artifact@v4
7777
with:
78+
merge-multiple: true
7879
path: dist
7980

81+
- name: Show downloaded artifacts
82+
run: ls -laR dist
83+
8084
- name: Publish distribution 📦 to PyPI
8185
if: ${{ success() }}
8286
uses: pypa/gh-action-pypi-publish@release/v1
8387
with:
88+
verbose: true
8489
user: __token__
8590
password: ${{ secrets.pypi_pass }}

.github/workflows/python-publish.yml

Lines changed: 0 additions & 85 deletions
This file was deleted.

bindings/python/setup.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,12 +203,19 @@ def run(self):
203203
print("Proper 'develop' support unavailable.")
204204

205205
if 'bdist_wheel' in sys.argv and '--plat-name' not in sys.argv:
206+
# Inject the platform identifier into argv.
207+
# Platform tags are described here:
208+
# https://packaging.python.org/en/latest/specifications/platform-compatibility-tags
209+
#
210+
# I couldn't really find out in time why we need to inject the platform here?
211+
# The cibuildwheel doesn't need it for the Windows job. But for Mac and Linux.
212+
# This here is very dirty and will maybe break in the future.
213+
# Sorry if this is the case and you read this.
214+
# See: https://github.com/capstone-engine/capstone/issues/2445
206215
idx = sys.argv.index('bdist_wheel') + 1
207216
sys.argv.insert(idx, '--plat-name')
208217
name = get_platform()
209-
pyversion = platform.python_version()
210-
major_version, minor_version = map(int, pyversion.split('.')[:2])
211-
sys.argv.insert(idx + 1, name.replace('.', '_').replace('-', '_') + "_" + str(major_version) + str(minor_version))
218+
sys.argv.insert(idx + 1, name.replace('.', '_').replace('-', '_'))
212219

213220
setup(
214221
provides=['capstone'],

suite/check_wheel_bin_arch.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
filename = {
3434
"macosx": "libcapstone.dylib",
3535
"manylinux": "libcapstone.so",
36+
"musllinux": "libcapstone.so",
3637
"win": "capstone.dll",
3738
}
3839

@@ -45,7 +46,7 @@
4546
continue
4647
wheel_seen = True
4748
target = re.search(r"py3-none-(.+).whl", f"{f}").group(1)
48-
platform = re.search("^(win|manylinux|macosx)", target).group(1)
49+
platform = re.search("^(win|manylinux|musllinux|macosx)", target).group(1)
4950

5051
arch = re.search(
5152
"(universal2|x86_64|arm64|aarch64|i686|win32|amd64)$", target

0 commit comments

Comments
 (0)