Skip to content

Commit

Permalink
Revert changes introduced for Native Locator (#23663)
Browse files Browse the repository at this point in the history
  • Loading branch information
DonJayamanne authored Jun 24, 2024
1 parent c879780 commit 54fd4ae
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 44 deletions.
43 changes: 0 additions & 43 deletions src/client/pythonEnvironments/base/info/environmentInfoService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,6 @@ export interface IEnvironmentInfoService {
env: PythonEnvInfo,
priority?: EnvironmentInfoServiceQueuePriority,
): Promise<InterpreterInformation | undefined>;
/**
* Get the mandatory interpreter information for the given environment.
* E.g. executable path, version and sysPrefix are considered mandatory.
* However if we only have part of the version, thats still sufficient.
* If the fully resolved and acurate information for all parts of the env is required, then
* used `getEnvironmentInfo`.
* @param env The environment to get the interpreter information for.
* @param priority The priority of the request.
*/
getMandatoryEnvironmentInfo(
env: PythonEnvInfo,
priority?: EnvironmentInfoServiceQueuePriority,
): Promise<InterpreterInformation | undefined>;
/**
* Reset any stored interpreter information for the given environment.
* @param searchLocation Search location of the environment.
Expand Down Expand Up @@ -137,36 +124,6 @@ class EnvironmentInfoService implements IEnvironmentInfoService {
return deferred.promise;
}

public async getMandatoryEnvironmentInfo(
env: PythonEnvInfo,
priority?: EnvironmentInfoServiceQueuePriority,
): Promise<InterpreterInformation | undefined> {
const interpreterPath = env.executable.filename;
const result = this.cache.get(normCasePath(interpreterPath));
if (result !== undefined) {
// Another call for this environment has already been made, return its result.
return result.promise;
}

const deferred = createDeferred<InterpreterInformation>();
const info = EnvironmentInfoService.getInterpreterInfo(env, true);
if (info !== undefined) {
this.cache.set(normCasePath(interpreterPath), deferred);
deferred.resolve(info);
return info;
}

this.cache.set(normCasePath(interpreterPath), deferred);
this._getEnvironmentInfo(env, priority)
.then((r) => {
deferred.resolve(r);
})
.catch((ex) => {
deferred.reject(ex);
});
return deferred.promise;
}

public async _getEnvironmentInfo(
env: PythonEnvInfo,
priority?: EnvironmentInfoServiceQueuePriority,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export class PythonEnvsResolver implements IResolvingLocator {
state.pending += 1;
// It's essential we increment the pending call count before any asynchronus calls in this method.
// We want this to be run even when `resolveInBackground` is called in background.
const info = await this.environmentInfoService.getMandatoryEnvironmentInfo(seen[envIndex]);
const info = await this.environmentInfoService.getEnvironmentInfo(seen[envIndex]);
const old = seen[envIndex];
if (info) {
const resolvedEnv = getResolvedEnv(info, seen[envIndex], old.identifiedUsingNativeLocator);
Expand Down

0 comments on commit 54fd4ae

Please sign in to comment.