Skip to content

Commit be9297f

Browse files
committed
Merge remote-tracking branch 'origin/master' into edge
2 parents c84fdb4 + 1416d1a commit be9297f

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

envhelp/python2

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ if [ -z "${DOCKER_BIN}" ]; then
1616
exit 1
1717
fi
1818

19+
# default PYTHONPATH such that directly executing files in the repo "just works"
20+
# NOTE: this is hard-coded to the mount point used within the container
21+
PYTHONPATH='/usr/app/src'
22+
1923
# default any variables for local development
2024
MIG_ENV=${MIG_ENV:-'local'}
2125

@@ -40,4 +44,8 @@ echo
4044

4145
# execute python2 within the image passing the supplied arguments
4246

43-
${DOCKER_BIN} run -it --rm --mount type=bind,source=.,target=/usr/src/app --env "MIG_ENV=$MIG_ENV" "$IMAGEID" python2 "$@"
47+
${DOCKER_BIN} run -it --rm \
48+
--mount type=bind,source=.,target=/usr/src/app \
49+
--env "PYTHONPATH=$PYTHON_PATH" \
50+
--env "MIG_ENV=$MIG_ENV" \
51+
"$IMAGEID" python2 "$@"

envhelp/python3

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,21 @@ set -e
66

77
SCRIPT_PATH=$(realpath "$0")
88
SCRIPT_BASE=$(dirname -- "$SCRIPT_PATH")
9+
MIG_BASE=$(realpath "$SCRIPT_BASE/..")
910
PYTHON3_BIN="$SCRIPT_BASE/venv/bin/python3"
1011

1112
if [ ! -f "${PYTHON3_BIN}" ]; then
1213
echo "No python3 binary found - perhaps the virtual env was not created"
1314
exit 1
1415
fi
1516

17+
# default PYTHONPATH such that directly executing files in the repo "just works"
18+
PYTHONPATH=${PYTHONPATH:-"$MIG_BASE"}
19+
1620
# default any variables for local development
1721
MIG_ENV=${MIG_ENV:-'local'}
1822

1923
echo "running with MIG_ENV='$MIG_ENV' under python 3"
2024
echo
2125

22-
MIG_ENV="$MIG_ENV" "$PYTHON3_BIN" "$@"
26+
PYTHONPATH="$PYTHONPATH" MIG_ENV="$MIG_ENV" "$PYTHON3_BIN" "$@"

tests/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)