Bug 1298740 - Populate Python environment with variables from mozconfig. r=glandium draft
authorChris Manchester <cmanchester@mozilla.com>
Fri, 07 Oct 2016 14:49:08 -0700
changeset 422576 0761dcaf26284aad1b92ad6c0d13d3c5b804b773
parent 422256 49fe455cac957808ed4a5d1685c3a1938dac1d31
child 533313 5fdf67f1caf929c47ca9880caf8b5fac616f21c9
push id31748
push userbmo:cmanchester@mozilla.com
push dateFri, 07 Oct 2016 21:49:24 +0000
reviewersglandium
bugs1298740
milestone52.0a1
Bug 1298740 - Populate Python environment with variables from mozconfig. r=glandium MozReview-Commit-ID: KDCoxxh37Um
build/moz.configure/init.configure
--- a/build/moz.configure/init.configure
+++ b/build/moz.configure/init.configure
@@ -255,16 +255,17 @@ def early_options():
         )
     return early_options
 
 early_options = early_options()
 
 @depends(mozconfig, '--help')
 # This gives access to the sandbox. Don't copy this blindly.
 @imports('__sandbox__')
+@imports('os')
 def mozconfig_options(mozconfig, help):
     if mozconfig['path']:
         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
@@ -274,18 +275,20 @@ def mozconfig_options(mozconfig, help):
         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 mozconfig['env']['added'].iteritems():
             add(key, value)
+            os.environ[key] = value
         for key, (_, value) in mozconfig['env']['modified'].iteritems():
             add(key, value)
+            os.environ[key] = value
         for key, value in mozconfig['vars']['added'].iteritems():
             # mozconfig_loader adds _IS_SET variables that are irrelevant
             if not key.endswith('_IS_SET'):
                 add(key, value)
         for key, (_, value) in mozconfig['vars']['modified'].iteritems():
             add(key, value)