Skip to content

Instantly share code, notes, and snippets.

@xolox
Created February 18, 2015 20:37
Show Gist options
  • Save xolox/3ac505dab5f410e8739c to your computer and use it in GitHub Desktop.
Save xolox/3ac505dab5f410e8739c to your computer and use it in GitHub Desktop.
pip-accel issue #49 (scipy / numpy / setuptools / setup_requires interaction)
2015-02-17 23:53:02 - Running first 'pip-accel install scipy' command ..
2015-02-18 00:06:59 - Running second 'pip-accel install scipy' command ..
2015-02-18 00:09:02 - Built 2 packages on first run.
2015-02-18 00:09:02 - Built 0 packages on second run.
2015-02-18 00:09:03 - Done!
Time of first run: +/- 14 minutes
Time of second run: +/- 2 minutes
#!/bin/bash -e
main () {
# Simulate pip-accel issue #49 on GitHub:
# https://github.com/paylogic/pip-accel/issues/49
ROOT=$(mktemp -d)
ENV1=$ROOT/env1
LOG1=$ROOT/env1.log
ENV2=$ROOT/env2
LOG2=$ROOT/env2.log
satisfy_scipy_build_deps
reset_binary_cache
install_scipy $ENV1 $LOG1 first
install_scipy $ENV2 $LOG2 second
dump_stats $LOG1 first
dump_stats $LOG2 second
rm -R $ROOT
msg "Done!"
}
satisfy_scipy_build_deps () {
# Make sure the build dependencies of SciPy are satisfied
# (this is based on Ubuntu Linux 12.04 - Precise Pangolin).
sudo apt-get install --yes gfortran libatlas-base-dev
}
reset_binary_cache () {
# Start the test from a clean slate.
rm -f ~/.pip-accel/binaries/v7/scipy:*.tar.gz
rm -f ~/.pip-accel/binaries/v7/numpy:*.tar.gz
}
install_scipy () {
# Simulate a user encountering issue #49.
local env=$1
local log=$2
local label=$3
msg "Running $label 'pip-accel install scipy' command .."
virtualenv $env &>/dev/null
$env/bin/pip install pip-accel &>/dev/null
script -qc "$env/bin/pip-accel install scipy" $log
}
dump_stats () {
# Extract some statistics from pip-accel's logging output.
local log=$1
local label=$2
local num_built=$(grep -c 'pip_accel.bdist.*Building .* binary distribution' $log)
msg "Built $num_built packages on $label run."
}
msg () {
# Print a timestamped message to the terminal.
echo "$(date '+%Y-%m-%d %H:%M:%S') - $*" >&2
}
main "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment