From aa166e9b688784c44834c6deeec929698f75804a Mon Sep 17 00:00:00 2001 From: Giampaolo Rodola Date: Thu, 19 Dec 2024 15:27:10 +0100 Subject: [PATCH] try to stabilize pyexe 3 --- psutil/tests/__init__.py | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/psutil/tests/__init__.py b/psutil/tests/__init__.py index 38486f854..7bc6d9a8d 100644 --- a/psutil/tests/__init__.py +++ b/psutil/tests/__init__.py @@ -267,19 +267,14 @@ def attempt(exe): # We need to set __PYVENV_LAUNCHER__ to sys.executable for the # base python executable to know about the environment. env["__PYVENV_LAUNCHER__"] = sys.executable - exe = os.path.realpath(base) - elif GITHUB_ACTIONS: - exe = os.path.realpath(sys.executable) - elif MACOS: - exe = ( - attempt(sys.executable) - or attempt(shutil.which("python%s.%s" % sys.version_info[:2])) - or attempt(psutil.Process().exe()) - ) - if not exe: - raise ValueError("can't find python exe real abspath") - else: - exe = os.path.realpath(sys.executable) + + exe = ( + attempt(sys.executable) + or attempt(shutil.which("python%s.%s" % sys.version_info[:2])) + or attempt(psutil.Process().exe()) + ) + if not exe: + raise ValueError("can't find python exe real abspath") return exe, env