improved setpath.sh script so that it also works with ZSH on OSX
parent
85edb73dee
commit
36d762db0a
24
setpath.sh
24
setpath.sh
|
@ -12,29 +12,35 @@ if [ "$BASH_VERSION" ]; then
|
|||
export MITSUBA_DIR=$(builtin cd "$MITSUBA_DIR"; builtin pwd)
|
||||
elif [ "$ZSH_VERSION" ]; then
|
||||
export MITSUBA_DIR=$(dirname "$0:A")
|
||||
fi
|
||||
|
||||
pyver=`python --version 2>&1 | grep -oE '([[:digit:]].[[:digit:]])'`
|
||||
if [[ "$(uname)" == 'Darwin' ]]; then
|
||||
export PYTHONPATH="$MITSUBA_DIR/Mitsuba.app/python/$pyver:$PYTHONPATH"
|
||||
mitsuba_plugin_dir="$MITSUBA_DIR/Mitsuba.app/plugins"
|
||||
else
|
||||
export PYTHONPATH="$MITSUBA_DIR/dist/python:$MITSUBA_DIR/dist/python/$pyver:$PYTHONPATH"
|
||||
mitsuba_plugin_dir="$MITSUBA_DIR/dist/plugins"
|
||||
fi
|
||||
unset pyver
|
||||
|
||||
if [ "$ZSH_VERSION" ]; then
|
||||
# Zsh autocomplete for mitsuba, mtsutil, and mtssrv
|
||||
mitsuba_plugins=$(ls -1 "$MITSUBA_DIR/dist/plugins" | grep -oE '\w+.so' | sed 's/.so$//')
|
||||
mitsuba_plugins=$(ls -1 "$mitsuba_plugin_dir" | grep -oE '\w+(\.so|\.dylib)' | sed 's/.so$//;s/.dylib$//')
|
||||
compdef "_arguments '-c[connect to host(s)]:host:_hosts' '-s[connect to list of hosts in a file]:hostfile:_files' '-o[output file]:out:_files' '*:scene:_files -g \*.\(xml\|XML\)'" mitsuba
|
||||
compdef "_arguments '-c[connect to host(s)]:host:_hosts' '-s[connect to list of hosts in a file]:hostfile:_files' '1:plugins:($mitsuba_plugins)' '*:utilargs:_files'" mtsutil
|
||||
compdef "_arguments '-c[connect to host(s)]:host:_hosts' '-s[connect to list of hosts in a file]:hostfile:_files'" mtssrv
|
||||
unset mitsuba_plugins
|
||||
fi
|
||||
|
||||
unset mitsuba_plugin_dir
|
||||
|
||||
if [[ "$(uname)" == 'Darwin' ]]; then
|
||||
export PATH="$MITSUBA_DIR/Mitsuba.app/Contents/MacOS:$PATH"
|
||||
export PYTHONPATH="$MITSUBA_DIR/Mitsuba.app/python/2.7:$PYTHONPATH"
|
||||
else
|
||||
export LD_LIBRARY_PATH="$MITSUBA_DIR/dist:$LD_LIBRARY_PATH"
|
||||
export PATH="$MITSUBA_DIR/dist:$PATH"
|
||||
|
||||
# Add Mitsuba to PYTHONPATH if there is only one version of Python
|
||||
mitsuba_python=$(ls -1 "$MITSUBA_DIR/dist/python")
|
||||
if [[ "$(echo $mitsuba_python | wc -l)" == "1" ]]; then
|
||||
export PYTHONPATH="$MITSUBA_DIR/dist:$MITSUBA_DIR/dist/python/$mitsuba_python:$PYTHONPATH"
|
||||
fi
|
||||
unset mitsuba_python
|
||||
|
||||
# Generate core dumps if something goes wrong
|
||||
ulimit -c 1000000000
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue