at master 775 B view raw
1venvShellHook() { 2 echo "Executing venvHook" 3 runHook preShellHook 4 5 if [ -d "${venvDir}" ]; then 6 echo "Skipping venv creation, '${venvDir}' already exists" 7 source "${venvDir}/bin/activate" 8 else 9 echo "Creating new venv environment in path: '${venvDir}'" 10 @pythonInterpreter@ -m venv "${venvDir}" 11 12 source "${venvDir}/bin/activate" 13 runHook postVenvCreation 14 fi 15 16 runHook postShellHook 17 echo "Finished executing venvShellHook" 18} 19 20if [ -z "${dontUseVenvShellHook:-}" ] && [ -z "${shellHook-}" ]; then 21 echo "Using venvShellHook" 22 if [ -z "${venvDir-}" ]; then 23 echo "Error: \`venvDir\` should be set when using \`venvShellHook\`." 24 exit 1 25 else 26 shellHook=venvShellHook 27 fi 28fi