Author: Jonas Devlieghere
Date: 2024-06-17T10:20:58-07:00
New Revision: a1994ae6247ddd0374c7eb3a5d421925117833ab

URL: 
https://github.com/llvm/llvm-project/commit/a1994ae6247ddd0374c7eb3a5d421925117833ab
DIFF: 
https://github.com/llvm/llvm-project/commit/a1994ae6247ddd0374c7eb3a5d421925117833ab.diff

LOG: [lldb] More reliably detect a virtual environment

More reliably detect whether the API tests are running in a virtual
environment by comparing sys.prefix and sys.base_prefix [1].

[1] https://docs.python.org/3/library/sys.html#sys.base_prefix

Added: 
    

Modified: 
    lldb/test/API/lit.cfg.py

Removed: 
    


################################################################################
diff  --git a/lldb/test/API/lit.cfg.py b/lldb/test/API/lit.cfg.py
index 1e99c8cb95d16..48c5f49e78e01 100644
--- a/lldb/test/API/lit.cfg.py
+++ b/lldb/test/API/lit.cfg.py
@@ -7,6 +7,7 @@
 import shlex
 import shutil
 import subprocess
+import sys
 
 import lit.formats
 
@@ -64,7 +65,7 @@ def find_python_interpreter():
 
     # If we're running in a virtual environment, we already have a copy of the
     # Python executable.
-    if "VIRTUAL_ENV" in config.environment:
+    if sys.prefix != sys.base_prefix:
         return None
 
     # Avoid doing any work if we already copied the binary.


        
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to