Download pypy-nightly (trunk and py3.7) and install to virtualenvs in ~/.virtualenvs
#!/bin/bash | |
set -e | |
# Download PyPy nightly builds and create a virtualenvs in ~./.virtualenvs | |
# Valid branch names include trunk py3.6 py3.7 | |
BRANCHES=(trunk py3.7) | |
PLATFORM=linux64 | |
VARIANT=pypy-c-jit | |
BUILD=${VARIANT}-latest-${PLATFORM} | |
BUILD_ARTIFACT=${BUILD}.tar.bz2 | |
bold=$(tput bold) | |
normal=$(tput sgr0) | |
optionally_download() | |
{ | |
# Download artifact unless already cached. | |
local BUILD_URL=$1 | |
local BUILD_ARTIFACT=$2 | |
if [ -f "${BUILD_ARTIFACT}" ]; then | |
# Curls -z "Resume" trumps -I "If-Modified", so delete any previous file manually: | |
local LAST_MODIFIED=$(date +%s --date="`curl -sI ${BUILD_URL} | grep 'Last-Modified' | cut -c16-`") | |
local LAST_DOWNLOADED=$(stat -c %Y ${BUILD_ARTIFACT}) | |
if [ $LAST_MODIFIED -gt $LAST_DOWNLOADED ]; then | |
rm ${BUILD_ARTIFACT} | /bin/true | |
fi | |
fi | |
local CURL_ARGS="-#LOC - ${BUILD_URL}" | |
if [ -f "${BUILD_ARTIFACT}" ]; then | |
CURL_ARGS="-z ${BUILD_ARTIFACT} ${CURL_ARGS}" | |
fi | |
curl ${CURL_ARGS} | |
} | |
function download_builds() | |
{ | |
for BRANCH in "${BRANCHES[@]}" | |
do | |
local DEST_DIR=~/pypy-nightly/${BRANCH} | |
local BUILD_URL=http://buildbot.pypy.org/nightly/${BRANCH}/${BUILD_ARTIFACT} | |
mkdir -p ${DEST_DIR} | |
cd ${DEST_DIR} | |
optionally_download ${BUILD_URL} ${BUILD_ARTIFACT} | |
done | |
} | |
function create_environments() | |
{ | |
for BRANCH in "${BRANCHES[@]}" | |
do | |
local DEST_DIR=~/pypy-nightly/${BRANCH} | |
local VENV=~/.virtualenvs/pypy-nightly-${BRANCH} | |
local VENV_BIN=${VENV}/bin/python | |
cd ${DEST_DIR} | |
printf "${bold}%s${normal}" "${BRANCH} ⌛" | |
tar -jxpf ${BUILD_ARTIFACT} | |
local BUILD_ID=$(tar -tf ${BUILD_ARTIFACT} | head -1) | |
ln ${BUILD_ID} ${BUILD} -sf | |
ln ${BUILD_ID} current -sf | |
set -- ${DEST_DIR}/${BUILD}/bin/pypy* | |
local PYPY_BIN=$1 | |
printf "\b%-30s" "${PYPY_BIN/#$HOME/\~} ⌛" | |
/usr/bin/virtualenv ${VENV} -p ${PYPY_BIN} -q --clear | true | |
${VENV_BIN} -m pip install setuptools -U -q 2>&1 | true | |
printf "\b\b-> %s\n" "${VENV_BIN/#$HOME/\~}" | |
done | |
} | |
download_builds | |
create_environments |
This comment has been minimized.
This comment has been minimized.
Manually check last modified time. |
This comment has been minimized.
This comment has been minimized.
Don't die on first run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
Support separate versions of pypy.