-
Notifications
You must be signed in to change notification settings - Fork 0
/
ruamel.yaml.clib.sh
34 lines (26 loc) · 1.49 KB
/
ruamel.yaml.clib.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#/bin/bash
# Prerequesites
# sudo python3 -m pip install -U build cibuildwheel PyYAML requests
# sudo apt install -y jq wget curl
# Variables
export PKGNAME="ruamel.yaml.clib"
export PKGVER=$(grep "${PKGNAME}" requirements.txt | cut -d '=' -f 3 | tr -d '\012\015')
export PKGURL=$(curl -s "https://pypi.org/pypi/${PKGNAME}/${PKGVER}/json" | jq -r '.urls[].url' | grep .tar.gz)
export CIBW_BEFORE_ALL='apk add -Uu pkgconfig gcc musl-dev && pip install -U pkgconfig pip setuptools wheel'
export CIBW_ARCHS_LINUX='x86_64 aarch64'
export CIBW_BUILD='cp312-musllinux_*'
# Load Multiarch settings
# docker run --rm --privileged tonistiigi/binfmt
# docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
# Create directories
mkdir -p sdist wheelhouse
# Download
wget -c $PKGURL -q -O - | tar -xz -C ./sdist/
# Build
cibuildwheel --platform linux --output-dir wheelhouse sdist/$PKGNAME-$PKGVER
# Remove working files
rm -rf ./sdist/$PKGNAME*
# Remove leftover Docker images
docker inspect --type=image tonistiigi/binfmt >/dev/null 2>&1 && docker rmi tonistiigi/binfmt || echo 'binfmt image does not exist. Will not delete.'
docker inspect --type=image quay.io/pypa/musllinux_1_1_x86_64 >/dev/null 2>&1 && docker rmi multiarch/qemu-user-static || echo 'qemu-user-static image does not exist. Will not delete.'
docker images | grep quay.io/pypa/ | awk "{print \$3}" >/dev/null 2>&1 && docker rmi $(docker images | grep quay.io/pypa/ | awk "{print \$3}") || echo 'quay.io/pypa image does not exist. Will not delete.'