Skip to content
Snippets Groups Projects
Commit b8ce13f1 authored by AlQuemist's avatar AlQuemist Committed by Ammar Nejati
Browse files

my_pypack_linux.sh: repair the Python wheel on Linux (PEP 599)

Linux wheels must be converted further to 'manylinux' wheels, before uploading
to PyPI repository.

* See "PEP 599 - The manylinux2014 Platform Tag" <https://peps.python.org/pep-0599>
* See <https://stackoverflow.com/q/46599004>
parent a6838a6e
No related branches found
No related tags found
1 merge request!1698Python script to build installers and wheels for all platforms and Python versions
......@@ -129,5 +129,35 @@ done
echo "$TITLE: Making the Python wheel..."
$PYTHON -m pip wheel "$pyoutdir" --no-deps --wheel "$wheeldir"
#-- repair the Python wheel via auditwheel
# NOTE:
# Linux wheels must be converted further to 'manylinux' wheels, before uploading
# to PyPI repository.
# See "PEP 599 - The manylinux2014 Platform Tag" <https://peps.python.org/pep-0599>
# See <https://stackoverflow.com/q/46599004>
# NOTE:
# The output of auditwheel (as of v5.3.0) is like:
# ```
# SomeWheel.whl is consistent with the
# following platform tag: "linux_x86_64".
# ...
# This constrains the platform tag to "manylinux_2_35_x86_64". In order
# to achieve a more compatible tag, you would need to recompile a new
# wheel from source on a system with earlier versions of these
# ```
# The platform tag must be retrieved from this text.
# path to the produced wheel
wheelname=$(ls $wheeldir)
wheelpath="$wheeldir/$wheelname"
echo "$TITLE: repairing wheel '${wheelpath}' via auditwheel..."
# regex to extract the platform tag; eg.,
# 'constrains the platform tag to "manylinux_2_35_x86_64"' => 'manylinux_2_35_x86_64'
platform_tag=$($PYTHON -m auditwheel show "$wheelpath" | sed -nE 's/.+constrains the platform tag to "(.+)".+/\1/p')
echo "$TITLE: platform tag for '${wheelpath}' = '${platform_tag}'"
# repair the wheel
$PYTHON -m auditwheel repair --plat "${platform_tag}" --wheel-dir "${wheeldir}/manylinux/" "${wheelpath}"
# final message
echo "$TITLE: Done."
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment