Push /usr/bin to front of PATH for ios-deploy runs (#19281)

ios-deploy relies on LLDB.framework, which relies on /usr/bin/python and
the 'six' module that's installed on the system. However, it appears to
use the first version of Python on PATH, rather than explicitly
specifying the system install.  If a user has a custom install of Python
(e.g., via Homebrew or MacPorts) ahead of the system Python on their
PATH, LLDB.framework will pick up that version instead. If the user
hasn't installed the 'six' module, ios-deploy will fail with a
relatively cryptic error message.

This patch pushes /usr/bin to the front of PATH for the duration of the
ios-deploy run to avoid this scenario.

This patch also removes checks for package six.

Neither Flutter nor any of its direct dependencies/tooling relies on
package six. ios-deploy depends on LLDB.framework (included with Xcode),
which relies on a Python script that imports this package but uses
whichever Python is at the front of the path. Flutter now invokes
ios-deploy with a PATH with /usr/bin forced to the front in order to
avoid this problem.

We could have retained the check out of paranoia, but this seems
unnecessary since it's entirely possible LLDB.framework may one day drop
this dependency, in which case I'd expect the base system install of
Python would likely drop it as well.
This commit is contained in:
Chris Bracken
2018-07-11 17:33:06 -07:00
committed by GitHub
parent 2c00e5f218
commit 379a2d5654
4 changed files with 84 additions and 108 deletions

View File

@@ -43,7 +43,6 @@ void main() {
when(xcode.isInstalled).thenReturn(false);
when(xcode.xcodeSelectPath).thenReturn(null);
final IOSWorkflowTestTarget workflow = new IOSWorkflowTestTarget(
hasPythonSixModule: false,
hasHomebrew: false,
hasIosDeploy: false,
);
@@ -111,22 +110,6 @@ void main() {
CocoaPods: () => cocoaPods,
});
testUsingContext('Emits partial status when python six not installed', () async {
when(xcode.isInstalled).thenReturn(true);
when(xcode.versionText)
.thenReturn('Xcode 8.2.1\nBuild version 8C1002\n');
when(xcode.isInstalledAndMeetsVersionCheck).thenReturn(true);
when(xcode.eulaSigned).thenReturn(true);
when(xcode.isSimctlInstalled).thenReturn(true);
final IOSWorkflowTestTarget workflow = new IOSWorkflowTestTarget(hasPythonSixModule: false);
final ValidationResult result = await workflow.validate();
expect(result.type, ValidationType.partial);
}, overrides: <Type, Generator>{
IMobileDevice: () => iMobileDevice,
Xcode: () => xcode,
CocoaPods: () => cocoaPods,
});
testUsingContext('Emits partial status when homebrew not installed', () async {
when(xcode.isInstalled).thenReturn(true);
when(xcode.versionText)
@@ -327,7 +310,6 @@ class MockCocoaPods extends Mock implements CocoaPods {}
class IOSWorkflowTestTarget extends IOSWorkflow {
IOSWorkflowTestTarget({
this.hasPythonSixModule = true,
this.hasHomebrew = true,
bool hasIosDeploy = true,
String iosDeployVersionText = '1.9.2',
@@ -336,9 +318,6 @@ class IOSWorkflowTestTarget extends IOSWorkflow {
iosDeployVersionText = new Future<String>.value(iosDeployVersionText),
hasIDeviceInstaller = new Future<bool>.value(hasIDeviceInstaller);
@override
final bool hasPythonSixModule;
@override
final bool hasHomebrew;