File: get_version.sh

package info (click to toggle)
python-adb-shell 0.4.4-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 760 kB
  • sloc: python: 3,860; makefile: 191; sh: 124
file content (26 lines) | stat: -rwxr-xr-x 525 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
#!/bin/bash

set -e

# get the directory of this script
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"

RSTRIP='"*'
LSTRIP='*"'

# get the package name
PACKAGE=$($DIR/get_package_name.sh)

# get the current version
VERSION_LINE=$(grep "__version__" "$DIR/../$PACKAGE/__init__.py" || echo '')
VERSION_TEMP=${VERSION_LINE%'"'}

VERSION=${VERSION_TEMP##$LSTRIP}

# Make sure `VERSION` is not empty
if [ -z "$VERSION" ]; then
    echo "Version could not be determined" >&2
    exit 1
fi

echo "$VERSION"