Blame SOURCES/get-source.sh

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