parameters: (self, env, args=None)
docstring: Update an environment with the option variables.
  
          env - the environment to update.
docstring_summary: Update an environment with the option variables.
docstring_tokens: Update an environment with the option variables .
function: def Update(self, env, args=None):
          """
          Update an environment with the option variables.
  
          env - the environment to update.
          """
  
          values = {}
  
          # first set the defaults:
          for option in self.options:
              if not option.default is None:
                  values[option.key] = option.default
  
          # next set the value specified in the options file
          for filename in self.files:
              if os.path.exists(filename):
                  dir = os.path.split(os.path.abspath(filename))[0]
                  if dir:
                      sys.path.insert(0, dir)
                  try:
                      values['__name__'] = filename
                      with open(filename, 'r') as f:
                          contents = f.read()
                      exec(contents, {}, values)
                  finally:
                      if dir:
                          del sys.path[0]
                      del values['__name__']
  
          # set the values specified on the command line
          if args is None:
              args = self.args
  
          for arg, value in args.items():
              added = False
              for option in self.options:
                  if arg in list(option.aliases) + [ option.key ]:
                      values[option.key] = value
                      added = True
              if not added:
                  self.unknown[arg] = value
  
          # put the variables in the environment:
          # (don't copy over variables that are not declared as options)
          for option in self.options:
              try:
                  env[option.key] = values[option.key]
              except KeyError:
                  pass
  
          # Call the convert functions:
          for option in self.options:
              if option.converter and option.key in values:
                  value = env.subst('${%s}'%option.key)
                  try:
                      try:
                          env[option.key] = option.converter(value)
                      except TypeError:
                          env[option.key] = option.converter(value, env)
                  except ValueError as x:
                      raise SCons.Errors.UserError('Error converting option: %s\n%s'%(option.key, x))
  
  
          # Finally validate the values:
          for option in self.options:
              if option.validator and option.key in values:
                  option.validator(option.key, env.subst('${%s}'%option.key), env)
function_tokens: def Update ( self , env , args = None ) : values = { } # first set the defaults: for option in self . options : if not option . default is None : values [ option . key ] = option . default # next set the value specified in the options file for filename in self . files : if os . path . exists ( filename ) : dir = os . path . split ( os . path . abspath ( filename ) ) [ 0 ] if dir : sys . path . insert ( 0 , dir ) try : values [ '__name__' ] = filename with open ( filename , 'r' ) as f : contents = f . read ( ) exec ( contents , { } , values ) finally : if dir : del sys . path [ 0 ] del values [ '__name__' ] # set the values specified on the command line if args is None : args = self . args for arg , value in args . items ( ) : added = False for option in self . options : if arg in list ( option . aliases ) + [ option . key ] : values [ option . key ] = value added = True if not added : self . unknown [ arg ] = value # put the variables in the environment: # (don't copy over variables that are not declared as options) for option in self . options : try : env [ option . key ] = values [ option . key ] except KeyError : pass # Call the convert functions: for option in self . options : if option . converter and option . key in values : value = env . subst ( '${%s}' % option . key ) try : try : env [ option . key ] = option . converter ( value ) except TypeError : env [ option . key ] = option . converter ( value , env ) except ValueError as x : raise SCons . Errors . UserError ( 'Error converting option: %s\n%s' % ( option . key , x ) ) # Finally validate the values: for option in self . options : if option . validator and option . key in values : option . validator ( option . key , env . subst ( '${%s}' % option . key ) , env )