Debian Codegraph @

contrib/packaging/build-linux-wheels.sh

raw
1 #!/bin/bash
2
3 # Intended to run within docker using image:
4 #
5 # registry.heptapod.net/mercurial/ci-images/core-wheel-x86_64-c:v3.0
6 #
7 # we might want to factor most of this with the associated mercurial-core CI
8 # definition. (i.e. move this script into a place where the CI can directly call it for its purpose)
9
10 set -e -x
11
12 PYTHON_TARGETS="cp39-cp39 cp310-cp310 cp311-cp311 cp312-cp312 cp313-cp313 cp314-cp314"
13
14 # We need to copy the repository to ensure:
15 # (1) we don't wrongly write roots files in the repository (or any other wrong
16 # users)
17 # (2) we don't reuse pre-compiled extension built outside for manylinux and
18 # therefor not compatible.
19 cp -r /src/ /tmp/src/
20 cd /tmp/src/
21 # clear potentially cached artifact from the host
22 # (we could narrow this purge probably)
23 hg purge \
24 --ignored \
25 --no-confirm
26
27
28 if [ ! -e /src/dist/ ]; then
29 mkdir -p /src/dist
30 chown `stat /src/ -c %u:%g` /src/dist/
31 fi
32
33 for py in $PYTHON_TARGETS; do
34 echo 'build wheel for' $py
35 # cleanup any previous wheel
36 tmp_wd="/tmp/wheels/$py/repaired"
37 rm -rf $tmp_wd
38 mkdir -p $tmp_wd
39 # build a new wheel
40 contrib/build-one-linux-wheel.sh $py $tmp_wd
41 # fix the owner back to the repository owner
42 chown `stat /src/ -c %u:%g` $tmp_wd/*.whl
43 mv $tmp_wd/*.whl /src/dist/
44 done
45