From d97c7e443ae80096343495c4d35c8e7c8571c20c Mon Sep 17 00:00:00 2001 From: Don Jayamanne Date: Wed, 10 Jul 2024 20:25:46 +1000 Subject: [PATCH] Native Conda Telemetry (#23787) --- .../composite/envsCollectionService.ts | 20 +++++++++---------- src/client/telemetry/index.ts | 10 ++++++++++ 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/src/client/pythonEnvironments/base/locators/composite/envsCollectionService.ts b/src/client/pythonEnvironments/base/locators/composite/envsCollectionService.ts index 70d4e9674d02..901b2a735a5e 100644 --- a/src/client/pythonEnvironments/base/locators/composite/envsCollectionService.ts +++ b/src/client/pythonEnvironments/base/locators/composite/envsCollectionService.ts @@ -3,7 +3,6 @@ import { Event, EventEmitter, workspace } from 'vscode'; import '../../../../common/extensions'; -import * as fsPath from 'path'; import { createDeferred, Deferred } from '../../../../common/utils/async'; import { StopWatch } from '../../../../common/utils/stopWatch'; import { traceError, traceInfo, traceVerbose } from '../../../../logging'; @@ -29,7 +28,7 @@ import { createNativeGlobalPythonFinder, NativeEnvInfo } from '../common/nativeP import { pathExists } from '../../../../common/platform/fs-paths'; import { noop } from '../../../../common/utils/misc'; import { parseVersion } from '../../info/pythonVersion'; -import { Conda } from '../../../common/environmentManagers/conda'; +import { Conda, isCondaEnvironment } from '../../../common/environmentManagers/conda'; /** * A service which maintains the collection of known environments. @@ -310,6 +309,7 @@ export class EnvsCollectionService extends PythonEnvsWatcher { - if (e.executable.sysPrefix) { - const metadataFolder = fsPath.join(e.executable.sysPrefix, 'conda-meta'); - if (!(await pathExists(metadataFolder))) { - missingEnvironments.invalidCondaEnvs += 1; - } + if (e.executable.sysPrefix && !(await pathExists(e.executable.sysPrefix))) { + missingEnvironments.prefixNotExistsCondaEnvs += 1; + } + if (e.executable.filename && (await isCondaEnvironment(e.executable.filename))) { + missingEnvironments.invalidCondaEnvs += 1; } }), ); - missingEnvironments.invalidCondaEnvs = envs - .filter((e) => e.kind === PythonEnvKind.Conda) - .filter((e) => e.executable.sysPrefix && e.executable.sysPrefix).length; const nativeEnvironmentsWithoutPython = nativeEnvs.filter((e) => e.executable === undefined).length; const nativeCondaEnvs = nativeEnvs.filter( @@ -552,6 +549,7 @@ export class EnvsCollectionService extends PythonEnvsWatcher