code: def build_extensions(self):
      self.create_compile_commands()
      # The caffe2 extensions are created in
      # tmp_install/lib/pythonM.m/site-packages/caffe2/python/
      # and need to be copied to build/lib.linux.... , which will be a
      # platform dependent build folder created by the "build" command of
      # setuptools. Only the contents of this folder are installed in the
      # "install" command by default.
      # We only make this copy for Caffe2's pybind extensions
      caffe2_pybind_exts = [
          "caffe2.python.caffe2_pybind11_state",
          "caffe2.python.caffe2_pybind11_state_gpu",
          "caffe2.python.caffe2_pybind11_state_hip",
      ]
      i = 0
      while i < len(self.extensions):
          ext = self.extensions[i]
          if ext.name not in caffe2_pybind_exts:
              i += 1
              continue
          fullname = self.get_ext_fullname(ext.name)
          filename = self.get_ext_filename(fullname)
          report(f"\nCopying extension {ext.name}")
  
          relative_site_packages = (
              sysconfig.get_path("purelib")
              .replace(sysconfig.get_path("data"), "")
              .lstrip(os.path.sep)
          )
          src = os.path.join("torch", relative_site_packages, filename)
          if not os.path.exists(src):
              report(f"{src} does not exist")
              del self.extensions[i]
          else:
              dst = os.path.join(
                  os.path.realpath(self.build_lib), filename
              )
              report(f"Copying {ext.name} from {src} to {dst}")
              dst_dir = os.path.dirname(dst)
              if not os.path.exists(dst_dir):
                  os.makedirs(dst_dir)
              self.copy_file(src, dst)
              i += 1
  
      # Copy functorch extension
      for i, ext in enumerate(self.extensions):
          if ext.name != "functorch._C":
              continue
          fullname = self.get_ext_fullname(ext.name)
          filename = self.get_ext_filename(fullname)
          fileext = os.path.splitext(filename)[1]
          src = os.path.join(
              os.path.dirname(filename), "functorch" + fileext
          )
          dst = os.path.join(os.path.realpath(self.build_lib), filename)
          if os.path.exists(src):
              report(f"Copying {ext.name} from {src} to {dst}")
              dst_dir = os.path.dirname(dst)
              if not os.path.exists(dst_dir):
                  os.makedirs(dst_dir)
              self.copy_file(src, dst)
  
      setuptools.command.build_ext.build_ext.build_extensions(self)
  
imports: import sys
  import platform
  import filecmp
  import glob
  import importlib
  import json
  import os
  import shutil
  import subprocess
  import sysconfig
  import time
  from collections import defaultdict
  import setuptools.command.build_ext
  import setuptools.command.install
  import setuptools.command.sdist
  from setuptools import Extension, find_packages, setup
  from setuptools.dist import Distribution
  from tools.build_pytorch_libs import build_caffe2
  from tools.generate_torch_version import get_torch_version
  from tools.setup_helpers.cmake import CMake
  from tools.setup_helpers.env import build_type, IS_DARWIN, IS_LINUX, IS_WINDOWS
label_desc: Use image node_id 3 for calling the build_ext obj's underlying member method code with example usage: obj.build_extensions() without return types