-
Notifications
You must be signed in to change notification settings - Fork 4
/
otterdog.sh
executable file
·33 lines (31 loc) · 998 Bytes
/
otterdog.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
33
#!/usr/bin/env bash
#
# *******************************************************************************
# Copyright (c) 2023-2024 Eclipse Foundation and others.
# This program and the accompanying materials are made available
# under the terms of the Eclipse Public License 2.0
# which is available at http://www.eclipse.org/legal/epl-v20.html
# SPDX-License-Identifier: EPL-2.0
# *******************************************************************************
#
# resolve the program directory
PRG="$0"
while [ -h "$PRG" ] ; do
ls=$(ls -ld "$PRG")
link=$(expr "$ls" : '.*-> \(.*\)$')
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=$(dirname "$PRG")/"$link"
fi
done
PRGDIR=$(dirname "$PRG")
if ! command -v poetry &> /dev/null
then
# activate virtual environment
# shellcheck source=/dev/null
source "$PRGDIR"/.venv/bin/activate
PYTHONPATH=$PYTHONPATH:$PRGDIR python3 -m otterdog.cli "$@"
else
poetry -C "$PRGDIR" run otterdog "$@"
fi