Skip to content

Skip windows store interpreters found via windows registry when discovering #20613

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 31, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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