diff --git a/packages/flutter_tools/lib/src/ios/ios_workflow.dart b/packages/flutter_tools/lib/src/ios/ios_workflow.dart index 31ed653e5f..fae1f2a65b 100644 --- a/packages/flutter_tools/lib/src/ios/ios_workflow.dart +++ b/packages/flutter_tools/lib/src/ios/ios_workflow.dart @@ -40,6 +40,8 @@ class IOSWorkflow extends DoctorValidator implements Workflow { bool get hasHomebrew => os.which('brew') != null; + bool get hasPythonSixModule => exitsHappy(['python', '-c', 'import six']); + bool get _iosDeployIsInstalledAndMeetsVersionCheck { if (!hasIosDeploy) return false; @@ -55,6 +57,7 @@ class IOSWorkflow extends DoctorValidator implements Workflow { Future validate() async { List messages = []; ValidationType xcodeStatus = ValidationType.missing; + ValidationType pythonStatus = ValidationType.missing; ValidationType brewStatus = ValidationType.missing; String xcodeVersionInfo; @@ -90,6 +93,17 @@ class IOSWorkflow extends DoctorValidator implements Workflow { )); } + // Python dependencies installed + if (hasPythonSixModule) { + pythonStatus = ValidationType.installed; + } else { + pythonStatus = ValidationType.missing; + messages.add(new ValidationMessage.error( + 'Python installation missing module "six".\n' + 'Install via \'pip install six\' or \'sudo easy_install six\'.' + )); + } + // brew installed if (hasHomebrew) { brewStatus = ValidationType.installed; @@ -134,7 +148,7 @@ class IOSWorkflow extends DoctorValidator implements Workflow { } return new ValidationResult( - [xcodeStatus, brewStatus].reduce(_mergeValidationTypes), + [xcodeStatus, pythonStatus, brewStatus].reduce(_mergeValidationTypes), messages, statusInfo: xcodeVersionInfo ); diff --git a/packages/flutter_tools/test/src/ios/ios_workflow_test.dart b/packages/flutter_tools/test/src/ios/ios_workflow_test.dart index 0a6921fe86..3bd6c801fc 100644 --- a/packages/flutter_tools/test/src/ios/ios_workflow_test.dart +++ b/packages/flutter_tools/test/src/ios/ios_workflow_test.dart @@ -21,6 +21,7 @@ void main() { testUsingContext('Emit missing status when nothing is installed', () async { when(xcode.isInstalled).thenReturn(false); IOSWorkflowTestTarget workflow = new IOSWorkflowTestTarget() + ..hasPythonSixModule = false ..hasHomebrew = false ..hasIosDeploy = false; ValidationResult result = await workflow.validate(); @@ -56,6 +57,18 @@ void main() { expect(result.type, ValidationType.partial); }, overrides: { Xcode: () => xcode }); + testUsingContext('Emits partial status when python six not installed', () async { + when(xcode.isInstalled).thenReturn(true); + when(xcode.xcodeVersionText) + .thenReturn('Xcode 8.2.1\nBuild version 8C1002\n'); + when(xcode.isInstalledAndMeetsVersionCheck).thenReturn(true); + when(xcode.eulaSigned).thenReturn(true); + IOSWorkflowTestTarget workflow = new IOSWorkflowTestTarget() + ..hasPythonSixModule = false; + ValidationResult result = await workflow.validate(); + expect(result.type, ValidationType.partial); + }, overrides: { Xcode: () => xcode }); + testUsingContext('Emits partial status when homebrew not installed', () async { when(xcode.isInstalled).thenReturn(true); when(xcode.xcodeVersionText) @@ -107,6 +120,9 @@ void main() { class MockXcode extends Mock implements Xcode {} class IOSWorkflowTestTarget extends IOSWorkflow { + @override + bool hasPythonSixModule = true; + @override bool hasHomebrew = true;