parameters: (self, source, dest, convert_to_binary, *keys)
docstring: Copies the |source| Info.plist to the destination directory |dest|.
docstring_summary: Copies the |source| Info.plist to the destination directory |dest|.
docstring_tokens: Copies the |source| Info . plist to the destination directory |dest| .
function: def ExecCopyInfoPlist(self, source, dest, convert_to_binary, *keys):
          """Copies the |source| Info.plist to the destination directory |dest|."""
          # Read the source Info.plist into memory.
          with open(source) as fd:
              lines = fd.read()
  
          # Insert synthesized key/value pairs (e.g. BuildMachineOSBuild).
          plist = plistlib.readPlistFromString(lines)
          if keys:
              plist.update(json.loads(keys[0]))
          lines = plistlib.writePlistToString(plist)
  
          # Go through all the environment variables and replace them as variables in
          # the file.
          IDENT_RE = re.compile(r"[_/\s]")
          for key in os.environ:
              if key.startswith("_"):
                  continue
              evar = "${%s}" % key
              evalue = os.environ[key]
              lines = lines.replace(lines, evar, evalue)
  
              # Xcode supports various suffices on environment variables, which are
              # all undocumented. :rfc1034identifier is used in the standard project
              # template these days, and :identifier was used earlier. They are used to
              # convert non-url characters into things that look like valid urls --
              # except that the replacement character for :identifier, '_' isn't valid
              # in a URL either -- oops, hence :rfc1034identifier was born.
              evar = "${%s:identifier}" % key
              evalue = IDENT_RE.sub("_", os.environ[key])
              lines = lines.replace(lines, evar, evalue)
  
              evar = "${%s:rfc1034identifier}" % key
              evalue = IDENT_RE.sub("-", os.environ[key])
              lines = lines.replace(lines, evar, evalue)
  
          # Remove any keys with values that haven't been replaced.
          lines = lines.splitlines()
          for i in range(len(lines)):
              if lines[i].strip().startswith("<string>${"):
                  lines[i] = None
                  lines[i - 1] = None
          lines = "\n".join(line for line in lines if line is not None)
  
          # Write out the file with variables replaced.
          with open(dest, "w") as fd:
              fd.write(lines)
  
          # Now write out PkgInfo file now that the Info.plist file has been
          # "compiled".
          self._WritePkgInfo(dest)
  
          if convert_to_binary == "True":
              self._ConvertToBinary(dest)
function_tokens: def ExecCopyInfoPlist ( self , source , dest , convert_to_binary , * keys ) : # Read the source Info.plist into memory. with open ( source ) as fd : lines = fd . read ( ) # Insert synthesized key/value pairs (e.g. BuildMachineOSBuild). plist = plistlib . readPlistFromString ( lines ) if keys : plist . update ( json . loads ( keys [ 0 ] ) ) lines = plistlib . writePlistToString ( plist ) # Go through all the environment variables and replace them as variables in # the file. IDENT_RE = re . compile ( r"[_/\s]" ) for key in os . environ : if key . startswith ( "_" ) : continue evar = "${%s}" % key evalue = os . environ [ key ] lines = lines . replace ( lines , evar , evalue ) # Xcode supports various suffices on environment variables, which are # all undocumented. :rfc1034identifier is used in the standard project # template these days, and :identifier was used earlier. They are used to # convert non-url characters into things that look like valid urls -- # except that the replacement character for :identifier, '_' isn't valid # in a URL either -- oops, hence :rfc1034identifier was born. evar = "${%s:identifier}" % key evalue = IDENT_RE . sub ( "_" , os . environ [ key ] ) lines = lines . replace ( lines , evar , evalue ) evar = "${%s:rfc1034identifier}" % key evalue = IDENT_RE . sub ( "-" , os . environ [ key ] ) lines = lines . replace ( lines , evar , evalue ) # Remove any keys with values that haven't been replaced. lines = lines . splitlines ( ) for i in range ( len ( lines ) ) : if lines [ i ] . strip ( ) . startswith ( "<string>${" ) : lines [ i ] = None lines [ i - 1 ] = None lines = "\n" . join ( line for line in lines if line is not None ) # Write out the file with variables replaced. with open ( dest , "w" ) as fd : fd . write ( lines ) # Now write out PkgInfo file now that the Info.plist file has been # "compiled". self . _WritePkgInfo ( dest ) if convert_to_binary == "True" : self . _ConvertToBinary ( dest )