parameters: (obj, cc_args, extra_postargs, pp_opts)
return_statement: return False
docstring: Check if an objects needs to be rebuild based on its dependencies
  
      Parameters
      ----------
      obj : str
          object file
  
      Returns
      -------
      bool
docstring_summary: Check if an objects needs to be rebuild based on its dependencies
docstring_tokens: Check if an objects needs to be rebuild based on its dependencies
function: def _needs_build(obj, cc_args, extra_postargs, pp_opts):
      """
      Check if an objects needs to be rebuild based on its dependencies
  
      Parameters
      ----------
      obj : str
          object file
  
      Returns
      -------
      bool
      """
      # defined in unixcompiler.py
      dep_file = obj + '.d'
      if not os.path.exists(dep_file):
          return True
  
      # dep_file is a makefile containing 'object: dependencies'
      # formatted like posix shell (spaces escaped, \ line continuations)
      # the last line contains the compiler commandline arguments as some
      # projects may compile an extension multiple times with different
      # arguments
      with open(dep_file, "r") as f:
          lines = f.readlines()
  
      cmdline =_commandline_dep_string(cc_args, extra_postargs, pp_opts)
      last_cmdline = lines[-1]
      if last_cmdline != cmdline:
          return True
  
      contents = ''.join(lines[:-1])
      deps = [x for x in shlex.split(contents, posix=True)
              if x != "\n" and not x.endswith(":")]
  
      try:
          t_obj = os.stat(obj).st_mtime
  
          # check if any of the dependencies is newer than the object
          # the dependencies includes the source used to create the object
          for f in deps:
              if os.stat(f).st_mtime > t_obj:
                  return True
      except OSError:
          # no object counts as newer (shouldn't happen if dep_file exists)
          return True
  
      return False
function_tokens: def _needs_build ( obj , cc_args , extra_postargs , pp_opts ) : # defined in unixcompiler.py dep_file = obj + '.d' if not os . path . exists ( dep_file ) : return True # dep_file is a makefile containing 'object: dependencies' # formatted like posix shell (spaces escaped, \ line continuations) # the last line contains the compiler commandline arguments as some # projects may compile an extension multiple times with different # arguments with open ( dep_file , "r" ) as f : lines = f . readlines ( ) cmdline = _commandline_dep_string ( cc_args , extra_postargs , pp_opts ) last_cmdline = lines [ - 1 ] if last_cmdline != cmdline : return True contents = '' . join ( lines [ : - 1 ] ) deps = [ x for x in shlex . split ( contents , posix = True ) if x != "\n" and not x . endswith ( ":" ) ] try : t_obj = os . stat ( obj ) . st_mtime # check if any of the dependencies is newer than the object # the dependencies includes the source used to create the object for f in deps : if os . stat ( f ) . st_mtime > t_obj : return True except OSError : # no object counts as newer (shouldn't happen if dep_file exists) return True return False