Skip to content

Commit 828268c

Browse files
authored
[v5] Wheel build fixes: manylinux1, trigger upload on release, Linux AArch64 (#2443)
* Enable verbose twine upload. * Add step to show downloaded artifacts for debugging. * Sync with next * Sync with next.
1 parent 041ec63 commit 828268c

File tree

3 files changed

+22
-14
lines changed

3 files changed

+22
-14
lines changed

Diff for: .github/workflows/python-publish-release.yml

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

3-
on: [push, pull_request, 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 }}

Diff for: bindings/python/setup.py

+12-10
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22

33
import glob
44
import os
@@ -135,6 +135,7 @@ def build_libraries():
135135
os.chdir(BUILD_DIR)
136136

137137
# platform description refers at https://docs.python.org/3/library/sys.html#sys.platform
138+
# Use cmake for both Darwin and Windows since it can generate fat binaries
138139
if SYSTEM == "win32" or SYSTEM == 'darwin':
139140
# Windows build: this process requires few things:
140141
# - CMake + MSVC installed
@@ -203,18 +204,19 @@ def run(self):
203204
print("Proper 'develop' support unavailable.")
204205

205206
if 'bdist_wheel' in sys.argv and '--plat-name' not in sys.argv:
207+
# Inject the platform identifier into argv.
208+
# Platform tags are described here:
209+
# https://packaging.python.org/en/latest/specifications/platform-compatibility-tags
210+
#
211+
# I couldn't really find out in time why we need to inject the platform here?
212+
# The cibuildwheel doesn't need it for the Windows job. But for Mac and Linux.
213+
# This here is very dirty and will maybe break in the future.
214+
# Sorry if this is the case and you read this.
215+
# See: https://github.com/capstone-engine/capstone/issues/2445
206216
idx = sys.argv.index('bdist_wheel') + 1
207217
sys.argv.insert(idx, '--plat-name')
208218
name = get_platform()
209-
if 'linux' in name:
210-
# linux_* platform tags are disallowed because the python ecosystem is fubar
211-
# linux builds should be built in the centos 5 vm for maximum compatibility
212-
# see https://github.com/pypa/manylinux
213-
# see also https://github.com/angr/angr-dev/blob/master/bdist.sh
214-
sys.argv.insert(idx + 1, 'manylinux1_' + platform.machine())
215-
else:
216-
# https://www.python.org/dev/peps/pep-0425/
217-
sys.argv.insert(idx + 1, name.replace('.', '_').replace('-', '_'))
219+
sys.argv.insert(idx + 1, name.replace('.', '_').replace('-', '_'))
218220

219221
setup(
220222
provides=['capstone'],

Diff for: suite/check_wheel_bin_arch.py

+2-1
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)