code: def build_ephemeral_package() -> str:
      """Repackage current installation of TFX into a tfx_ephemeral sdist.
  
      Returns:
        Path to ephemeral sdist package.
      Raises:
        RuntimeError: if dist directory has zero or multiple files.
      """
      tmp_dir = os.path.join(tempfile.mkdtemp(), "build", "tfx")
      # Find the last directory named 'tfx' in this file's path and package it.
      path_split = __file__.split(os.path.sep)
      last_index = -1
      for i in range(len(path_split)):
          if path_split[i] == "tfx":
              last_index = i
      if last_index < 0:
          raise RuntimeError(
              "Cannot locate directory 'tfx' in the path %s" % __file__
          )
      tfx_root_dir = os.path.sep.join(path_split[0 : last_index + 1])
      absl.logging.info(
          "Copying all content from install dir %s to temp dir %s",
          tfx_root_dir,
          tmp_dir,
      )
      shutil.copytree(tfx_root_dir, os.path.join(tmp_dir, "tfx"))
      # Source directory default permission is 0555 but we need to be able to create
      # new setup.py file.
      os.chmod(tmp_dir, 0o720)
      setup_file = os.path.join(tmp_dir, "setup.py")
      absl.logging.info(
          "Generating a temp setup file at %s", setup_file
      )
      install_requires = dependencies.make_required_install_packages()
      io_utils.write_string_file(
          setup_file,
          _ephemeral_setup_file.format(
              version=version.__version__,
              install_requires=install_requires,
          ),
      )
  
      # Create the package
      curdir = os.getcwd()
      os.chdir(tmp_dir)
      temp_log = os.path.join(tmp_dir, "setup.log")
      with open(temp_log, "w") as f:
          absl.logging.info(
              "Creating temporary sdist package, logs available at %s",
              temp_log,
          )
          cmd = [sys.executable, setup_file, "sdist"]
          subprocess.call(cmd, stdout=f, stderr=f)
      os.chdir(curdir)
  
      # Return the package dir+filename
      dist_dir = os.path.join(tmp_dir, "dist")
      files = fileio.listdir(dist_dir)
      if not files:
          raise RuntimeError("Found no package files in %s" % dist_dir)
      elif len(files) > 1:
          raise RuntimeError(
              "Found multiple package files in %s" % dist_dir
          )
  
      return os.path.join(dist_dir, files[0])
  
file_path: tfx/tfx/utils/dependency_utils.py
imports: import os
  import shutil
  import subprocess
  import sys
  import tempfile
  from typing import List
  import absl
  from tfx import dependencies
  from tfx import version
  from tfx.dsl.io import fileio
  from tfx.utils import io_utils
label_desc: Use image node_id 2 for calling a global function with example usage: build_ephemeral_package() and returns: os