From 6967e11d9c14554300e07fd70a6a93ffe224f8d3 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Sat, 7 Oct 2023 23:57:05 +0200 Subject: bin/ansible: Using ansible from requirements.txt --- bin/python-tool | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 bin/python-tool (limited to 'bin/python-tool') 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" "${@}" -- cgit v1.2.3