docs: def bootstrap():  # pragma: no cover
      """Actually bootstrap our shiv environment."""
  
      # get a handle of the currently executing zip file
      archive = current_zipfile()
  
      # create an environment object (a combination of env vars and json metadata)
      env = Environment.from_json(archive.read("environment.json").decode())
  
      # get a site-packages directory (from env var or via build id)
      site_packages = cache_path(archive, env.root, env.build_id) / "site-packages"
  
      # determine if first run or forcing extract
      if not site_packages.exists() or env.force_extract:
          extract_site_packages(archive, site_packages.parent, env.compile_pyc, env.compile_workers, env.force_extract)
  
      # get sys.path's length
      length = len(sys.path)
  
      # Find the first instance of an existing site-packages on sys.path
      index = _first_sitedir_index() or length
  
      # append site-packages using the stdlib blessed way of extending path
      # so as to handle .pth files correctly
      site.addsitedir(site_packages)
  
      # add our site-packages to the environment, if requested
      if env.extend_pythonpath:
          _extend_python_path(os.environ, sys.path[index:])
  
      # reorder to place our site-packages before any others found
      sys.path = sys.path[:index] + sys.path[length:] + sys.path[index:length]
  
      # first check if we should drop into interactive mode
      if not env.interpreter:
  
          # do entry point import and call
          if env.entry_point is not None:
              mod = import_string(env.entry_point)
              try:
                  sys.exit(mod())
              except TypeError:
                  # catch "<module> is not callable", which is thrown when the entry point's
                  # callable shares a name with it's parent module
                  # e.g. "from foo.bar import bar; bar()"
                  sys.exit(getattr(mod, env.entry_point.replace(":", ".").split(".")[1])())
  
          elif env.script is not None:
              sys.exit(runpy.run_path(site_packages / "bin" / env.script, run_name="__main__"))
  
      # all other options exhausted, drop into interactive mode
      execute_interpreter()