native_client_sdk/src/tools/oshelpers.py
def CopyPath(options, src, dst):
  """CopyPath from src to dst

  Copy a fully specified src to a fully specified dst.  If src and dst are
  both files, the dst file is removed first to prevent error.  If and include
  or exclude list are provided, the destination is first matched against that
  filter.
  """
  if options.includes:
    if not IncludeFiles(options.includes, [src]):
      return

  if options.excludes:
    if not ExcludeFiles(options.excludes, [src]):
      return

  if options.verbose:
    print('cp %s %s' % (src, dst))

  # If the source is a single file, copy it individually
  if os.path.isfile(src):
    # We can not copy over a directory with a file.
    if os.path.exists(dst):
      if not os.path.isfile(dst):
        msg = "cp: cannot overwrite non-file '%s' with file." % dst
        raise OSError(msg)
      # If the destination exists as a file, remove it before copying to avoid
      # 'readonly' issues.
      os.remove(dst)

    # Now copy to the non-existent fully qualified target
    shutil.copy(src, dst)
    return

  # Otherwise it's a directory, ignore it unless allowed
  if os.path.isdir(src):
    if not options.recursive:
      print("cp: omitting directory '%s'" % src)
      return

    # We can not copy over a file with a directory.
    if os.path.exists(dst):
      if not os.path.isdir(dst):
        msg = "cp: cannot overwrite non-directory '%s' with directory." % dst
        raise OSError(msg)
    else:
      # if it didn't exist, create the directory
      os.makedirs(dst)

    # Now copy all members
    for filename in os.listdir(src):
      srcfile = os.path.join(src, filename)
      dstfile = os.path.join(dst, filename)
      CopyPath(options, srcfile, dstfile)
  return
CopyPath from src to dst

  Copy a fully specified src to a fully specified dst.  If src and dst are
  both files, the dst file is removed first to prevent error.  If and include
  or exclude list are provided, the destination is first matched against that
  filter.
  
CopyPath from src to dst
Copy a fully specified src to a fully specified dst.  If src and dst are
both files, the dst file is removed first to prevent error.  If and include
or exclude list are provided, the destination is first matched against that
filter.
CopyPath from src to dst Copy a fully specified src to a fully specified dst . If src and dst are both files the dst file is removed first to prevent error . If and include or exclude list are provided the destination is first matched against that filter .
def CopyPath(options, src, dst):
  if options.includes:
    if not IncludeFiles(options.includes, [src]):
      return
  if options.excludes:
    if not ExcludeFiles(options.excludes, [src]):
      return
  if options.verbose:
    print('cp %s %s' % (src, dst))
  if os.path.isfile(src):
    if os.path.exists(dst):
      if not os.path.isfile(dst):
        msg = "cp: cannot overwrite non-file '%s' with file." % dst
        raise OSError(msg)
      os.remove(dst)
    shutil.copy(src, dst)
    return
  if os.path.isdir(src):
    if not options.recursive:
      print("cp: omitting directory '%s'" % src)
      return
    if os.path.exists(dst):
      if not os.path.isdir(dst):
        msg = "cp: cannot overwrite non-directory '%s' with directory." % dst
        raise OSError(msg)
    else:
      os.makedirs(dst)
    for filename in os.listdir(src):
      srcfile = os.path.join(src, filename)
      dstfile = os.path.join(dst, filename)
      CopyPath(options, srcfile, dstfile)
  return
def CopyPath ( options , src , dst ) : if options . includes : if not IncludeFiles ( options . includes , [ src ] ) : return if options . excludes : if not ExcludeFiles ( options . excludes , [ src ] ) : return if options . verbose : print ( 'cp %s %s' % ( src , dst ) ) if os . path . isfile ( src ) : if os . path . exists ( dst ) : if not os . path . isfile ( dst ) : msg = "cp: cannot overwrite non-file '%s' with file." % dst raise OSError ( msg ) os . remove ( dst ) shutil . copy ( src , dst ) return if os . path . isdir ( src ) : if not options . recursive : print ( "cp: omitting directory '%s'" % src ) return if os . path . exists ( dst ) : if not os . path . isdir ( dst ) : msg = "cp: cannot overwrite non-directory '%s' with directory." % dst raise OSError ( msg ) else : os . makedirs ( dst ) for filename in os . listdir ( src ) : srcfile = os . path . join ( src , filename ) dstfile = os . path . join ( dst , filename ) CopyPath ( options , srcfile , dstfile ) return
CopyPath from src to dst
Copy a fully specified src to a fully specified dst.
CopyPath from src to dst Copy a fully specified src to a fully specified dst .
"""CopyPath from src to dst

  Copy a fully specified src to a fully specified dst.  If src and dst are
  both files, the dst file is removed first to prevent error.  If and include
  or exclude list are provided, the destination is first matched against that
  filter.
  """ # If the source is a single file, copy it individually # We can not copy over a directory with a file. # If the destination exists as a file, remove it before copying to avoid # 'readonly' issues. # Now copy to the non-existent fully qualified target # Otherwise it's a directory, ignore it unless allowed # We can not copy over a file with a directory. # if it didn't exist, create the directory # Now copy all members
options
src
dst