Skip to content

Instantly share code, notes, and snippets.

@ulope
Created January 14, 2015 12:10
Show Gist options
  • Save ulope/1495a9e7572c62885f30 to your computer and use it in GitHub Desktop.
Save ulope/1495a9e7572c62885f30 to your computer and use it in GitHub Desktop.
Automatically place tox working directories into a central location
# Add this to your shell's rc file.
# Optionally export TOX_WORKDIR_BASE if you don't like the default of ~/.cache/tox
tox() {
if [ -z "$TOX_WORKDIR_BASE" ]; then
TOX_WORKDIR_BASE=~/.cache/tox
fi
if [ -f tox.ini ]; then
if [ -d .tox -a ! -L .tox ]; then
echo "Warning: Existing .tox directory is not symlinked into TOX_WORKDIR_BASE! Remove and re-run to auto-create symlink."
elif [ ! -e .tox ]; then
WORKDIR=${TOX_WORKDIR_BASE}/$(basename $(pwd))
mkdir -p $WORKDIR
ln -s $WORKDIR .tox
fi
fi
command tox "$@"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment