76 lines
2.0 KiB
Bash
Executable File
76 lines
2.0 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# I am writing this with an ocular migraine and it's hard as shit to
|
|
# real the goddamn code, so please excuse any obvious mistakes. I
|
|
# literally cannot see them right now.
|
|
|
|
PYTHON_VERSIONS="3.12.3"
|
|
|
|
# TODO: Add more to this list if we want to support more platforms.
|
|
PYTHON_PLATFORM_CONFIGS="x86_64-pc-windows-msvc-shared-pgo-full x86_64-unknown-linux-gnu-pgo+lto-full"
|
|
|
|
set -e
|
|
|
|
cd "$(dirname "$0")"
|
|
|
|
# wget \
|
|
# https://raw.githubusercontent.com/indygreg/python-build-standalone/latest-release/latest-release.json \
|
|
# -o latest-release.json
|
|
|
|
RELEASE_PARTS=$(curl https://raw.githubusercontent.com/indygreg/python-build-standalone/latest-release/latest-release.json | \
|
|
python3 -c "import json; import sys; d = json.loads(sys.stdin.read()); print(d[\"tag\"]); print(d[\"asset_url_prefix\"]);")
|
|
|
|
|
|
RELEASE_TAG="$(echo $RELEASE_PARTS | cut -d" " -f 1)"
|
|
RELEASE_BASE_URL="$(echo $RELEASE_PARTS | cut -d" " -f 2)"
|
|
|
|
echo $RELEASE_TAG
|
|
echo $RELEASE_BASE_URL
|
|
|
|
echo "Fetching new files from release..."
|
|
|
|
for PYTHON_VERSION in $PYTHON_VERSIONS; do
|
|
|
|
for CONFIG in $PYTHON_PLATFORM_CONFIGS; do
|
|
FILENAME="cpython-${PYTHON_VERSION}+${RELEASE_TAG}-$CONFIG.tar.zst"
|
|
if [ \! -e "${FILENAME}" ] ; then
|
|
wget "${RELEASE_BASE_URL}/${FILENAME}"
|
|
fi
|
|
done
|
|
|
|
done
|
|
|
|
echo "Decompressing zsts..."
|
|
|
|
# Decompress zsts...
|
|
for ZSTFILE in *.tar.zst; do
|
|
if [ \! -e "$(basename ${ZSTFILE} .zst)" ]; then
|
|
zstd -d "${ZSTFILE}"
|
|
fi
|
|
done
|
|
|
|
echo "Compressing zips..."
|
|
|
|
# Recompress zips...
|
|
for TARFILE in *.tar; do
|
|
if [ \! -e "${TARFILE}.zip" ]; then
|
|
zip "${TARFILE}.zip" "${TARFILE}"
|
|
fi
|
|
done
|
|
|
|
# Write version data.
|
|
# FIXME: Extremely dirty and hacky.
|
|
echo "{ \"release\" : \"${RELEASE_TAG}\", \"versions\" : [" > python_release_info.json
|
|
FIRST="1"
|
|
for PYTHON_VERSION in $PYTHON_VERSIONS; do
|
|
if [ "$FIRST" == "0" ]; then
|
|
echo "," >> python_release_info.json
|
|
fi
|
|
FIRST=0
|
|
echo "\"${PYTHON_VERSION}\"" >> python_release_info.json
|
|
done
|
|
echo "]" >> python_release_info.json
|
|
echo "}" >> python_release_info.json
|
|
|
|
|