8ac5e011d6
GitOrigin-RevId: 2c3273caa153ee8eb5786bc8141b85b859e7efd7
26 lines
691 B
Bash
26 lines
691 B
Bash
venvShellHook() {
|
|
echo "Executing venvHook"
|
|
runHook preShellHook
|
|
|
|
if [ -d "${venvDir}" ]; then
|
|
echo "Skipping venv creation, '${venvDir}' already exists"
|
|
else
|
|
echo "Creating new venv environment in path: '${venvDir}'"
|
|
@pythonInterpreter@ -m venv "${venvDir}"
|
|
fi
|
|
|
|
source "${venvDir}/bin/activate"
|
|
|
|
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
|