parameters: (self, dest, skip_if_older=True)
return_statement: return True
docstring: Invokes the preprocessor to create the destination file.
docstring_summary: Invokes the preprocessor to create the destination file.
docstring_tokens: Invokes the preprocessor to create the destination file .
function: def copy(self, dest, skip_if_older=True):
          '''
          Invokes the preprocessor to create the destination file.
          '''
          if isinstance(dest, basestring):
              dest = Dest(dest)
          else:
              assert isinstance(dest, Dest)
  
          # We have to account for the case where the destination exists and is a
          # symlink to something. Since we know the preprocessor is certainly not
          # going to create a symlink, we can just remove the existing one. If the
          # destination is not a symlink, we leave it alone, since we're going to
          # overwrite its contents anyway.
          # If symlinks aren't supported at all, we can skip this step.
          if hasattr(os, 'symlink'):
              if os.path.islink(dest.path):
                  os.remove(dest.path)
  
          pp_deps = set(self.extra_depends)
  
          # If a dependency file was specified, and it exists, add any
          # dependencies from that file to our list.
          if self.depfile and os.path.exists(self.depfile):
              target = mozpath.normpath(dest.name)
              with open(self.depfile, 'rb') as fileobj:
                  for rule in makeutil.read_dep_makefile(fileobj):
                      if target in rule.targets():
                          pp_deps.update(rule.dependencies())
  
          skip = False
          if dest.exists() and skip_if_older:
              # If a dependency file was specified, and it doesn't exist,
              # assume that the preprocessor needs to be rerun. That will
              # regenerate the dependency file.
              if self.depfile and not os.path.exists(self.depfile):
                  skip = False
              else:
                  skip = not BaseFile.any_newer(dest.path, pp_deps)
  
          if skip:
              return False
  
          deps_out = None
          if self.depfile:
              deps_out = FileAvoidWrite(self.depfile)
          pp = Preprocessor(defines=self.defines, marker=self.marker)
          pp.setSilenceDirectiveWarnings(self.silence_missing_directive_warnings)
  
          with open(self.path, 'rU') as input:
              pp.processFile(input=input, output=dest, depfile=deps_out)
  
          dest.close()
          if self.depfile:
              deps_out.close()
  
          return True
function_tokens: def copy ( self , dest , skip_if_older = True ) : if isinstance ( dest , basestring ) : dest = Dest ( dest ) else : assert isinstance ( dest , Dest ) # We have to account for the case where the destination exists and is a # symlink to something. Since we know the preprocessor is certainly not # going to create a symlink, we can just remove the existing one. If the # destination is not a symlink, we leave it alone, since we're going to # overwrite its contents anyway. # If symlinks aren't supported at all, we can skip this step. if hasattr ( os , 'symlink' ) : if os . path . islink ( dest . path ) : os . remove ( dest . path ) pp_deps = set ( self . extra_depends ) # If a dependency file was specified, and it exists, add any # dependencies from that file to our list. if self . depfile and os . path . exists ( self . depfile ) : target = mozpath . normpath ( dest . name ) with open ( self . depfile , 'rb' ) as fileobj : for rule in makeutil . read_dep_makefile ( fileobj ) : if target in rule . targets ( ) : pp_deps . update ( rule . dependencies ( ) ) skip = False if dest . exists ( ) and skip_if_older : # If a dependency file was specified, and it doesn't exist, # assume that the preprocessor needs to be rerun. That will # regenerate the dependency file. if self . depfile and not os . path . exists ( self . depfile ) : skip = False else : skip = not BaseFile . any_newer ( dest . path , pp_deps ) if skip : return False deps_out = None if self . depfile : deps_out = FileAvoidWrite ( self . depfile ) pp = Preprocessor ( defines = self . defines , marker = self . marker ) pp . setSilenceDirectiveWarnings ( self . silence_missing_directive_warnings ) with open ( self . path , 'rU' ) as input : pp . processFile ( input = input , output = dest , depfile = deps_out ) dest . close ( ) if self . depfile : deps_out . close ( ) return True