annotate contrib/build-one-linux-wheel.sh @ 52243:4d825ad10840 stable

wheels: factor the core of Linux wheel building into a script This will make it easy to reuse in the release process while making sure we build the wheel the same way as in the CI.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 13 Nov 2024 04:20:54 +0100
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
52243
4d825ad10840 wheels: factor the core of Linux wheel building into a script
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
1 #!/bin/bash
4d825ad10840 wheels: factor the core of Linux wheel building into a script
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
2 # build a single linux wheel within a prepared imaged based on manylinux images
4d825ad10840 wheels: factor the core of Linux wheel building into a script
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
3 #
4d825ad10840 wheels: factor the core of Linux wheel building into a script
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
4 #
4d825ad10840 wheels: factor the core of Linux wheel building into a script
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
5 #
4d825ad10840 wheels: factor the core of Linux wheel building into a script
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
6 set -eu
4d825ad10840 wheels: factor the core of Linux wheel building into a script
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
7
4d825ad10840 wheels: factor the core of Linux wheel building into a script
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
8 # enforce that the translation are built
4d825ad10840 wheels: factor the core of Linux wheel building into a script
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
9 export MERCURIAL_SETUP_FORCE_TRANSLATIONS=1
4d825ad10840 wheels: factor the core of Linux wheel building into a script
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
10
4d825ad10840 wheels: factor the core of Linux wheel building into a script
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
11 if [ $# -lt 2 ]; then
4d825ad10840 wheels: factor the core of Linux wheel building into a script
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
12 echo "usage $0 PYTHONTAG DEST_DIR" >&2
4d825ad10840 wheels: factor the core of Linux wheel building into a script
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
13 echo "" >&2
4d825ad10840 wheels: factor the core of Linux wheel building into a script
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
14 echo 'PYTHONTAG should be of the form "cp310-cp310"' >&2
4d825ad10840 wheels: factor the core of Linux wheel building into a script
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
15 exit 64
4d825ad10840 wheels: factor the core of Linux wheel building into a script
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
16 fi
4d825ad10840 wheels: factor the core of Linux wheel building into a script
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
17 py_tag=$1
4d825ad10840 wheels: factor the core of Linux wheel building into a script
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
18 destination_directory=$2
4d825ad10840 wheels: factor the core of Linux wheel building into a script
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
19
4d825ad10840 wheels: factor the core of Linux wheel building into a script
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
20
4d825ad10840 wheels: factor the core of Linux wheel building into a script
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
21 tmp_wheel_dir=./tmp-wheelhouse
4d825ad10840 wheels: factor the core of Linux wheel building into a script
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
22
4d825ad10840 wheels: factor the core of Linux wheel building into a script
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
23 if [ -e $tmp_wheel_dir ]; then
4d825ad10840 wheels: factor the core of Linux wheel building into a script
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
24 rm -rf $tmp_wheel_dir
4d825ad10840 wheels: factor the core of Linux wheel building into a script
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
25 fi
4d825ad10840 wheels: factor the core of Linux wheel building into a script
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
26 /opt/python/$py_tag/bin/python setup.py bdist_wheel --dist-dir $tmp_wheel_dir
4d825ad10840 wheels: factor the core of Linux wheel building into a script
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
27 # adjust it to make it universal
4d825ad10840 wheels: factor the core of Linux wheel building into a script
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
28 auditwheel repair $tmp_wheel_dir/*.whl -w $destination_directory