зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1249838 - Avoid dependency from the mozconfig loader on mach. r=gps
This commit is contained in:
Родитель
44a0b5f2d9
Коммит
4ae855e98c
|
@ -7,11 +7,12 @@ from __future__ import absolute_import, unicode_literals
|
||||||
import filecmp
|
import filecmp
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
import sys
|
||||||
import subprocess
|
import subprocess
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from mach.mixin.process import ProcessExecutionMixin
|
from mozpack import path as mozpath
|
||||||
|
|
||||||
|
|
||||||
MOZ_MYCONFIG_ERROR = '''
|
MOZ_MYCONFIG_ERROR = '''
|
||||||
|
@ -56,7 +57,7 @@ class MozconfigLoadException(Exception):
|
||||||
Exception.__init__(self, message)
|
Exception.__init__(self, message)
|
||||||
|
|
||||||
|
|
||||||
class MozconfigLoader(ProcessExecutionMixin):
|
class MozconfigLoader(object):
|
||||||
"""Handles loading and parsing of mozconfig files."""
|
"""Handles loading and parsing of mozconfig files."""
|
||||||
|
|
||||||
RE_MAKE_VARIABLE = re.compile('''
|
RE_MAKE_VARIABLE = re.compile('''
|
||||||
|
@ -214,7 +215,7 @@ class MozconfigLoader(ProcessExecutionMixin):
|
||||||
if path is None:
|
if path is None:
|
||||||
return result
|
return result
|
||||||
|
|
||||||
path = path.replace(os.sep, '/')
|
path = mozpath.normsep(path)
|
||||||
|
|
||||||
result['configure_args'] = []
|
result['configure_args'] = []
|
||||||
result['make_extra'] = []
|
result['make_extra'] = []
|
||||||
|
@ -222,13 +223,22 @@ class MozconfigLoader(ProcessExecutionMixin):
|
||||||
|
|
||||||
env = dict(os.environ)
|
env = dict(os.environ)
|
||||||
|
|
||||||
args = self._normalize_command([self._loader_script,
|
# Since mozconfig_loader is a shell script, running it "normally"
|
||||||
self.topsrcdir.replace(os.sep, '/'), path], True)
|
# actually leads to two shell executions on Windows. Avoid this by
|
||||||
|
# directly calling sh mozconfig_loader.
|
||||||
|
shell = 'sh'
|
||||||
|
if 'MOZILLABUILD' in os.environ:
|
||||||
|
shell = os.environ['MOZILLABUILD'] + '/msys/bin/sh'
|
||||||
|
if sys.platform == 'win32':
|
||||||
|
shell = shell + '.exe'
|
||||||
|
|
||||||
|
command = [shell, mozpath.normsep(self._loader_script),
|
||||||
|
mozpath.normsep(self.topsrcdir), path]
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# We need to capture stderr because that's where the shell sends
|
# We need to capture stderr because that's where the shell sends
|
||||||
# errors if execution fails.
|
# errors if execution fails.
|
||||||
output = subprocess.check_output(args, stderr=subprocess.STDOUT,
|
output = subprocess.check_output(command, stderr=subprocess.STDOUT,
|
||||||
cwd=self.topsrcdir, env=env)
|
cwd=self.topsrcdir, env=env)
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
lines = e.output.splitlines()
|
lines = e.output.splitlines()
|
||||||
|
|
Загрузка…
Ссылка в новой задаче