File: pm.in

package info (click to toggle)
promod3 3.4.2%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 966,596 kB
  • sloc: cpp: 55,820; python: 18,058; makefile: 85; sh: 51
file content (62 lines) | stat: -rwxr-xr-x 2,050 bytes parent folder | download | duplicates (2)
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/bash

# Copyright (c) 2013-2020, SIB - Swiss Institute of Bioinformatics and
#                          Biozentrum - University of Basel
# 
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# 
#   http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Wrapper script that dispatches the actions to the actual Python script. It 
# autodetects the most important directories and sets LD_LIBRARY_PATH and 
# friends.

# EXIT CODES
# If an action is started, returns with the code of this action
#  1  -  not enough arguments

if test $# == 0 ; then
  echo "Usage:"
  echo "  promod <action>"
  echo ""
  echo "type 'promod help' to get a list of commonly used actions"
  exit 1
fi

SCRIPT_NAME=$0

BIN_DIR=$( cd `dirname "$SCRIPT_NAME"`; pwd)
export OST_ROOT="@OST_ROOT@"
export PROMOD3_ROOT=$(dirname "$BIN_DIR")
export PROMOD3_SHARED_DATA_PATH="$PROMOD3_ROOT/share/promod3"
PROMOD3_EXEC_PATH="$PROMOD3_ROOT/@LIBEXECPATH@"
# export PYTHONPATH="@OST_PYMOD_PATH@:${PROMOD3_ROOT}/@LIBDIR@/@PYTHON_MODULE_PATH@:${PYTHONPATH}"
# export PATH="$BIN_DIR:${OST_ROOT}/bin:$PATH"
# export LD_LIBRARY_PATH="${PROMOD3_ROOT}/@LIBDIR@:${OST_ROOT}/lib64:$LD_LIBRARY_PATH"

# retrieve absolute path to python executable
pyexec=python3

ACTION="$1"
PROMOD3_SCRIPT="${PROMOD3_EXEC_PATH}/pm-${ACTION}"
shift

if test -e "${PROMOD3_SCRIPT}" ; then
    $pyexec "${PROMOD3_SCRIPT}" $@
else
    ACTION_BASENAME=`basename "$ACTION"`
    case "$ACTION_BASENAME" in
        *.py ) $pyexec "$ACTION" $@;;
        * ) echo "Unknown action '${ACTION}'"
            echo "type 'promod help' to get started"
            exit 1 ;;
    esac
fi