diff options
author | Scott Moser <smoser@ubuntu.com> | 2015-02-11 14:00:20 -0500 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2015-02-11 14:00:20 -0500 |
commit | 35dd98c07bce490e85e03bef872cbbf1185e0be9 (patch) | |
tree | 9b71de77b27ca916fa1d869fa95c0a5ab9f5e51c /tools | |
parent | cd632b2f153a61faa48531cb41d0288650e72c71 (diff) | |
parent | 587387cfbff7a89573128dc958df903d1becbde1 (diff) | |
download | vyos-cloud-init-35dd98c07bce490e85e03bef872cbbf1185e0be9.tar.gz vyos-cloud-init-35dd98c07bce490e85e03bef872cbbf1185e0be9.zip |
some python3 fixes
This fixes the last set of WARN messages in my testing.
* open /dev/console in text mode
* move final message to be jinja template by default to avoid
a warning about lack of cheetah.
* write and read pickle'd contents in binary
* some logging tests
Also:
* add tool tox-venv for simple things like:
tox-venv py34 /bin/bash
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/tox-venv | 42 |
1 files changed, 42 insertions, 0 deletions
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 <<EOF +Usage: ${0##*/} tox-environment [command [args]] + run command with provided arguments in the provided tox environment + command defaults to \${SHELL:-/bin/sh}. + + invoke with '--list' to show available environments +EOF +} +list_toxes() { + local td="$1" pre="$2" d="" + ( cd "$tox_d" && + for d in *; do [ -f "$d/bin/activate" ] && echo "${pre}$d"; done) +} + +[ $# -eq 0 ] && { Usage 1>&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 "$@" |