Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
1126834
Drop `PythonEnvInfo.id`.
ericsnowcurrently Sep 22, 2020
0d22681
Make buildEmptyEnvInfo() a public helper.
ericsnowcurrently Sep 23, 2020
4468e74
Add a copyEnvInfo() helper.
ericsnowcurrently Sep 23, 2020
94137c8
Add locator utils.
ericsnowcurrently Sep 21, 2020
eea499b
Use getEnvs() in ComponentAdapter.getInterpreters().
ericsnowcurrently Sep 23, 2020
7a2fdfc
Add PythonEnvUpdatedEvent.index.
ericsnowcurrently Sep 23, 2020
ca2ec73
Fix reducer and resolver.
ericsnowcurrently Sep 28, 2020
af6c7c5
Make parseVersion() a public helper.
ericsnowcurrently Sep 23, 2020
e737607
buildEmptyEnvInfo() -> buildEnvInfo().
ericsnowcurrently Sep 23, 2020
51c6dee
Factor out updateEnv().
ericsnowcurrently Sep 23, 2020
2ecd537
Use lodash.cloneDeep() to deep-copy objects.
ericsnowcurrently Sep 23, 2020
9cd6c7d
Drop the testing helper createEnv().
ericsnowcurrently Sep 23, 2020
6b50973
Factor out getURIFilter().
ericsnowcurrently Sep 24, 2020
ad8f195
Allow locator queries to mix search locations and non.
ericsnowcurrently Sep 24, 2020
2b70a1c
Match subdirectories in locator queries.
ericsnowcurrently Sep 24, 2020
7b19538
Make PythonVersion.release optional.
ericsnowcurrently Sep 24, 2020
eb746f9
Drop the fixPath() testing helper.
ericsnowcurrently Sep 24, 2020
20c46da
lint
ericsnowcurrently Sep 24, 2020
9d970f5
Clarify what a missing query field means.
ericsnowcurrently Sep 28, 2020
ce53e54
Make PythonLocatorQuery.searchLocations more explicit about the non-r…
ericsnowcurrently Sep 28, 2020
3d85fa7
Fix a sonarcloud warning.
ericsnowcurrently Sep 28, 2020
e47322b
Filter out undefined locations in the tests.
ericsnowcurrently Sep 28, 2020
f97bb31
Simplify the searchLocations logic a little.
ericsnowcurrently Sep 28, 2020
1edb76d
Strip trailing slashes in paths.
ericsnowcurrently Sep 28, 2020
fd5e37b
Add getMinimalPartialInfo().
ericsnowcurrently Sep 29, 2020
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
Prev Previous commit
Next Next commit
lint
  • Loading branch information
ericsnowcurrently committed Sep 28, 2020
commit 20c46daceae752dcd121ef6e5d84446b170e4ab6
2 changes: 1 addition & 1 deletion src/client/pythonEnvironments/base/info/pythonVersion.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

import { EMPTY_VERSION, parseBasicVersionInfo } from '../../../../client/common/utils/version';
import { EMPTY_VERSION, parseBasicVersionInfo } from '../../../common/utils/version';

import { PythonReleaseLevel, PythonVersion } from '.';

Expand Down
42 changes: 25 additions & 17 deletions src/client/pythonEnvironments/base/locatorUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,28 +30,36 @@ export function getQueryFilter(query: PythonLocatorQuery): (env: PythonEnvInfo)
}));
}
}
return (env) => {
if (kinds !== undefined) {
if (!kinds.includes(env.kind)) {
return false;
}
function checkKind(env: PythonEnvInfo): boolean {
if (kinds === undefined) {
return true;
}
return kinds.includes(env.kind);
}
function checkSearchLocation(env: PythonEnvInfo): boolean {
if (env.searchLocation === undefined) {
if (!includeGlobal) {
return false;
}
} else if (locationFilters === undefined) {
// It is not a "rooted" env.
return includeGlobal;
}

// It is a "rooted" env.
if (locationFilters === undefined) {
Comment thread
ericsnowcurrently marked this conversation as resolved.
Outdated
if (query.searchLocations === null) {
// The caller explicitly refused rooted envs.
return false;
}
if (query.searchLocations && query.searchLocations.length > 0) {
// Only envs without searchLocation set were requested?
return false;
}
} else {
if (!locationFilters.some((filter) => filter(env.searchLocation!))) {
return false;
}
// `query.searchLocations` only had `null` in it.
return !query.searchLocations || query.searchLocations.length === 0;
}
// Check against the requested roots.
return locationFilters.some((filter) => filter(env.searchLocation!));
}
return (env) => {
if (!checkKind(env)) {
return false;
}
if (!checkSearchLocation(env)) {
return false;
}
return true;
Comment thread
ericsnowcurrently marked this conversation as resolved.
};
Expand Down