Blame SOURCES/get-source.sh

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