forked from microsoft/vscode-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.ts
More file actions
24 lines (21 loc) · 896 Bytes
/
Copy pathutils.ts
File metadata and controls
24 lines (21 loc) · 896 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
import { traceError, traceVerbose } from '../logging';
import { PythonVersion } from '../pythonEnvironments/base/info';
import { parseVersion } from '../pythonEnvironments/base/info/pythonVersion';
import { PythonEnvironment } from './types';
export function parsePythonEnvironmentVersion(pythonEnv: PythonEnvironment): PythonVersion | undefined {
if (pythonEnv.version === 'no-python') {
traceVerbose(`Skipping environment without Python: ${pythonEnv.displayName}`);
return undefined;
}
try {
return parseVersion(pythonEnv.version);
} catch (error) {
traceError(
`Failed to parse version for environment "${pythonEnv.displayName}" from the Python Environments extension`,
error,
);
return undefined;
}
}