Bug 933499 - Fix bootstrap on fresh OS X 10.9 installations; r=ted

DONTBUILD (NPOTB) on a CLOSED TREE
This commit is contained in:
Gregory Szorc 2013-11-05 12:51:52 -08:00
parent f003200182
commit b33811a375

View File

@ -52,6 +52,14 @@ You will need to download and install Xcode to build Firefox.
Please complete the Xcode download and then relaunch this script.
'''
XCODE_NO_DEVELOPER_DIRECTORY = '''
xcode-select says you don't have a developer directory configured. We think
this is due to you not having Xcode installed (properly). We're going to
attempt to install Xcode through the App Store. If the App Store thinks you
have Xcode installed, please run xcode-select by hand until it stops
complaining and then re-run this script.
'''
XCODE_COMMAND_LINE_TOOLS_MISSING = '''
The Xcode command line tools are required to build Firefox.
'''
@ -182,18 +190,24 @@ class OSXBootstrapper(BaseBootstrapper):
# paths like /Applications/Xcode5-DP6.app.
elif self.os_version >= StrictVersion('10.7'):
select = self.which('xcode-select')
output = self.check_output([select, '--print-path'])
try:
output = self.check_output([select, '--print-path'],
stderr=subprocess.STDOUT)
except subprocess.CalledProcessError as e:
# This seems to appear on fresh OS X machines before any Xcode
# has been installed. It may only occur on OS X 10.9 and later.
if 'unable to get active developer directory' in e.output:
print(XCODE_NO_DEVELOPER_DIRECTORY)
self._install_xcode_app_store()
assert False # Above should exit.
# This isn't the most robust check in the world. It relies on the
# default value not being in an application bundle, which seems to
# hold on at least Mavericks.
if '.app/' not in output:
print(XCODE_REQUIRED)
subprocess.check_call(['open', XCODE_APP_STORE])
print('Once the install has finished, please relaunch this script.')
sys.exit(1)
self._install_xcode_app_store()
assert False # Above should exit.
# Once Xcode is installed, you need to agree to the license before you can
# use it.
@ -203,7 +217,12 @@ class OSXBootstrapper(BaseBootstrapper):
except subprocess.CalledProcessError as e:
if 'license' in e.output:
xcodebuild = self.which('xcodebuild')
subprocess.check_call([xcodebuild, '-license'])
try:
subprocess.check_call([xcodebuild, '-license'],
stderr=subprocess.STDOUT)
except subprocess.CalledProcessError as e:
if 'requires admin privileges' in e.output:
self.run_as_root([xcodebuild, '-license'])
# Even then we're not done! We need to install the Xcode command line tools.
# As of Mountain Lion, apparently the only way to do this is to go through a
@ -226,6 +245,11 @@ class OSXBootstrapper(BaseBootstrapper):
print(INSTALL_XCODE_COMMAND_LINE_TOOLS_STEPS)
sys.exit(1)
def _install_xcode_app_store(self):
subprocess.check_call(['open', XCODE_APP_STORE])
print('Once the install has finished, please relaunch this script.')
sys.exit(1)
def ensure_homebrew_packages(self):
self.brew = self.which('brew')
assert self.brew is not None