(self, source, dest, *keys)
Copies the |source| Info.plist to the destination directory |dest|.
Copies the |source| Info.plist to the destination directory |dest|.
Copies the |source| Info . plist to the destination directory |dest| .
def ExecCopyInfoPlist(self, source, dest, *keys):
    """Copies the |source| Info.plist to the destination directory |dest|."""
    # Read the source Info.plist into memory.
    fd = open(source, 'r')
    lines = fd.read()
    fd.close()

    # Insert synthesized key/value pairs (e.g. BuildMachineOSBuild).
    plist = plistlib.readPlistFromString(lines)
    if keys:
      plist = dict(plist.items() + json.loads(keys[0]).items())
    lines = plistlib.writePlistToString(plist)

    # Go through all the environment variables and replace them as variables in
    # the file.
    IDENT_RE = re.compile('[/\s]')
    for key in os.environ:
      if key.startswith('_'):
        continue
      evar = '${%s}' % key
      evalue = os.environ[key]
      lines = string.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 = string.replace(lines, evar, evalue)

      evar = '${%s:rfc1034identifier}' % key
      evalue = IDENT_RE.sub('-', os.environ[key])
      lines = string.replace(lines, evar, evalue)

    # Remove any keys with values that haven't been replaced.
    lines = lines.split('\n')
    for i in range(len(lines)):
      if lines[i].strip().startswith("<string>${"):
        lines[i] = None
        lines[i - 1] = None
    lines = '\n'.join(filter(lambda x: x is not None, lines))

    # Write out the file with variables replaced.
    fd = open(dest, 'w')
    fd.write(lines)
    fd.close()

    # Now write out PkgInfo file now that the Info.plist file has been
    # "compiled".
    self._WritePkgInfo(dest)
def ExecCopyInfoPlist ( self , source , dest , * keys ) : # Read the source Info.plist into memory. fd = open ( source , 'r' ) lines = fd . read ( ) fd . close ( ) # Insert synthesized key/value pairs (e.g. BuildMachineOSBuild). plist = plistlib . readPlistFromString ( lines ) if keys : plist = dict ( plist . items ( ) + json . loads ( keys [ 0 ] ) . items ( ) ) lines = plistlib . writePlistToString ( plist ) # Go through all the environment variables and replace them as variables in # the file. IDENT_RE = re . compile ( '[/\s]' ) for key in os . environ : if key . startswith ( '_' ) : continue evar = '${%s}' % key evalue = os . environ [ key ] lines = string . 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 = string . replace ( lines , evar , evalue ) evar = '${%s:rfc1034identifier}' % key evalue = IDENT_RE . sub ( '-' , os . environ [ key ] ) lines = string . replace ( lines , evar , evalue ) # Remove any keys with values that haven't been replaced. lines = lines . split ( '\n' ) for i in range ( len ( lines ) ) : if lines [ i ] . strip ( ) . startswith ( "<string>${" ) : lines [ i ] = None lines [ i - 1 ] = None lines = '\n' . join ( filter ( lambda x : x is not None , lines ) ) # Write out the file with variables replaced. fd = open ( dest , 'w' ) fd . write ( lines ) fd . close ( ) # Now write out PkgInfo file now that the Info.plist file has been # "compiled". self . _WritePkgInfo ( dest )