mirror of
https://github.com/trailofbits/algo.git
synced 2025-08-10 23:03:03 +02:00
More robust use of our virtualenv
Prior to this change, the script tests if it's running inside a virtualenv; and if it is, it assumes that it must be inside its own virtualenv. This change switches to testing for the activate binary in the place we expect; and if it's found, using it directly. This avoids false positives (running the script inside the wrong virtualenv) and makes sure that we're running inside the right virtualenv.
This commit is contained in:
parent
faa4b9a8da
commit
45c368bfef
1 changed files with 4 additions and 6 deletions
10
algo
10
algo
|
@ -2,19 +2,17 @@
|
|||
|
||||
set -e
|
||||
|
||||
if [ -z ${VIRTUAL_ENV+x} ]
|
||||
ACTIVATE_SCRIPT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/env/bin/activate"
|
||||
if [ -f "$ACTIVATE_SCRIPT" ]
|
||||
then
|
||||
ACTIVATE_SCRIPT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/env/bin/activate"
|
||||
if [ -f "$ACTIVATE_SCRIPT" ]
|
||||
then
|
||||
# shellcheck source=/dev/null
|
||||
source "$ACTIVATE_SCRIPT"
|
||||
else
|
||||
else
|
||||
echo "$ACTIVATE_SCRIPT not found. Did you follow documentation to install dependencies?"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
case "$1" in
|
||||
update-users) PLAYBOOK=users.yml; ARGS=( "${@:2}" -t update-users ) ;;
|
||||
*) PLAYBOOK=main.yml; ARGS=( "${@}" ) ;;
|
||||
|
|
Loading…
Add table
Reference in a new issue