class_docstr: This class exists to allow virtual environment creation to be
  customized. The constructor parameters determine the builder's
  behaviour when called upon to create a virtual environment.
  
  By default, the builder makes the system (global) site-packages dir
  *un*available to the created environment.
  
  If invoked using the Python -m option, the default is to use copying
  on Windows platforms but symlinks elsewhere. If instantiated some
  other way, the default is to *not* use symlinks.
  
  :param system_site_packages: If True, the system (global) site-packages
                               dir is available to created environments.
  :param clear: If True, delete the contents of the environment directory if
                it already exists, before environment creation.
  :param symlinks: If True, attempt to symlink rather than copy files into
                   virtual environment.
  :param upgrade: If True, upgrade an existing virtual environment.
  :param with_pip: If True, ensure pip is installed in the virtual
                   environment
  :param prompt: Alternative terminal prefix for the environment.
  :param upgrade_deps: Update the base venv modules to the latest on PyPI
class_docstr_tok: ["This","class","exists","to","allow","virtual","environment","creation","to","be","customized",".","The","constructor","parameters","determine","the","builder's","behaviour","when","called","upon","to","create","a","virtual","environment",".","By","default",",","the","builder","makes","the","system","(","global",")","site-packages","dir","*","un","*","available","to","the","created","environment",".","If","invoked","using","the","Python","-m","option",",","the","default","is","to","use","copying","on","Windows","platforms","but","symlinks","elsewhere",".","If","instantiated","some","other","way",",","the","default","is","to","*","not","*","use","symlinks",".",":","param","system_site_packages",":","If","True",",","the","system","(","global",")","site-packages","dir","is","available","to","created","environments",".",":","param","clear",":","If","True",",","delete","the","contents","of","the","environment","directory","if","it","already","exists",",","before","environment","creation",".",":","param","symlinks",":","If","True",",","attempt","to","symlink","rather","than","copy","files","into","virtual","environment",".",":","param","upgrade",":","If","True",",","upgrade","an","existing","virtual","environment",".",":","param","with_pip",":","If","True",",","ensure","pip","is","installed","in","the","virtual","environment",":","param","prompt",":","Alternative","terminal","prefix","for","the","environment",".",":","param","upgrade_deps",":","Update","the","base","venv","modules","to","the","latest","on","PyPI"]
docstr: Install scripts into the created environment from a directory.
  
  :param context: The information for the environment creation request
                  being processed.
  :param path:    Absolute pathname of a directory containing script.
                  Scripts in the 'common' subdirectory of this directory,
                  and those in the directory named for the platform
                  being run on, are installed in the created environment.
                  Placeholder variables are replaced with environment-
                  specific values.
docstr_tok: ["Install","scripts","into","the","created","environment","from","a","directory",".",":","param","context",":","The","information","for","the","environment","creation","request","being","processed",".",":","param","path",":","Absolute","pathname","of","a","directory","containing","script",".","Scripts","in","the","'common","'","subdirectory","of","this","directory",",","and","those","in","the","directory","named","for","the","platform","being","run","on",",","are","installed","in","the","created","environment",".","Placeholder","variables","are","replaced","with","environment-","specific","values","."]
code: def install_scripts(self, context, path):
      """
      Install scripts into the created environment from a directory.
  
      :param context: The information for the environment creation request
                      being processed.
      :param path:    Absolute pathname of a directory containing script.
                      Scripts in the 'common' subdirectory of this directory,
                      and those in the directory named for the platform
                      being run on, are installed in the created environment.
                      Placeholder variables are replaced with environment-
                      specific values.
      """
      binpath = context.bin_path
      plen = len(path)
      for root, dirs, files in os.walk(path):
          if root == path:  # at top-level, remove irrelevant dirs
              for d in dirs[:]:
                  if d not in ("common", os.name):
                      dirs.remove(d)
              continue  # ignore files in top level
          for f in files:
              if (
                  os.name == "nt"
                  and f.startswith("python")
                  and f.endswith((".exe", ".pdb"))
              ):
                  continue
              srcfile = os.path.join(root, f)
              suffix = root[plen:].split(os.sep)[2:]
              if not suffix:
                  dstdir = binpath
              else:
                  dstdir = os.path.join(binpath, *suffix)
              if not os.path.exists(dstdir):
                  os.makedirs(dstdir)
              dstfile = os.path.join(dstdir, f)
              with open(srcfile, "rb") as f:
                  data = f.read()
              if not srcfile.endswith((".exe", ".pdb")):
                  try:
                      data = data.decode("utf-8")
                      data = self.replace_variables(data, context)
                      data = data.encode("utf-8")
                  except UnicodeError as e:
                      data = None
                      logger.warning(
                          "unable to copy script %r, "
                          "may be binary: %s",
                          srcfile,
                          e,
                      )
              if data is not None:
                  with open(dstfile, "wb") as f:
                      f.write(data)
                  shutil.copymode(srcfile, dstfile)
  
imports: import logging
  import os
  import shutil
  import subprocess
  import sys
  import sysconfig
  import types
label_desc: Use image node_id 13 for calling the EnvBuilder obj's underlying member method code with example usage: obj.install_scripts(context, path) without return types