Skip to content

Commit 25185ac

Browse files
committed
fix checkPyVenv object
1 parent 80fb4e4 commit 25185ac

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

src/eim/verifySetup.ts

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,16 @@ export async function isIdfSetupValid(
9898
const missingTools = failedToolsResult.map((t) => t.name).join(", ");
9999
return [false, `Missing required tools: ${missingTools}`];
100100
}
101-
const pyEnvReqs = await checkPyVenv(venvPythonPath, envVars["IDF_PATH"]);
102-
if (!pyEnvReqs) {
103-
return [false, "Python virtual environment or requirements are not satisfied"];
101+
const [pyEnvReqsValid, pyEnvReqsMsg] = await checkPyVenv(
102+
venvPythonPath,
103+
envVars["IDF_PATH"]
104+
);
105+
if (!pyEnvReqsValid) {
106+
return [
107+
pyEnvReqsValid,
108+
pyEnvReqsMsg ||
109+
"Python virtual environment or requirements are not satisfied",
110+
];
104111
}
105112
return [true, ""];
106113
} catch (error) {
@@ -113,7 +120,10 @@ export async function isIdfSetupValid(
113120
}
114121
}
115122

116-
export async function checkPyVenv(pyVenvPath: string, espIdfPath: string) {
123+
export async function checkPyVenv(
124+
pyVenvPath: string,
125+
espIdfPath: string
126+
): Promise<[boolean, string]> {
117127
const pyExists = await pathExists(pyVenvPath);
118128
if (!pyExists) {
119129
return [false, `${pyVenvPath} does not exist.`];
@@ -130,7 +140,7 @@ export async function checkPyVenv(pyVenvPath: string, espIdfPath: string) {
130140
requirements = join(espIdfPath, "requirements.txt");
131141
const requirementsExists = await pathExists(requirements);
132142
if (!requirementsExists) {
133-
return false;
143+
return [false, `${requirements} doesn't exist.`];
134144
}
135145
}
136146
const reqsResults = await startPythonReqsProcess(

0 commit comments

Comments
 (0)