Instantly share code, notes, and snippets.

Embed
What would you like to do?
Download pypy-nightly (trunk and py3.5) and install to virtualenvs in ~/.virtualenvs
#!/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}
if [ -f "${BUILD_ARTIFACT}" ]; then
# 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
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
@stuaxo

This comment has been minimized.

Show comment
Hide comment
@stuaxo

stuaxo Sep 10, 2017

Support separate versions of pypy.

Owner

stuaxo commented Sep 10, 2017

Support separate versions of pypy.

@stuaxo

This comment has been minimized.

Show comment
Hide comment
@stuaxo

stuaxo Sep 30, 2017

Manually check last modified time.

Owner

stuaxo commented Sep 30, 2017

Manually check last modified time.

@stuaxo

This comment has been minimized.

Show comment
Hide comment
@stuaxo

stuaxo Feb 6, 2018

Don't die on first run

Owner

stuaxo commented Feb 6, 2018

Don't die on first run

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