| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
set -eo pipefail |
| 6 |
|
| 7 |
export LC_ALL=C |
| 8 |
|
| 9 |
BINARY=$BUILD_DIR/downloads/ |
| 10 |
|
| 11 |
PACKAGE=$PMPREFIX-python |
| 12 |
PIP_PACKAGE=$PMPREFIX-python-pip |
| 13 |
SETUPTOOLS_PACKAGE=$PMPREFIX-python-setuptools |
| 14 |
|
| 15 |
PYNAME="$PACKAGE" |
| 16 |
PYFULLVER=$(pacman -Qi $PACKAGE | grep -m1 Version | cut -d':' -f2 | xargs) |
| 17 |
PIPVER=$(pacman -Qi $PIP_PACKAGE | grep -m1 Version | cut -d':' -f2 | xargs) |
| 18 |
SETUPTOOLSVER=$(pacman -Qi $SETUPTOOLS_PACKAGE | grep -m1 Version | cut -d':' -f2 | xargs) |
| 19 |
PYVER=python$(echo $PYFULLVER | cut -d. -f1-2) |
| 20 |
PYARCH=$(ls -1 "/var/cache/pacman/pkg/$PYNAME-$PYFULLVER-any.pkg.tar."* | head -n1) |
| 21 |
|
| 22 |
mkdir -p "$BINARY" |
| 23 |
cd "$BINARY" || exit 1 |
| 24 |
|
| 25 |
echo "Python: $PYNAME $PYFULLVER ($PYVER): $PYARCH" |
| 26 |
|
| 27 |
if [ ! -d $PYVER ]; then |
| 28 |
tar axf "/var/cache/pacman/pkg/$PYNAME-$PYFULLVER-any.pkg.tar.zst" --strip-components=2 --wildcards '*/lib/python3.*' |
| 29 |
tar axf "/var/cache/pacman/pkg/$PIP_PACKAGE-$PIPVER-any.pkg.tar.zst" --strip-components=2 --wildcards '*/lib/python3.*' |
| 30 |
tar axf "/var/cache/pacman/pkg/$SETUPTOOLS_PACKAGE-$SETUPTOOLSVER-any.pkg.tar.zst" --strip-components=2 --wildcards '*/lib/python3.*' |
| 31 |
fi |
| 32 |
|
| 33 |
cd $PYVER |
| 34 |
echo "Stripping Python directory..." |
| 35 |
rm -rf "config-${PYVER}" idlelib test turtledemo config |
| 36 |
find . -regextype sed -regex ".*\.py[co]" | xargs rm -rf |
| 37 |
find . -name __pycache__ | xargs rm -rf |