-
Notifications
You must be signed in to change notification settings - Fork 346
Remove more unnecessary interpreter types #31
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,7 +33,12 @@ | |
| "@typescript-eslint/no-empty-interface": "off", | ||
| "@typescript-eslint/no-non-null-assertion": "off", | ||
| "no-unused-vars": "off", | ||
| "@typescript-eslint/no-unused-vars": "error", | ||
| "@typescript-eslint/no-unused-vars": [ | ||
| "error", | ||
| { | ||
| "argsIgnorePattern": "^_" | ||
| } | ||
| ], | ||
| "no-use-before-define": "off", | ||
| "@typescript-eslint/no-use-before-define": [ | ||
| "error", | ||
|
|
@@ -87,6 +92,7 @@ | |
| "no-control-regex": "off", | ||
| "function-paren-newline": "off", | ||
| "consistent-return": "off", | ||
| "class-methods-use-this": "off", | ||
|
||
| "no-extend-native": "off", | ||
| "no-multi-str": "off", | ||
| "no-param-reassign": "off", | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,26 +3,8 @@ | |
|
|
||
| 'use strict'; | ||
|
|
||
| import { Architecture } from '../../common/utils/platform'; | ||
| import { PythonVersion } from './pythonVersion'; | ||
|
|
||
| /** | ||
| * The supported Python environment types. | ||
| */ | ||
| export enum EnvironmentType { | ||
|
||
| Unknown = 'Unknown', | ||
| Conda = 'Conda', | ||
| VirtualEnv = 'VirtualEnv', | ||
| Pipenv = 'PipEnv', | ||
| Pyenv = 'Pyenv', | ||
| Venv = 'Venv', | ||
| WindowsStore = 'WindowsStore', | ||
| Poetry = 'Poetry', | ||
| VirtualEnvWrapper = 'VirtualEnvWrapper', | ||
| Global = 'Global', | ||
| System = 'System' | ||
| } | ||
|
|
||
| type ReleaseLevel = 'alpha' | 'beta' | 'candidate' | 'final' | 'unknown'; | ||
|
|
||
| /** | ||
|
|
@@ -46,7 +28,6 @@ export type InterpreterInformation = { | |
| path: string; | ||
| version?: PythonVersion; | ||
| sysVersion?: string; | ||
| architecture: Architecture; | ||
| sysPrefix: string; | ||
| }; | ||
|
|
||
|
|
@@ -64,7 +45,4 @@ export type InterpreterInformation = { | |
| // and doesn't really belong here. | ||
| export type PythonEnvironment = InterpreterInformation & { | ||
| displayName?: string; | ||
| envType: EnvironmentType; | ||
| envName?: string; | ||
| envPath?: string; | ||
|
||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,6 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| import { SemVer } from 'semver'; | ||
| import '../../common/extensions'; // For string.splitLines() | ||
|
|
||
| /** | ||
| * A representation of a Python runtime's version. | ||
| * | ||
|
|
@@ -28,47 +25,3 @@ export type PythonVersion = { | |
| build: string[]; | ||
| prerelease: string[]; | ||
| }; | ||
|
|
||
| /** | ||
| * Convert a Python version string. | ||
| * | ||
| * The supported formats are: | ||
| * | ||
| * * MAJOR.MINOR.MICRO-RELEASE_LEVEL | ||
| * | ||
| * (where RELEASE_LEVEL is one of {alpha,beta,candidate,final}) | ||
| * | ||
| * Everything else, including an empty string, results in `undefined`. | ||
| */ | ||
| // Eventually we will want to also support the release serial | ||
| // (e.g. beta1, candidate3) and maybe even release abbreviations | ||
| // (e.g. 3.9.2b1, 3.8.10rc3). | ||
| export function parsePythonVersion(raw: string): PythonVersion | undefined { | ||
|
||
| if (!raw || raw.trim().length === 0) { | ||
| return; | ||
| } | ||
| const versionParts = (raw || '') | ||
| .split('.') | ||
| .map((item) => item.trim()) | ||
| .filter((item) => item.length > 0) | ||
| .filter((_, index) => index < 4); | ||
|
|
||
| if (versionParts.length > 0 && versionParts[versionParts.length - 1].indexOf('-') > 0) { | ||
| const lastPart = versionParts[versionParts.length - 1]; | ||
| versionParts[versionParts.length - 1] = lastPart.split('-')[0].trim(); | ||
| versionParts.push(lastPart.split('-')[1].trim()); | ||
| } | ||
| while (versionParts.length < 4) { | ||
| versionParts.push(''); | ||
| } | ||
| // Exclude PII from `version_info` to ensure we don't send this up via telemetry. | ||
| for (let index = 0; index < 3; index += 1) { | ||
| versionParts[index] = /^\d+$/.test(versionParts[index]) ? versionParts[index] : '0'; | ||
| } | ||
| if (['alpha', 'beta', 'candidate', 'final'].indexOf(versionParts[3]) === -1) { | ||
| versionParts.pop(); | ||
| } | ||
| const numberParts = `${versionParts[0]}.${versionParts[1]}.${versionParts[2]}`; | ||
| const rawVersion = versionParts.length === 4 ? `${numberParts}-${versionParts[3]}` : numberParts; | ||
| return new SemVer(rawVersion); | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For existing code