зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1575135 - Use functions from util.configure instead of subprocess.*. r=nalexander
Differential Revision: https://phabricator.services.mozilla.com/D42603 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
8db488eb24
Коммит
cce0006157
|
@ -794,17 +794,15 @@ def help_host_target(help, host, target):
|
|||
)
|
||||
|
||||
|
||||
@imports('subprocess')
|
||||
def config_sub(shell, triplet):
|
||||
config_sub = os.path.join(os.path.dirname(__file__), '..',
|
||||
'autoconf', 'config.sub')
|
||||
return subprocess.check_output([shell, config_sub, triplet]).strip()
|
||||
return check_cmd_output(shell, config_sub, triplet).strip()
|
||||
|
||||
|
||||
@depends('--host', shell)
|
||||
@checking('for host system type', lambda h: h.alias)
|
||||
@imports('os')
|
||||
@imports('subprocess')
|
||||
@imports('sys')
|
||||
@imports(_from='__builtin__', _import='ValueError')
|
||||
def real_host(value, shell):
|
||||
|
@ -819,7 +817,7 @@ def real_host(value, shell):
|
|||
if not value:
|
||||
config_guess = os.path.join(os.path.dirname(__file__), '..',
|
||||
'autoconf', 'config.guess')
|
||||
host = subprocess.check_output([shell, config_guess], universal_newlines=True).strip()
|
||||
host = check_cmd_output(shell, config_guess, universal_newlines=True).strip()
|
||||
try:
|
||||
return split_triplet(host)
|
||||
except ValueError:
|
||||
|
|
|
@ -58,24 +58,21 @@ def pkg_check_modules(var, package_desc, when=always,
|
|||
min_version)
|
||||
|
||||
@depends(pkg_config, package_desc, allow_missing, when=when_and_compile_environment)
|
||||
@imports('subprocess')
|
||||
@imports('sys')
|
||||
@imports(_from='mozbuild.configure.util', _import='LineIO')
|
||||
def package(pkg_config, package_desc, allow_missing):
|
||||
# package_desc may start as a depends function, so we can't use
|
||||
# @checking here.
|
||||
log.info("checking for %s... " % package_desc)
|
||||
with log.queue_debug():
|
||||
try:
|
||||
subprocess.check_output([pkg_config, '--errors-to-stdout',
|
||||
'--print-errors', package_desc])
|
||||
retcode, stdout, stderr = get_cmd_output(
|
||||
pkg_config, '--errors-to-stdout', '--print-errors', package_desc)
|
||||
if retcode == 0:
|
||||
log.info("yes")
|
||||
return True
|
||||
except subprocess.CalledProcessError as e:
|
||||
log.info("no")
|
||||
log_writer = log.warning if allow_missing else log.error
|
||||
with LineIO(lambda l: log_writer(l), 'replace') as o:
|
||||
o.write(e.output)
|
||||
o.write(stdout)
|
||||
if not allow_missing:
|
||||
sys.exit(1)
|
||||
|
||||
|
|
|
@ -603,7 +603,6 @@ def check_compiler(compiler, language, target):
|
|||
@imports(_from='__builtin__', _import='open')
|
||||
@imports('json')
|
||||
@imports('os')
|
||||
@imports('subprocess')
|
||||
@imports(_from='mozbuild.util', _import='system_encoding')
|
||||
def get_vc_paths(topsrcdir):
|
||||
def vswhere(args):
|
||||
|
@ -616,7 +615,7 @@ def get_vc_paths(topsrcdir):
|
|||
if not os.path.exists(vswhere):
|
||||
return []
|
||||
return json.loads(
|
||||
subprocess.check_output([vswhere, '-format', 'json'] + args)
|
||||
check_cmd_output(vswhere, '-format', 'json', *args)
|
||||
.decode(system_encoding, 'replace'))
|
||||
|
||||
for install in vswhere(['-products', '*', '-requires', 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64']):
|
||||
|
|
|
@ -457,16 +457,12 @@ mt = check_prog('MT', ('mt.exe',), input='MT',
|
|||
# utility".
|
||||
@depends(mt)
|
||||
@checking('whether MT is really Microsoft Manifest Tool', lambda x: bool(x))
|
||||
@imports('subprocess')
|
||||
def valid_mt(path):
|
||||
try:
|
||||
out = subprocess.check_output([path]).splitlines()
|
||||
out = check_cmd_output(path, onerror=lambda: '').splitlines()
|
||||
out = '\n'.join(l for l in out
|
||||
if 'Microsoft (R) Manifest Tool' in l)
|
||||
if out:
|
||||
return path
|
||||
except subprocess.CalledProcessError:
|
||||
pass
|
||||
raise FatalCheckError('%s is not Microsoft Manifest Tool')
|
||||
|
||||
|
||||
|
|
|
@ -632,7 +632,7 @@ Java SDK directory or use '--with-java-bin-path={java-bin-dir}'
|
|||
mock_pkg_config_path = mozpath.abspath('/usr/bin/pkg-config')
|
||||
|
||||
def mock_pkg_config(_, args):
|
||||
if args[0:2] == ['--errors-to-stdout', '--print-errors']:
|
||||
if args[0:2] == ('--errors-to-stdout', '--print-errors'):
|
||||
assert len(args) == 3
|
||||
package = args[2]
|
||||
if package == 'unknown':
|
||||
|
|
Загрузка…
Ссылка в новой задаче