code: def _build_with_temp_dir(
      self,
      setup_command,
      result_extension,
      result_directory,
      config_settings,
  ):
      config_settings = self._fix_config(config_settings)
      result_directory = os.path.abspath(result_directory)
  
      # Build in a temporary directory, then copy to the target.
      makedirs(result_directory, exist_ok=True)
      with TemporaryDirectory(dir=result_directory) as tmp_dist_dir:
          sys.argv = (
              sys.argv[:1]
              + setup_command
              + ["--dist-dir", tmp_dist_dir]
              + config_settings["--global-option"]
          )
          self.run_setup()
  
          result_basename = _file_with_extension(
              tmp_dist_dir, result_extension
          )
          result_path = os.path.join(result_directory, result_basename)
          if os.path.exists(result_path):
              # os.rename will fail overwriting on non-Unix.
              os.remove(result_path)
          os.rename(
              os.path.join(tmp_dist_dir, result_basename), result_path
          )
  
      return result_basename
  
imports: import io
  import os
  import sys
  import tokenize
  import shutil
  import contextlib
  import setuptools
  import distutils
  from setuptools.py31compat import TemporaryDirectory
  from pkg_resources import parse_requirements
  from pkg_resources.py31compat import makedirs
label_desc: Use image node_id 7 for calling the _BuildMetaBackend obj's underlying member method code with example usage: obj._build_with_temp_dir(setup_command, result_extension, result_directory, config_settings) and returns: result_basename