From 80030c84bed9b536a8e770a22db8f609367c537c Mon Sep 17 00:00:00 2001 From: Xieshen Date: Fri, 13 Oct 2023 14:50:12 -0400 Subject: [PATCH] fix: read property to determine if using python virtual env --- .../java/com/redhat/exhort/providers/PythonPipProvider.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/redhat/exhort/providers/PythonPipProvider.java b/src/main/java/com/redhat/exhort/providers/PythonPipProvider.java index b88dc9ca..fddbbf84 100644 --- a/src/main/java/com/redhat/exhort/providers/PythonPipProvider.java +++ b/src/main/java/com/redhat/exhort/providers/PythonPipProvider.java @@ -189,7 +189,9 @@ private PythonControllerBase getPythonController() { String[] parts = pythonPipBinaries.split(";;"); var python = parts[0]; var pip = parts[1]; - String useVirtualPythonEnv = Objects.requireNonNullElse(System.getenv("EXHORT_PYTHON_VIRTUAL_ENV"), "false"); + String useVirtualPythonEnv = Objects.requireNonNullElseGet( + System.getenv("EXHORT_PYTHON_VIRTUAL_ENV"), + () -> Objects.requireNonNullElse(System.getProperty("EXHORT_PYTHON_VIRTUAL_ENV"), "false")); PythonControllerBase pythonController; if(this.pythonController == null) { if (Boolean.parseBoolean(useVirtualPythonEnv)) {