Skip to content

add check to the doctor that the 'six' python package is installed on… #2612

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

Merged
merged 2 commits into from
Mar 20, 2017
Merged
Changes from all commits
Commits
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
23 changes: 22 additions & 1 deletion lib/services/doctor-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ class DoctorService implements IDoctorService {

let androidToolsIssues = this.$androidToolsInfo.validateInfo();
let javaVersionIssue = await this.$androidToolsInfo.validateJavacVersion(sysInfo.javacVersion);
let doctorResult = result || androidToolsIssues || javaVersionIssue;
let pythonIssues = await this.validatePythonPackages();
let doctorResult = result || androidToolsIssues || javaVersionIssue || pythonIssues;

if (!configOptions || configOptions.trackResult) {
await this.$analyticsService.track("DoctorEnvironmentSetup", doctorResult ? "incorrect" : "correct");
Expand Down Expand Up @@ -213,5 +214,25 @@ class DoctorService implements IDoctorService {
spinner.stop();
}
}

private async validatePythonPackages(): Promise<boolean> {
let hasInvalidPackages = false;
if (this.$hostInfo.isDarwin) {
try {
let queryForSixPackage = await this.$childProcess.exec(`pip freeze | grep '^six=' | wc -l`);
let sixPackagesFoundCount = parseInt(queryForSixPackage);
if (sixPackagesFoundCount === 0) {
hasInvalidPackages = true;
this.$logger.warn("The Python 'six' package not found.");
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.");
}
} catch (error) {
this.$logger.warn("Couldn't retrieve installed python packages.");
this.$logger.out("We cannot verify your python installation is setup correctly. Please, make sure you have both 'python' and 'pip' installed.");
this.$logger.trace(`Error while validating Python packages. Error is: ${error.message}`);
}
}
return hasInvalidPackages;
}
}
$injector.register("doctorService", DoctorService);