code: def get_backend_requires_hook(name, dist, config_settings=None):
      try:
          from pyproject_hooks import BuildBackendHookCaller
      except ImportError:
          from pep517.wrappers import (
              Pep517HookCaller as BuildBackendHookCaller,
          )
      try:
          from build.env import DefaultIsolatedEnv
      except ImportError:
          from build.env import IsolatedEnvBuilder
  
          class DefaultIsolatedEnv(IsolatedEnvBuilder):
              def __enter__(self):
                  env = super().__enter__()
                  env.python_executable = env.executable
  
                  def make_extra_environ():
                      path = os.environ.get("PATH")
                      return {
                          "PATH": os.pathsep.join(
                              [env.scripts_dir, path]
                          )
                          if path is not None
                          else env.scripts_dir
                      }
  
                  env.make_extra_environ = make_extra_environ
                  return env
  
      @contextlib.contextmanager
      def environment(path):
          os_path = os.environ["PATH"]
          os.environ["PATH"] = path
          build_backend = os.environ.pop("PEP517_BUILD_BACKEND", None)
          backend_path = os.environ.pop("PEP517_BACKEND_PATH", None)
          try:
              yield None
          finally:
              if os_path is not None:
                  os.environ["PATH"] = os_path
              if build_backend is not None:
                  os.environ["PEP517_BUILD_BACKEND"] = build_backend
              if backend_path is not None:
                  os.environ["PEP517_BACKEND_PATH"] = backend_path
  
      requires = read_build_requires(name)
      with DefaultIsolatedEnv() as env:
          path = env.make_extra_environ()["PATH"]
          python_executable = env.python_executable
          with environment(path):
              env.install(requires)
              hook = BuildBackendHookCaller(
                  source_dir=os.getcwd(),
                  build_backend=BACKENDS[name],
                  python_executable=python_executable,
              )
              requires += get_backend_requires_fast(
                  hook, dist, config_settings
              )
      return requires
  
file_path: mpi4py/conf/builder.py
imports: import contextlib
  import importlib
  import os
  import shutil
  import sys
label_desc: Use image node_id 5 for calling a global function with example usage: get_backend_requires_hook(name, dist, config_settings) and returns: requires, env, dict