Blame SOURCES/get-source.sh

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