From 120f5dd2dba76d72547401b134f83c79b20f8a30 Mon Sep 17 00:00:00 2001 From: Karthik Nadig Date: Wed, 3 Apr 2024 10:17:30 -0500 Subject: [PATCH] Add `homebrew` path to `conda` search list (microsoft/vscode-python#23171) Fixes https://github.com/microsoft/vscode-python/issues/23162 --- .../common/environmentManagers/conda.ts | 2 +- .../common/environmentManagers/conda.unit.test.ts | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/extensions/positron-python/src/client/pythonEnvironments/common/environmentManagers/conda.ts b/extensions/positron-python/src/client/pythonEnvironments/common/environmentManagers/conda.ts index bb844f45a0f..2ec5844f470 100644 --- a/extensions/positron-python/src/client/pythonEnvironments/common/environmentManagers/conda.ts +++ b/extensions/positron-python/src/client/pythonEnvironments/common/environmentManagers/conda.ts @@ -342,7 +342,7 @@ export class Conda { prefixes.push(home, path.join(localAppData, 'Continuum')); } } else { - prefixes.push('/usr/share', '/usr/local/share', '/opt'); + prefixes.push('/usr/share', '/usr/local/share', '/opt', '/opt/homebrew/bin'); if (home) { prefixes.push(home, path.join(home, 'opt')); } diff --git a/extensions/positron-python/src/test/pythonEnvironments/common/environmentManagers/conda.unit.test.ts b/extensions/positron-python/src/test/pythonEnvironments/common/environmentManagers/conda.unit.test.ts index ec90b913424..34d28d2b0f9 100644 --- a/extensions/positron-python/src/test/pythonEnvironments/common/environmentManagers/conda.unit.test.ts +++ b/extensions/positron-python/src/test/pythonEnvironments/common/environmentManagers/conda.unit.test.ts @@ -278,7 +278,11 @@ suite('Conda and its environments are located correctly', () => { opt: {}, }, }, - opt: {}, + opt: { + homebrew: { + bin: {}, + }, + }, usr: { share: { doc: {}, @@ -292,7 +296,14 @@ suite('Conda and its environments are located correctly', () => { }; }); - ['/usr/share', '/usr/local/share', '/opt', '/home/user', '/home/user/opt'].forEach((prefix) => { + [ + '/usr/share', + '/usr/local/share', + '/opt', + '/opt/homebrew/bin', + '/home/user', + '/home/user/opt', + ].forEach((prefix) => { const condaPath = `${prefix}/${condaDirName}`; test(`Must find conda in ${condaPath}`, async () => {