Skip to content

Commit 89ca69f

Browse files
author
Kartik Raj
committed
Commit .venv folder
1 parent 4cf3644 commit 89ca69f

File tree

2 files changed

+21
-23
lines changed
  • src
    • client/pythonEnvironments/discovery/locators/services
    • test/pythonEnvironments/common/envlayouts/pipenv/project1/.venv/Scripts

2 files changed

+21
-23
lines changed

src/client/pythonEnvironments/discovery/locators/services/pipEnvHelper.ts

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -39,29 +39,6 @@ async function getAssociatedPipfile(
3939
return undefined;
4040
}
4141

42-
/**
43-
* Returns true if interpreter path belongs to a global pipenv environment which is associated with a particular folder,
44-
* false otherwise.
45-
* @param interpreterPath Absolute path to any python interpreter.
46-
*/
47-
export async function isPipenvEnvironmentRelatedToFolder(interpreterPath: string, folder: string): Promise<boolean> {
48-
const pipFileCorrespondingToEnvironment = await getPipfileIfGlobalPipenvEnvironment(interpreterPath);
49-
if (!pipFileCorrespondingToEnvironment) {
50-
return false;
51-
}
52-
const projectCorrespondingToEnvironment = path.dirname(pipFileCorrespondingToEnvironment);
53-
54-
// PIPENV_NO_INHERIT is used to tell pipenv not to look for Pipfile in parent directories
55-
// https://pipenv.pypa.io/en/latest/advanced/#pipenv.environments.PIPENV_NO_INHERIT
56-
const pipFile = await getAssociatedPipfile(folder, !getEnvironmentVariable('PIPENV_NO_INHERIT'));
57-
if (!pipFile) {
58-
return false;
59-
}
60-
const projectCorrespondingToFolder = path.dirname(pipFile);
61-
62-
return projectCorrespondingToEnvironment === projectCorrespondingToFolder;
63-
}
64-
6542
/**
6643
* If interpreter path belongs to a pipenv environment which is located inside a project, return associated Pipfile,
6744
* otherwise return `undefined`.
@@ -129,3 +106,23 @@ export async function isPipenvEnvironment(interpreterPath: string): Promise<bool
129106
}
130107
return false;
131108
}
109+
110+
/**
111+
* Returns true if interpreter path belongs to a global pipenv environment which is associated with a particular folder,
112+
* false otherwise.
113+
* @param interpreterPath Absolute path to any python interpreter.
114+
*/
115+
export async function isPipenvEnvironmentRelatedToFolder(interpreterPath: string, folder: string): Promise<boolean> {
116+
const pipFileAssociatedWithEnvironment = await getPipfileIfGlobalPipenvEnvironment(interpreterPath);
117+
if (!pipFileAssociatedWithEnvironment) {
118+
return false;
119+
}
120+
121+
// PIPENV_NO_INHERIT is used to tell pipenv not to look for Pipfile in parent directories
122+
// https://pipenv.pypa.io/en/latest/advanced/#pipenv.environments.PIPENV_NO_INHERIT
123+
const pipFileAssociatedWithFolder = await getAssociatedPipfile(folder, !getEnvironmentVariable('PIPENV_NO_INHERIT'));
124+
if (!pipFileAssociatedWithFolder) {
125+
return false;
126+
}
127+
return pipFileAssociatedWithEnvironment === pipFileAssociatedWithFolder;
128+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Not real python exe

0 commit comments

Comments
 (0)