-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.shell
More file actions
46 lines (45 loc) · 3.11 KB
/
init.shell
File metadata and controls
46 lines (45 loc) · 3.11 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
################################################################################
#
# This script is part of the httk framework. Its purpose is to set up the
# httk environment, to be used in the users init scripts.
#
# All that needs to be done to get the httk environment working is to add
# /path/to/httk/bin -> to your PATH variable
# and
# /path/to/httk -> to your PYTHONPATH variable
#
# For tcsh, csh, bash, zsh, ksh, simply do:
# source /path/to/httk/init.shell
#
# For sh and fish respectively you need to do this instead:
# sh: eval `/path/to/httk/init.shell.eval sh`
# fish: eval (/path/to/httk/init.shell.eval fish)
#
################################################################################
#
# The high-throughput toolkit (httk)
# Copyright (C) 2012-2013 Rickard Armiento
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
################################################################################
#
# (Below follows the fun cludge of a multi-shell compatible script.)
test "$?tcsh" = "0" -o "$?csh" = "0" && eval 'set COMMAND=(!!); set HERE="$COMMAND[2]"; set HEREDIR=`dirname $HERE`; set DIR=`cd "$HEREDIR"; pwd -P`; set BASH_VERSION=""; set ZSH_VERSION=""; set KSH_VERSION=""; setenv PATH "${DIR}/bin:${PATH}"; test "$?PYTHONPATH" == "1" && setenv PYTHONPATH "${DIR}/src:${PYTHONPATH}"; test "$?PYTHONPATH" == "0" && setenv PYTHONPATH "${DIR}/src"; set DONE=1'
test "$BASH_VERSION" != "" && eval 'HERE=${BASH_SOURCE[0]}; eval HEREDIR=$(dirname "$HERE"); DIR=$(cd "$HEREDIR"; pwd -P); export PATH=$DIR/bin:$PATH; export PYTHONPATH=$DIR/src:$PYTHONPATH; DONE=1'
test "$ZSH_VERSION" != "" && eval 'HERE=$0; eval HEREDIR=$(dirname "$HERE"); DIR=$(cd "$HEREDIR"; pwd -P); export PATH=$DIR/bin:$PATH; export PYTHONPATH=$DIR/src:$PYTHONPATH; DONE=1'
test "$KSH_VERSION" != "" && eval 'X=88; f() { typeset X=93; }; f; test "$X" = "93" && HERE="${.sh.file}"; test $X == "88" && echo "httk init.shell cannot configure the environment for the ksh88-type shell you are using. Run the following instead:" && echo " eval \`/path/to/httk/init.shell.eval ksh88\`" && return; eval HEREDIR=$(dirname "$HERE"); DIR=$(cd "$HEREDIR"; pwd -P); export PATH=$DIR/bin:$PATH; export PYTHONPATH=$DIR/src:$PYTHONPATH; DONE=1'
# regular sh falls here; I've found no way to
# extract the path of a sourced script in sh :-(
test "$DONE" != "1" && eval 'echo "httk init.shell cannot configure the environment for the shell you are using. Run the following instead:"; echo " eval \`/path/to/httk/init.shell.eval [shell name]\`"'