Skip to content

Commit 0b7540c

Browse files
authored
add check to the doctor that the 'six' python package is installed on… (#2612)
* add check to the doctor that the 'six' python package is installed on Mac * Improve the info for python 'six' package checks in the doctor
1 parent 2a00f89 commit 0b7540c

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

lib/services/doctor-service.ts

+22-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@ class DoctorService implements IDoctorService {
105105

106106
let androidToolsIssues = this.$androidToolsInfo.validateInfo();
107107
let javaVersionIssue = await this.$androidToolsInfo.validateJavacVersion(sysInfo.javacVersion);
108-
let doctorResult = result || androidToolsIssues || javaVersionIssue;
108+
let pythonIssues = await this.validatePythonPackages();
109+
let doctorResult = result || androidToolsIssues || javaVersionIssue || pythonIssues;
109110

110111
if (!configOptions || configOptions.trackResult) {
111112
await this.$analyticsService.track("DoctorEnvironmentSetup", doctorResult ? "incorrect" : "correct");
@@ -213,5 +214,25 @@ class DoctorService implements IDoctorService {
213214
spinner.stop();
214215
}
215216
}
217+
218+
private async validatePythonPackages(): Promise<boolean> {
219+
let hasInvalidPackages = false;
220+
if (this.$hostInfo.isDarwin) {
221+
try {
222+
let queryForSixPackage = await this.$childProcess.exec(`pip freeze | grep '^six=' | wc -l`);
223+
let sixPackagesFoundCount = parseInt(queryForSixPackage);
224+
if (sixPackagesFoundCount === 0) {
225+
hasInvalidPackages = true;
226+
this.$logger.warn("The Python 'six' package not found.");
227+
this.$logger.out("This package is required by the Debugger library (LLDB) for iOS. You can install it by running 'pip install six' from the terminal.");
228+
}
229+
} catch (error) {
230+
this.$logger.warn("Couldn't retrieve installed python packages.");
231+
this.$logger.out("We cannot verify your python installation is setup correctly. Please, make sure you have both 'python' and 'pip' installed.");
232+
this.$logger.trace(`Error while validating Python packages. Error is: ${error.message}`);
233+
}
234+
}
235+
return hasInvalidPackages;
236+
}
216237
}
217238
$injector.register("doctorService", DoctorService);

0 commit comments

Comments
 (0)