Codex commited on
Commit
50255f0
·
1 Parent(s): 45bab0c

chore: activate python virtual environment in run.sh

Browse files
Files changed (1) hide show
  1. run.sh +9 -0
run.sh CHANGED
@@ -4,6 +4,12 @@ set -euo pipefail
4
  ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
5
  cd "$ROOT_DIR"
6
 
 
 
 
 
 
 
7
  TARGET="${1:-app}"
8
  PYTHON=".venv/bin/python"
9
 
@@ -13,6 +19,9 @@ setup() {
13
  python3 -m venv .venv
14
  fi
15
 
 
 
 
16
  # Keep pip cache inside the repo to avoid global cache permission warnings.
17
  export PIP_CACHE_DIR="${PIP_CACHE_DIR:-$ROOT_DIR/.pip-cache}"
18
  mkdir -p "$PIP_CACHE_DIR"
 
4
  ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
5
  cd "$ROOT_DIR"
6
 
7
+ # Activate virtual environment if it exists.
8
+ if [ -f ".venv/bin/activate" ]; then
9
+ # shellcheck source=/dev/null
10
+ source .venv/bin/activate
11
+ fi
12
+
13
  TARGET="${1:-app}"
14
  PYTHON=".venv/bin/python"
15
 
 
19
  python3 -m venv .venv
20
  fi
21
 
22
+ # shellcheck source=/dev/null
23
+ source .venv/bin/activate
24
+
25
  # Keep pip cache inside the repo to avoid global cache permission warnings.
26
  export PIP_CACHE_DIR="${PIP_CACHE_DIR:-$ROOT_DIR/.pip-cache}"
27
  mkdir -p "$PIP_CACHE_DIR"