Blame SOURCES/get-source.sh

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