diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2023-10-07 23:57:05 +0200 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2023-10-07 23:57:05 +0200 |
commit | 6967e11d9c14554300e07fd70a6a93ffe224f8d3 (patch) | |
tree | 2ceccdcb088fe30851245ef47c25ccdb5fbdd8e1 /bin/python-tool | |
parent | 7ee547e760db3e776ab7ecd676ed4b8afca0f04b (diff) | |
download | infra-6967e11d9c14554300e07fd70a6a93ffe224f8d3.tar.gz infra-6967e11d9c14554300e07fd70a6a93ffe224f8d3.tar.bz2 infra-6967e11d9c14554300e07fd70a6a93ffe224f8d3.tar.xz infra-6967e11d9c14554300e07fd70a6a93ffe224f8d3.zip |
bin/ansible: Using ansible from requirements.txt
Diffstat (limited to 'bin/python-tool')
-rwxr-xr-x | bin/python-tool | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/bin/python-tool b/bin/python-tool new file mode 100755 index 0000000..27cab43 --- /dev/null +++ b/bin/python-tool @@ -0,0 +1,29 @@ +#!/bin/bash + +set -euo pipefail + +basedir="${0%/*}" +self="${0##*/}" +cmd="$basedir/env/bin/$self" + +if [[ ! -x $cmd ]] +then + if [[ ! -d $basedir/env ]] + then + virtualenv --python=python3 $basedir/env + fi + + if [[ ! -e $basedir/env/.cookie || $basedir/requirements.txt -nt $basedir/env/.cookie ]] + then + $basedir/env/bin/pip install -r $basedir/requirements.txt + touch $basedir/env/.cookie + fi +fi + +if [[ "$self" == "python-tool" ]] +then + echo "$0: Setup complete" + exit 0 +fi + +exec "$cmd" "${@}" |