2020-04-24 23:36:52 +00:00
|
|
|
venvShellHook() {
|
|
|
|
echo "Executing venvHook"
|
|
|
|
runHook preShellHook
|
|
|
|
|
|
|
|
if [ -d "${venvDir}" ]; then
|
|
|
|
echo "Skipping venv creation, '${venvDir}' already exists"
|
2020-05-29 06:06:01 +00:00
|
|
|
source "${venvDir}/bin/activate"
|
2020-04-24 23:36:52 +00:00
|
|
|
else
|
|
|
|
echo "Creating new venv environment in path: '${venvDir}'"
|
|
|
|
@pythonInterpreter@ -m venv "${venvDir}"
|
|
|
|
|
2020-05-29 06:06:01 +00:00
|
|
|
source "${venvDir}/bin/activate"
|
|
|
|
runHook postVenvCreation
|
|
|
|
fi
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
runHook postShellHook
|
|
|
|
echo "Finished executing venvShellHook"
|
|
|
|
}
|
|
|
|
|
|
|
|
if [ -z "${dontUseVenvShellHook:-}" ] && [ -z "${shellHook-}" ]; then
|
|
|
|
echo "Using venvShellHook"
|
|
|
|
if [ -z "${venvDir-}" ]; then
|
|
|
|
echo "Error: \`venvDir\` should be set when using \`venvShellHook\`."
|
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
shellHook=venvShellHook
|
|
|
|
fi
|
|
|
|
fi
|