Created
January 14, 2015 12:10
-
-
Save ulope/1495a9e7572c62885f30 to your computer and use it in GitHub Desktop.
Automatically place tox working directories into a central location
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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