From a93e9af24943b7812a614d2be8014f6939e8b31c Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 2 Mar 2022 09:25:32 -0800 Subject: [PATCH] src/sage/features/__init__.py: Simplify Executable.absolute_path --- src/sage/features/__init__.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/sage/features/__init__.py b/src/sage/features/__init__.py index 83743ce2bed..39f993d11b1 100644 --- a/src/sage/features/__init__.py +++ b/src/sage/features/__init__.py @@ -508,13 +508,12 @@ def absolute_path(self) -> str: Executable 'does-not-exist-xxxxyxyyxyy' not found on PATH. """ if SAGE_LOCAL: - sage_venv = Path(SAGE_VENV) - sage_local = Path(SAGE_LOCAL) - if sage_venv.resolve() != sage_local.resolve(): + if Path(SAGE_VENV).resolve() != Path(SAGE_LOCAL).resolve(): # As sage.env currently gives SAGE_LOCAL a fallback value from SAGE_VENV, # SAGE_LOCAL is never unset. So we only use it if it differs from SAGE_VENV. - PATH = ':'.join(str(p) for p in [sage_venv / 'bin', sage_local / 'bin']) - path = shutil.which(self.executable, path=PATH) + search_path = ':'.join([os.path.join(SAGE_VENV, 'bin'), + os.path.join(SAGE_LOCAL, 'bin')]) + path = shutil.which(self.executable, path=search_path) if path is not None: return path # Now look up in the regular PATH.