parameters: (self, target, source, env, executor=None)
return_statement: return 0
docstring: Execute a command action.
  
          This will handle lists of commands as well as individual commands,
          because construction variable substitution may turn a single
          "command" into a list.  This means that this class can actually
          handle lists of commands, even though that's not how we use it
          externally.
docstring_summary: Execute a command action.
docstring_tokens: Execute a command action .
function: def execute(self, target, source, env, executor=None):
          """Execute a command action.
  
          This will handle lists of commands as well as individual commands,
          because construction variable substitution may turn a single
          "command" into a list.  This means that this class can actually
          handle lists of commands, even though that's not how we use it
          externally.
          """
          escape_list = SCons.Subst.escape_list
          flatten_sequence = SCons.Util.flatten_sequence
  
          try:
              shell = env['SHELL']
          except KeyError:
              raise SCons.Errors.UserError('Missing SHELL construction variable.')
  
          try:
              spawn = env['SPAWN']
          except KeyError:
              raise SCons.Errors.UserError('Missing SPAWN construction variable.')
          else:
              if is_String(spawn):
                  spawn = env.subst(spawn, raw=1, conv=lambda x: x)
  
          escape = env.get('ESCAPE', lambda x: x)
  
          ENV = get_default_ENV(env)
  
          # Ensure that the ENV values are all strings:
          for key, value in ENV.items():
              if not is_String(value):
                  if is_List(value):
                      # If the value is a list, then we assume it is a
                      # path list, because that's a pretty common list-like
                      # value to stick in an environment variable:
                      value = flatten_sequence(value)
                      ENV[key] = os.pathsep.join(map(str, value))
                  else:
                      # If it isn't a string or a list, then we just coerce
                      # it to a string, which is the proper way to handle
                      # Dir and File instances and will produce something
                      # reasonable for just about everything else:
                      ENV[key] = str(value)
  
          if executor:
              target = executor.get_all_targets()
              source = executor.get_all_sources()
          cmd_list, ignore, silent = self.process(target, list(map(rfile, source)), env, executor)
  
          # Use len() to filter out any "command" that's zero-length.
          for cmd_line in filter(len, cmd_list):
              # Escape the command line for the interpreter we are using.
              cmd_line = escape_list(cmd_line, escape)
              result = spawn(shell, escape, cmd_line[0], cmd_line, ENV)
              if not ignore and result:
                  msg = "Error %s" % result
                  return SCons.Errors.BuildError(errstr=msg,
                                                 status=result,
                                                 action=self,
                                                 command=cmd_line)
          return 0
function_tokens: def execute ( self , target , source , env , executor = None ) : escape_list = SCons . Subst . escape_list flatten_sequence = SCons . Util . flatten_sequence try : shell = env [ 'SHELL' ] except KeyError : raise SCons . Errors . UserError ( 'Missing SHELL construction variable.' ) try : spawn = env [ 'SPAWN' ] except KeyError : raise SCons . Errors . UserError ( 'Missing SPAWN construction variable.' ) else : if is_String ( spawn ) : spawn = env . subst ( spawn , raw = 1 , conv = lambda x : x ) escape = env . get ( 'ESCAPE' , lambda x : x ) ENV = get_default_ENV ( env ) # Ensure that the ENV values are all strings: for key , value in ENV . items ( ) : if not is_String ( value ) : if is_List ( value ) : # If the value is a list, then we assume it is a # path list, because that's a pretty common list-like # value to stick in an environment variable: value = flatten_sequence ( value ) ENV [ key ] = os . pathsep . join ( map ( str , value ) ) else : # If it isn't a string or a list, then we just coerce # it to a string, which is the proper way to handle # Dir and File instances and will produce something # reasonable for just about everything else: ENV [ key ] = str ( value ) if executor : target = executor . get_all_targets ( ) source = executor . get_all_sources ( ) cmd_list , ignore , silent = self . process ( target , list ( map ( rfile , source ) ) , env , executor ) # Use len() to filter out any "command" that's zero-length. for cmd_line in filter ( len , cmd_list ) : # Escape the command line for the interpreter we are using. cmd_line = escape_list ( cmd_line , escape ) result = spawn ( shell , escape , cmd_line [ 0 ] , cmd_line , ENV ) if not ignore and result : msg = "Error %s" % result return SCons . Errors . BuildError ( errstr = msg , status = result , action = self , command = cmd_line ) return 0