File: run-in-env.sh

package info (click to toggle)
zigpy 1.1.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,248 kB
  • sloc: python: 40,505; sql: 2,253; sh: 13; makefile: 7
file content (19 lines) | stat: -rwxr-xr-x 415 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/env sh
set -eu

# Activate virtualenv if present, then run the specified command

if [ -n "${VIRTUAL_ENV-}" ] && [ -f "${VIRTUAL_ENV}/bin/activate" ]; then
  . "${VIRTUAL_ENV}/bin/activate"
else
  my_path=$(git rev-parse --show-toplevel)

  for venv in .venv venv; do
    if [ -f "${my_path}/${venv}/bin/activate" ]; then
      . "${my_path}/${venv}/bin/activate"
      break
    fi
  done
fi

exec "$@"