-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathsetenv
More file actions
14 lines (12 loc) · 743 Bytes
/
setenv
File metadata and controls
14 lines (12 loc) · 743 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/usr/bin/env -S sh -c "echo >&2 \"Error: You are running this script instead of sourcing it. Make sure to use it as 'source setenv' or '. setenv', otherwise its settings won't take effect.\"; exit 1"
# Get the directory where this script reside using a trick (works differently on bash and zsh)
# On bash, the current script's name is in 'BASH_SOURCE[0]'
if [ "$BASH_VERSION" != "" ]; then # for BASH
dir=$(cd $(dirname ${BASH_SOURCE[0]}) && pwd)
elif [ "$ZSH_VERSION" != "" ]; then # on zsh the script name is in '$0'
dir=$(cd $(dirname $0) && pwd)
else # on any other SH compatible shell we assume that the current working directory is the root directory
dir=$(pwd)
fi
export PATH=$dir/bin:$PATH
export PYTHONPATH=$dir:$PYTHONPATH