File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ if [ -n "${PY}" ]; then
37
37
DOCKER_FILE_SUFFIX=" $PYTHON_SUFFIX "
38
38
elif [ -n " ${PYVER} " ]; then
39
39
PY=3
40
- PYTHON_SUFFIX=" pyver- $PYVER "
40
+ PYTHON_SUFFIX=" pyver_ $PYVER "
41
41
DOCKER_FILE_SUFFIX=" pyver"
42
42
else
43
43
echo " No python version specified - please supply a PY env var"
@@ -61,6 +61,10 @@ PYTHONPATH='/usr/src/app'
61
61
# default any variables for container development
62
62
MIG_ENV=${MIG_ENV:- ' docker' }
63
63
64
+ # arrange for an explicit python cache hierarhy such that running different
65
+ # containers with potentially radically different python APIs do not conflict
66
+ PYTHONPYCACHEPREFIX=" $PYTHONPATH /envhelp/output/__pycache.${PYTHON_SUFFIX} __"
67
+
64
68
# determine if the image has changed
65
69
echo -n " validating python $PY container.. "
66
70
@@ -84,5 +88,6 @@ echo "using image id $IMAGEID"
84
88
${DOCKER_BIN} run -it --rm \
85
89
--mount " type=bind,source=$MIG_BASE ,target=/usr/src/app" \
86
90
--env " PYTHONPATH=$PYTHONPATH " \
91
+ --env " PYTHONPYCACHEPREFIX=$PYTHONPYCACHEPREFIX " \
87
92
--env " MIG_ENV=$MIG_ENV " \
88
93
" $IMAGEID " python$PY $@
Original file line number Diff line number Diff line change @@ -43,4 +43,8 @@ PYTHONPATH=${PYTHONPATH:-"$MIG_BASE"}
43
43
# default any variables for local development
44
44
MIG_ENV=${MIG_ENV:- ' local' }
45
45
46
- PYTHONPATH=" $PYTHONPATH " MIG_ENV=" $MIG_ENV " " $PYTHON_BIN " " $@ "
46
+ # arrange for an explicit python cache hierarhy - this is primarily done for
47
+ # consistency with the dpython script where it is necessary to avoid conflict
48
+ PYTHONPYCACHEPREFIX=" $PYTHONPATH /envhelp/output/__pycache.${MIG_ENV} __"
49
+
50
+ PYTHONPATH=" $PYTHONPATH " PYTHONPYCACHEPREFIX=" $PYTHONPYCACHEPREFIX " MIG_ENV=" $MIG_ENV " " $PYTHON_BIN " " $@ "
You can’t perform that action at this time.
0 commit comments