From 95f135e9f2415b8f89534528641220a0ef9fe570 Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Wed, 11 Feb 2015 12:08:23 -0500 Subject: add tools/tox-venv for running in a tox env --- tools/tox-venv | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100755 tools/tox-venv (limited to 'tools') diff --git a/tools/tox-venv b/tools/tox-venv new file mode 100755 index 00000000..76ed5076 --- /dev/null +++ b/tools/tox-venv @@ -0,0 +1,42 @@ +#!/bin/sh + +error() { echo "$@" 1>&2; } +fail() { [ $# -eq 0 ] || error "$@"; exit 1; } +Usage() { + cat <&2; exit 1; } +[ "$1" = "-h" -o "$1" = "--help" ] && { Usage; exit 0; } + +env="$1" +shift +tox_d="${0%/*}/../.tox" +activate="$tox_d/$env/bin/activate" + + +[ -d "$tox_d" ] || fail "$tox_d: not a dir. maybe run 'tox'?" + +[ "$env" = "-l" -o "$env" = "--list" ] && { list_toxes ; exit ; } + +if [ ! -f "$activate" ]; then + error "$env: not a valid tox environment?" + error "try one of:" + list_toxes "$tox_d" " " + fail +fi +. "$activate" + +[ "$#" -gt 0 ] || set -- ${SHELL:-/bin/bash} +debian_chroot="tox:$env" exec "$@" -- cgit v1.2.3