parameters: (src, dst, symlinks=False, ignore=None, copy_function=copy2,
                     ignore_dangling_symlinks=False, dirs_exist_ok=False)
return_statement: return dst
docstring: Recursively copy a directory tree, SCons version.
  
      This is a modified copy of the Python 3.7 shutil.copytree function.
      SCons update: dirs_exist_ok dictates whether to raise an
      exception in case dst or any missing parent directory already
      exists. Implementation depends on os.makedirs having a similar
      flag, which it has since Python 3.2.  This version also raises an
      SCons-defined exception rather than the one defined locally to shtuil.
      This version uses a change from Python 3.8.
      TODO: we can remove this forked copy once the minimum Py version is 3.8.
  
      If exception(s) occur, an Error is raised with a list of reasons.
  
      If the optional symlinks flag is true, symbolic links in the
      source tree result in symbolic links in the destination tree; if
      it is false, the contents of the files pointed to by symbolic
      links are copied. If the file pointed by the symlink doesn't
      exist, an exception will be added in the list of errors raised in
      an Error exception at the end of the copy process.
  
      You can set the optional ignore_dangling_symlinks flag to true if you
      want to silence this exception. Notice that this has no effect on
      platforms that don't support os.symlink.
  
      The optional ignore argument is a callable. If given, it
      is called with the `src` parameter, which is the directory
      being visited by copytree(), and `names` which is the list of
      `src` contents, as returned by os.listdir():
  
          callable(src, names) -> ignored_names
  
      Since copytree() is called recursively, the callable will be
      called once for each directory that is copied. It returns a
      list of names relative to the `src` directory that should
      not be copied.
  
      The optional copy_function argument is a callable that will be used
      to copy each file. It will be called with the source path and the
      destination path as arguments. By default, copy2() is used, but any
      function that supports the same signature (like copy()) can be used.
docstring_summary: Recursively copy a directory tree, SCons version.
docstring_tokens: Recursively copy a directory tree SCons version .
function: def scons_copytree(src, dst, symlinks=False, ignore=None, copy_function=copy2,
                     ignore_dangling_symlinks=False, dirs_exist_ok=False):
      """Recursively copy a directory tree, SCons version.
  
      This is a modified copy of the Python 3.7 shutil.copytree function.
      SCons update: dirs_exist_ok dictates whether to raise an
      exception in case dst or any missing parent directory already
      exists. Implementation depends on os.makedirs having a similar
      flag, which it has since Python 3.2.  This version also raises an
      SCons-defined exception rather than the one defined locally to shtuil.
      This version uses a change from Python 3.8.
      TODO: we can remove this forked copy once the minimum Py version is 3.8.
  
      If exception(s) occur, an Error is raised with a list of reasons.
  
      If the optional symlinks flag is true, symbolic links in the
      source tree result in symbolic links in the destination tree; if
      it is false, the contents of the files pointed to by symbolic
      links are copied. If the file pointed by the symlink doesn't
      exist, an exception will be added in the list of errors raised in
      an Error exception at the end of the copy process.
  
      You can set the optional ignore_dangling_symlinks flag to true if you
      want to silence this exception. Notice that this has no effect on
      platforms that don't support os.symlink.
  
      The optional ignore argument is a callable. If given, it
      is called with the `src` parameter, which is the directory
      being visited by copytree(), and `names` which is the list of
      `src` contents, as returned by os.listdir():
  
          callable(src, names) -> ignored_names
  
      Since copytree() is called recursively, the callable will be
      called once for each directory that is copied. It returns a
      list of names relative to the `src` directory that should
      not be copied.
  
      The optional copy_function argument is a callable that will be used
      to copy each file. It will be called with the source path and the
      destination path as arguments. By default, copy2() is used, but any
      function that supports the same signature (like copy()) can be used.
  
      """
      names = os.listdir(src)
      if ignore is not None:
          ignored_names = ignore(src, names)
      else:
          ignored_names = set()
  
      os.makedirs(dst, exist_ok=dirs_exist_ok)
      errors = []
      for name in names:
          if name in ignored_names:
              continue
          srcname = os.path.join(src, name)
          dstname = os.path.join(dst, name)
          try:
              if os.path.islink(srcname):
                  linkto = os.readlink(srcname)
                  if symlinks:
                      # We can't just leave it to `copy_function` because legacy
                      # code with a custom `copy_function` may rely on copytree
                      # doing the right thing.
                      os.symlink(linkto, dstname)
                      copystat(srcname, dstname, follow_symlinks=not symlinks)
                  else:
                      # ignore dangling symlink if the flag is on
                      if not os.path.exists(linkto) and ignore_dangling_symlinks:
                          continue
                      # otherwise let the copy occurs. copy2 will raise an error
                      if os.path.isdir(srcname):
                          scons_copytree(srcname, dstname, symlinks, ignore,
                                         copy_function, dirs_exist_ok)
                      else:
                          copy_function(srcname, dstname)
              elif os.path.isdir(srcname):
                  scons_copytree(srcname, dstname, symlinks, ignore, copy_function, dirs_exist_ok)
              else:
                  # Will raise a SpecialFileError for unsupported file types
                  copy_function(srcname, dstname)
          # catch the Error from the recursive copytree so that we can
          # continue with other files
          except CopytreeError as err:  # SCons change
              errors.extend(err.args[0])
          except OSError as why:
              errors.append((srcname, dstname, str(why)))
      try:
          copystat(src, dst)
      except OSError as why:
          # Copying file access times may fail on Windows
          if getattr(why, 'winerror', None) is None:
              errors.append((src, dst, str(why)))
      if errors:
          raise CopytreeError(errors)  # SCons change
      return dst
function_tokens: def scons_copytree ( src , dst , symlinks = False , ignore = None , copy_function = copy2 , ignore_dangling_symlinks = False , dirs_exist_ok = False ) : names = os . listdir ( src ) if ignore is not None : ignored_names = ignore ( src , names ) else : ignored_names = set ( ) os . makedirs ( dst , exist_ok = dirs_exist_ok ) errors = [ ] for name in names : if name in ignored_names : continue srcname = os . path . join ( src , name ) dstname = os . path . join ( dst , name ) try : if os . path . islink ( srcname ) : linkto = os . readlink ( srcname ) if symlinks : # We can't just leave it to `copy_function` because legacy # code with a custom `copy_function` may rely on copytree # doing the right thing. os . symlink ( linkto , dstname ) copystat ( srcname , dstname , follow_symlinks = not symlinks ) else : # ignore dangling symlink if the flag is on if not os . path . exists ( linkto ) and ignore_dangling_symlinks : continue # otherwise let the copy occurs. copy2 will raise an error if os . path . isdir ( srcname ) : scons_copytree ( srcname , dstname , symlinks , ignore , copy_function , dirs_exist_ok ) else : copy_function ( srcname , dstname ) elif os . path . isdir ( srcname ) : scons_copytree ( srcname , dstname , symlinks , ignore , copy_function , dirs_exist_ok ) else : # Will raise a SpecialFileError for unsupported file types copy_function ( srcname , dstname ) # catch the Error from the recursive copytree so that we can # continue with other files except CopytreeError as err : # SCons change errors . extend ( err . args [ 0 ] ) except OSError as why : errors . append ( ( srcname , dstname , str ( why ) ) ) try : copystat ( src , dst ) except OSError as why : # Copying file access times may fail on Windows if getattr ( why , 'winerror' , None ) is None : errors . append ( ( src , dst , str ( why ) ) ) if errors : raise CopytreeError ( errors ) # SCons change return dst