зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1636574 - Allow setting `PYTHON3` in mozconfig r=glandium
Configuration values defined above `mozconfig_options` in `init.configure` are those that can't be configured in `mozconfig`. As far as I can tell there is nothing wrong *in principle* with setting `PYTHON3` in `mozconfig`, so here we just bump `mozconfig_options` above `PYTHON3` configuration. Side note, diagnosing this failure took a *long* time. The error message that this produced ("unknown option `PYTHON3`") is useless and the underlying algos being extremely mutable, I ended up having to spend a lot of time in the debugger and monitor all the underlying changes to a bunch of mutable data structures to determine where `PYTHON3` was getting lost. A better error message would be good here but I don't know how I would begin adding it. Differential Revision: https://phabricator.services.mozilla.com/D75635
This commit is contained in:
Родитель
1a44b2a1d9
Коммит
50eff9d473
|
@ -233,6 +233,52 @@ def help_shell(help, shell):
|
|||
shell = help_shell | shell
|
||||
|
||||
|
||||
# Inject mozconfig options
|
||||
# ==============================================================
|
||||
|
||||
|
||||
@depends(mozconfig, 'MOZ_AUTOMATION', '--help')
|
||||
# This gives access to the sandbox. Don't copy this blindly.
|
||||
@imports('__sandbox__')
|
||||
@imports('os')
|
||||
@imports('six')
|
||||
def mozconfig_options(mozconfig, automation, help):
|
||||
if mozconfig['path']:
|
||||
if 'MOZ_AUTOMATION_MOZCONFIG' in mozconfig['env']['added']:
|
||||
if not automation:
|
||||
log.error('%s directly or indirectly includes an in-tree '
|
||||
'mozconfig.', mozconfig['path'])
|
||||
log.error('In-tree mozconfigs make strong assumptions about '
|
||||
'and are only meant to be used by Mozilla '
|
||||
'automation.')
|
||||
die("Please don't use them.")
|
||||
helper = __sandbox__._helper
|
||||
log.info('Adding configure options from %s' % mozconfig['path'])
|
||||
for arg in mozconfig['configure_args']:
|
||||
log.info(' %s' % arg)
|
||||
# We could be using imply_option() here, but it has other
|
||||
# contraints that don't really apply to the command-line
|
||||
# emulation that mozconfig provides.
|
||||
helper.add(arg, origin='mozconfig', args=helper._args)
|
||||
|
||||
def add(key, value):
|
||||
if key.isupper():
|
||||
arg = '%s=%s' % (key, value)
|
||||
log.info(' %s' % arg)
|
||||
helper.add(arg, origin='mozconfig', args=helper._args)
|
||||
|
||||
for key, value in six.iteritems(mozconfig['env']['added']):
|
||||
add(key, value)
|
||||
os.environ[key] = value
|
||||
for key, (_, value) in six.iteritems(mozconfig['env']['modified']):
|
||||
add(key, value)
|
||||
os.environ[key] = value
|
||||
for key, value in six.iteritems(mozconfig['vars']['added']):
|
||||
add(key, value)
|
||||
for key, (_, value) in six.iteritems(mozconfig['vars']['modified']):
|
||||
add(key, value)
|
||||
|
||||
|
||||
# Python 3
|
||||
# ========
|
||||
|
||||
|
@ -397,71 +443,6 @@ set_config('PYTHON3', virtualenv_python3.path)
|
|||
set_config('PYTHON3_VERSION', virtualenv_python3.str_version)
|
||||
|
||||
|
||||
# Inject mozconfig options
|
||||
# ==============================================================
|
||||
# All options defined above this point can't be injected in mozconfig_options
|
||||
# below, so collect them.
|
||||
|
||||
|
||||
@template
|
||||
def early_options():
|
||||
@dependable
|
||||
@imports('__sandbox__')
|
||||
@imports(_from='six', _import='itervalues')
|
||||
def early_options():
|
||||
return set(
|
||||
option.env
|
||||
for option in itervalues(__sandbox__._options)
|
||||
if option.env
|
||||
)
|
||||
return early_options
|
||||
|
||||
|
||||
early_options = early_options()
|
||||
|
||||
|
||||
@depends(mozconfig, 'MOZ_AUTOMATION', '--help')
|
||||
# This gives access to the sandbox. Don't copy this blindly.
|
||||
@imports('__sandbox__')
|
||||
@imports('os')
|
||||
@imports('six')
|
||||
def mozconfig_options(mozconfig, automation, help):
|
||||
if mozconfig['path']:
|
||||
if 'MOZ_AUTOMATION_MOZCONFIG' in mozconfig['env']['added']:
|
||||
if not automation:
|
||||
log.error('%s directly or indirectly includes an in-tree '
|
||||
'mozconfig.', mozconfig['path'])
|
||||
log.error('In-tree mozconfigs make strong assumptions about '
|
||||
'and are only meant to be used by Mozilla '
|
||||
'automation.')
|
||||
die("Please don't use them.")
|
||||
helper = __sandbox__._helper
|
||||
log.info('Adding configure options from %s' % mozconfig['path'])
|
||||
for arg in mozconfig['configure_args']:
|
||||
log.info(' %s' % arg)
|
||||
# We could be using imply_option() here, but it has other
|
||||
# contraints that don't really apply to the command-line
|
||||
# emulation that mozconfig provides.
|
||||
helper.add(arg, origin='mozconfig', args=helper._args)
|
||||
|
||||
def add(key, value):
|
||||
if key.isupper():
|
||||
arg = '%s=%s' % (key, value)
|
||||
log.info(' %s' % arg)
|
||||
helper.add(arg, origin='mozconfig', args=helper._args)
|
||||
|
||||
for key, value in six.iteritems(mozconfig['env']['added']):
|
||||
add(key, value)
|
||||
os.environ[key] = value
|
||||
for key, (_, value) in six.iteritems(mozconfig['env']['modified']):
|
||||
add(key, value)
|
||||
os.environ[key] = value
|
||||
for key, value in six.iteritems(mozconfig['vars']['added']):
|
||||
add(key, value)
|
||||
for key, (_, value) in six.iteritems(mozconfig['vars']['modified']):
|
||||
add(key, value)
|
||||
|
||||
|
||||
# Source checkout and version control integration.
|
||||
# ================================================
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче