Skip to content

Commit

Permalink
Fix: don't append python version to injected platform name.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rot127 committed Aug 16, 2024
1 parent 165c471 commit 4a957fc
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions bindings/python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,12 +203,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()
pyversion = platform.python_version()
major_version, minor_version = map(int, pyversion.split('.')[:2])
sys.argv.insert(idx + 1, name.replace('.', '_').replace('-', '_') + "_" + str(major_version) + str(minor_version))
sys.argv.insert(idx + 1, name.replace('.', '_').replace('-', '_'))

setup(
provides=['capstone'],
Expand Down

0 comments on commit 4a957fc

Please sign in to comment.