Skip to content

Commit

Permalink
Sync with next.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rot127 committed Aug 19, 2024
1 parent d33c523 commit 39b8776
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
22 changes: 12 additions & 10 deletions bindings/python/setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

import glob
import os
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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'],
Expand Down
3 changes: 2 additions & 1 deletion suite/check_wheel_bin_arch.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
filename = {
"macosx": "libcapstone.dylib",
"manylinux": "libcapstone.so",
"musllinux": "libcapstone.so",
"win": "capstone.dll",
}

Expand All @@ -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
Expand Down

0 comments on commit 39b8776

Please sign in to comment.