From ae067bf6c099922574b79265f208b4c9bda9c66b Mon Sep 17 00:00:00 2001 From: Jim Nicholson Date: Tue, 13 Feb 2024 23:54:23 -0800 Subject: [PATCH] Fix issue with PATH in venv --- vars/pythonVenvStage.groovy | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/vars/pythonVenvStage.groovy b/vars/pythonVenvStage.groovy index 9dae366..ec4baf5 100644 --- a/vars/pythonVenvStage.groovy +++ b/vars/pythonVenvStage.groovy @@ -21,7 +21,7 @@ void call(Map config = [:], Closure body) { venvEnv = [ "VIRTUAL_ENV=${venvDir.join('/')}", - "PATH=${venvBinDir.join('/')}" + "PATH+CUSTOM=${venvBinDir.join('/')}" ] stage(runConfig.stepName) { @@ -43,23 +43,21 @@ void call(Map config = [:], Closure body) { if (runConfig.updatePip) { updateCmd = "${venvPython.join('/')} -m pip install --upgrade pip" echo "Updating pip with (${updateCmd})" - sh """ - env - ${updateCmd} - """ + echo "Environment is ${venvEnv}" + sh updateCmd } - // if (runConfig.installPipTools) { - // installCmd = "${venvPython.join('/')} -m pip install pip-tools" - // echo "Installing pip-tools with (${installCmd})" - // sh installCmd - // } - // if (fileExists(runConfig.requirementsFile)) { - // reqCmd = "pip-compile ${runConfig.requirementsFile}" - // echo "Collecting requirements with (${reqCmd})" - // sh reqCmd - // } - // echo 'Executing closure...' - // body() + if (runConfig.installPipTools) { + installCmd = "${venvPython.join('/')} -m pip install pip-tools" + echo "Installing pip-tools with (${installCmd})" + sh installCmd + } + if (fileExists(runConfig.requirementsFile)) { + reqCmd = "pip-compile ${runConfig.requirementsFile}" + echo "Collecting requirements with (${reqCmd})" + sh reqCmd + } + echo 'Executing closure...' + body() } } }