Skip to content

Commit

Permalink
Skip windows store interpreters found via windows registry when disco…
Browse files Browse the repository at this point in the history
…vering (#20613)

Closes #20603
  • Loading branch information
Kartik Raj authored Jan 31, 2023
1 parent ec2af99 commit bf4091e
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
/* eslint-disable no-continue */
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

import { PythonEnvKind, PythonEnvSource } from '../../info';
import { BasicEnvInfo, IPythonEnvsIterator, Locator } from '../../locator';
import { getRegistryInterpreters } from '../../../common/windowsUtils';
import { traceError } from '../../../../logging';
import { isMicrosoftStoreDir } from '../../../common/environmentManagers/microsoftStoreEnv';

export class WindowsRegistryLocator extends Locator<BasicEnvInfo> {
public readonly providerId: string = 'windows-registry';
Expand All @@ -15,6 +17,12 @@ export class WindowsRegistryLocator extends Locator<BasicEnvInfo> {
const interpreters = await getRegistryInterpreters();
for (const interpreter of interpreters) {
try {
// Filter out Microsoft Store app directories. We have a store app locator that handles this.
// The python.exe available in these directories might not be python. It can be a store install
// shortcut that takes you to microsoft store.
if (isMicrosoftStoreDir(interpreter.interpreterPath)) {
continue;
}
const env: BasicEnvInfo = {
kind: PythonEnvKind.OtherGlobal,
executablePath: interpreter.interpreterPath,
Expand Down

0 comments on commit bf4091e

Please sign in to comment.