Skip to content
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

Temporarily fix support for folders in interpreter path setting #15806

Merged
merged 4 commits into from
Mar 30, 2021
Merged
Show file tree
Hide file tree
Changes from 2 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
1 change: 1 addition & 0 deletions news/2 Fixes/15782.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Temporarily fix support for folders in interpreter path setting.
10 changes: 7 additions & 3 deletions src/client/common/configSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import {
} from './types';
import { debounceSync } from './utils/decorators';
import { SystemVariables } from './variables/systemVariables';
import { getOSType, OSType } from './utils/platform';

const untildify = require('untildify');

Expand Down Expand Up @@ -748,8 +749,8 @@ function getPythonExecutable(pythonPath: string): string {
if (isValidPythonPath(path.join(pythonPath, executableName))) {
return path.join(pythonPath, executableName);
}
if (isValidPythonPath(path.join(pythonPath, 'scripts', executableName))) {
return path.join(pythonPath, 'scripts', executableName);
if (isValidPythonPath(path.join(pythonPath, 'Scripts', executableName))) {
return path.join(pythonPath, 'Scripts', executableName);
}
} else {
if (isValidPythonPath(path.join(pythonPath, executableName))) {
Expand All @@ -765,7 +766,10 @@ function getPythonExecutable(pythonPath: string): string {
}

function isValidPythonPath(pythonPath: string): boolean {
return fs.existsSync(pythonPath);
return (
fs.existsSync(pythonPath) &&
path.basename(getOSType() === OSType.Windows ? pythonPath.toLowerCase() : pythonPath).startsWith('python')
);
}

function convertSettingTypeToLogLevel(setting: LoggingLevelSettingType | undefined): LogLevel | 'off' {
Expand Down