This commit is contained in:
Ryan VanderMeulen 2012-09-18 21:34:55 -04:00
Родитель 5842d25515 1194436ba8
Коммит 34f6daff64
4 изменённых файлов: 30 добавлений и 7 удалений

Просмотреть файл

@ -10,7 +10,9 @@
# bootstrap support. It does this through various means, including fetching
# content from the upstream source repository.
from __future__ import print_function, unicode_literals
# If we add unicode_literals, optparse breaks on Python 2.6.1 (which is needed
# to support OS X 10.6).
from __future__ import print_function
import os
import shutil

Просмотреть файл

@ -52,3 +52,23 @@ class BaseBootstrapper(object):
command.extend(packages)
self.run_as_root(command)
def check_output(self, *args, **kwargs):
"""Run subprocess.check_output even if Python doesn't provide it."""
fn = getattr(subprocess, 'check_output', BaseBootstrapper._check_output)
return fn(*args, **kwargs)
@staticmethod
def _check_output(*args, **kwargs):
"""Python 2.6 compatible implementation of subprocess.check_output."""
proc = subprocess.Popen(stdout=subprocess.PIPE, *args, **kwargs)
output, unused_err = proc.communicate()
retcode = proc.poll()
if retcode:
cmd = kwargs.get('args', args[0])
e = subprocess.CalledProcessError(retcode, cmd)
e.output = output
raise e
return output

Просмотреть файл

@ -2,7 +2,8 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
from __future__ import print_function, unicode_literals
# If we add unicode_literals, Python 2.6.1 (required for OS X 10.6) breaks.
from __future__ import print_function
import platform
import sys

Просмотреть файл

@ -30,7 +30,7 @@ through the App Store.
'''
XCODE_REQUIRED_LEGACY = '''
You will need to download nad install Xcode to build Firefox.
You will need to download and install Xcode to build Firefox.
Please complete the Xcode download and then relaunch this script.
'''
@ -119,7 +119,7 @@ class OSXBootstrapper(BaseBootstrapper):
# Once Xcode is installed, you need to agree to the license before you can
# use it.
try:
output = subprocess.check_output(['/usr/bin/xcrun', 'clang'],
output = self.check_output(['/usr/bin/xcrun', 'clang'],
stderr=subprocess.STDOUT)
except subprocess.CalledProcessError as e:
if 'license' in e.output:
@ -135,7 +135,7 @@ class OSXBootstrapper(BaseBootstrapper):
print(INSTALL_XCODE_COMMAND_LINE_TOOLS_STEPS)
sys.exit(1)
output = subprocess.check_output(['/usr/bin/clang', '--version'])
output = self.check_output(['/usr/bin/clang', '--version'])
match = RE_CLANG_VERSION.search(output)
if match is None:
raise Exception('Could not determine Clang version.')
@ -170,7 +170,7 @@ class OSXBootstrapper(BaseBootstrapper):
brew = self.which('brew')
assert brew is not None
installed = subprocess.check_output([brew, 'list']).split()
installed = self.check_output([brew, 'list']).split()
if 'python' not in installed:
self.ensure_xquartz()
@ -201,6 +201,6 @@ class OSXBootstrapper(BaseBootstrapper):
if self.os_version < 7 and 'llvm' not in installed:
print(HOMEBREW_OLD_CLANG)
subprocess.check_call([brew, '-v' 'install', 'llvm',
subprocess.check_call([brew, '-v', 'install', 'llvm',
'--with-clang', '--all-targets'])