Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Download pypy-nightly
#!/bin/bash
set -e
# Download pypy nightly builds and create virtualenvs
BRANCHES=(trunk py3.5)
for BRANCH in "${BRANCHES[@]}"
do
DEST_DIR=~/pypy-nightly/${BRANCH}
VENV=~/.virtualenvs/pypy-nightly-${BRANCH}
PLATFORM=linux64
VARIANT=pypy-c-jit
BUILD=${VARIANT}-latest-${PLATFORM}
BUILD_ARTIFACT=${BUILD}.tar.bz2
BUILD_URL=http://buildbot.pypy.org/nightly/${BRANCH}/${BUILD_ARTIFACT}
mkdir -p ${DEST_DIR}
cd ${DEST_DIR}
# Curls -z "Resume" trumps -I "If-Modified" - delete previous file manually.
LAST_MODIFIED=$(date +%s --date="`curl -sI ${BUILD_URL} | grep 'Last-Modified' | cut -c16-`")
LAST_DOWNLOADED=$(stat -c %Y ${BUILD_ARTIFACT})
if [ $LAST_MODIFIED -gt $LAST_DOWNLOADED ]; then
rm ${BUILD_ARTIFACT} | /bin/true
fi
CURL_ARGS="-#LOC - ${BUILD_URL}"
if [ -f "${BUILD_ARTIFACT}" ]; then
CURL_ARGS="-z ${BUILD_ARTIFACT} ${CURL_ARGS}"
fi
curl ${CURL_ARGS}
tar -jxpf ${BUILD_ARTIFACT}
ln `tar -tf ${BUILD_ARTIFACT} | head -1` ${BUILD} -sf
# echo Extracted ${BRANCH}/$(readlink ${BUILD})
set -- ${DEST_DIR}/${BUILD}/bin/pypy*
PYPY_BIN=$1
/usr/bin/virtualenv ${VENV} -p ${PYPY_BIN} -q --clear | true
done
Owner

stuaxo commented Sep 10, 2017

Support separate versions of pypy.

Owner

stuaxo commented Sep 30, 2017

Manually check last modified time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment