Skip to content

Commit

Permalink
try to stabilize pyexe 3
Browse files Browse the repository at this point in the history
  • Loading branch information
giampaolo committed Dec 19, 2024
1 parent 6a86bf9 commit aa166e9
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions psutil/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit aa166e9

Please sign in to comment.