From 54dee33cc77e3d9a4cbf83cb2a61eed3b0fc4dd2 Mon Sep 17 00:00:00 2001 From: Graham Mainwaring Date: Mon, 21 Mar 2016 11:38:12 -0400 Subject: [PATCH] Add script wrapper to establish Tower SCL and venv before running Python --- tools/scripts/tower-python | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100755 tools/scripts/tower-python diff --git a/tools/scripts/tower-python b/tools/scripts/tower-python new file mode 100755 index 0000000000..12f6275fd7 --- /dev/null +++ b/tools/scripts/tower-python @@ -0,0 +1,18 @@ +#!/bin/bash + +# Enable needed Software Collections, if installed +for scl in python27 httpd24; do + if [ -f /etc/scl/prefixes/$scl ]; then + if [ -f `cat /etc/scl/prefixes/$scl`/$scl/enable ]; then + . `cat /etc/scl/prefixes/$scl`/$scl/enable + fi + fi +done + +# Enable Tower virtualenv +if [ -f /var/lib/awx/venv/tower/bin/activate ]; then + . /var/lib/awx/venv/tower/bin/activate +fi + +# Run the requested Python command, using the interpreter from the path +python "$@"