-
Notifications
You must be signed in to change notification settings - Fork 2
/
setpath.sh
executable file
·32 lines (28 loc) · 943 Bytes
/
setpath.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#
# This script adds Mitsuba to the current path.
# It works with both Bash and Zsh and assumes that Mitsuba
# is compiled within the source tree or a subdirectory
# named 'build'.
#
# NOTE: this script must be sourced and not run, i.e.
# . setpath.sh for Bash
# source setpath.sh for Zsh or Bash
#
if [[ "$#" -ge "1" ]]; then
BUILD_DIR="$1"
else
BUILD_DIR="build"
fi
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
echo "The setpath.sh script must be sourced, not executed. In other words, run\n"
echo "$ source setpath.sh\n"
exit 0
fi
if [ "$BASH_VERSION" ]; then
MITSUBA_DIR=$(dirname "$BASH_SOURCE")
export MITSUBA_DIR=$(builtin cd "$MITSUBA_DIR"; builtin pwd)
elif [ "$ZSH_VERSION" ]; then
export MITSUBA_DIR=$(dirname "$0:A")
fi
export PYTHONPATH="$MITSUBA_DIR/dist/python:$MITSUBA_DIR/$BUILD_DIR/dist/python:$PYTHONPATH"
export PATH="$MITSUBA_DIR/dist:$MITSUBA_DIR/$BUILD_DIR/dist:$PATH"