Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/extra/python-xcffib/xcffibgen-custom
blob: 9e23f12044243eb6000c8d4cb7628b8a98252e12 (plain)
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
#!/usr/bin/env -S bash -x
mirror='http://ftp.otenet.gr/linux/archlinux'

# Strip arch32 specific part of the version string
version="${1%.*}"
shift

while [[ $# -gt 0 ]]; do
    if [[ $1 == '--output' ]]; then
        output="$2"
        shift
        shift
    elif [[ $1 == '--input' ]]; then
        input="$2"
        shift
        shift
    fi
done

curl --fail -O "${mirror}/extra/os/x86_64/python-xcffib-${version}-any.pkg.tar.zst"
curl --fail -O "${mirror}/extra/os/x86_64/python-xcffib-${version}-any.pkg.tar.zst.sig"

if pacman-key -v "python-xcffib-${version}-any.pkg.tar.zst.sig" "python-xcffib-${version}-any.pkg.tar.zst"; then
    tar -xf "python-xcffib-${version}-any.pkg.tar.zst"

    pyver=$(python -c 'import sys; print(".".join(map(str, sys.version_info[:2])))')
    tarpath="usr/lib/python${pyver}/site-packages/xcffib/"

    mapfile -t files < <(find "$input" -type f -name '*.xml' -printf "${tarpath}%f\n" | sed 's/xml$/py/')

    mkdir -p "$output"
    cp "${files[@]}" "$output" || true
fi