From d2b2e549a59c0c953dd5c18dd4d006f4f335f01d Mon Sep 17 00:00:00 2001 From: Ryan Clary <9618975+mrclary@users.noreply.github.com> Date: Fri, 20 Dec 2024 10:45:01 -0800 Subject: [PATCH] Replace set with list when searching for installed program. set did not guarantee order, so could be non-deterministic. Also, it is desirable for the priority to be extra_paths, conda, pyenv, then system paths --- spyder/utils/programs.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spyder/utils/programs.py b/spyder/utils/programs.py index b67a235fe90..591aa9b8c70 100644 --- a/spyder/utils/programs.py +++ b/spyder/utils/programs.py @@ -84,7 +84,6 @@ def is_program_installed(basename, extra_paths=[]): On macOS systems, a .app is considered installed if it exists. """ home = get_home_dir() - req_paths = [] if ( sys.platform == 'darwin' and basename.endswith('.app') @@ -110,9 +109,10 @@ def is_program_installed(basename, extra_paths=[]): 'Miniconda3', 'Anaconda3', 'Miniconda', 'Anaconda'] conda = [osp.join(*p, 'condabin') for p in itertools.product(a, b)] - req_paths.extend(pyenv + conda + extra_paths) - for path in set(os.environ['PATH'].split(os.pathsep) + req_paths): + for path in ( + extra_paths + conda + pyenv + os.getenv('PATH', []).split(os.pathsep) + ): abspath = osp.join(path, basename) if osp.isfile(abspath): return abspath