Blame SOURCES/get-source.sh

8db7d0
#! /bin/bash -ex
8db7d0
8db7d0
# Download a release of Python (if missing) and remove .exe files from it
8db7d0
8db7d0
version=$1
8db7d0
8db7d0
if [ -z "${version}" ]; then
8db7d0
    echo "Usage: $0 VERSION" >& 2
8db7d0
    echo "" >& 2
8db7d0
    echo "example: $0 2.7.15" >& 2
8db7d0
    exit 1
8db7d0
fi
8db7d0
8db7d0
versionedname=Python-${version}
8db7d0
orig_archive=${versionedname}.tar.xz
8db7d0
new_archive=${versionedname}-noexe.tar.xz
8db7d0
8db7d0
if [ ! -e ${orig_archive} ]; then
8db7d0
    wget -N https://www.python.org/ftp/python/${version}/${orig_archive}
8db7d0
fi
8db7d0
8db7d0
deleted_names=$(tar --list -Jf ${orig_archive} | grep '\.exe$')
8db7d0
8db7d0
# tar --delete does not operate on compressed archives, so do
8db7d0
# xz compression/decompression explicitly
8db7d0
xz --decompress --stdout ${orig_archive} | \
8db7d0
    tar --delete -v ${deleted_names} | \
8db7d0
    xz --compress --stdout -3 -T0 > ${new_archive}