code: def run(self):  # noqa: C901  # is too complex (14)  # FIXME
      # Generate metadata first
      self.run_command("egg_info")
      # We run install_lib before install_data, because some data hacks
      # pull their data path from the install_lib command.
      log.info("installing library code to %s", self.bdist_dir)
      instcmd = self.get_finalized_command("install")
      old_root = instcmd.root
      instcmd.root = None
      if self.distribution.has_c_libraries() and not self.skip_build:
          self.run_command("build_clib")
      cmd = self.call_command("install_lib", warn_dir=0)
      instcmd.root = old_root
  
      all_outputs, ext_outputs = self.get_ext_outputs()
      self.stubs = []
      to_compile = []
      for p, ext_name in enumerate(ext_outputs):
          filename, ext = os.path.splitext(ext_name)
          pyfile = os.path.join(
              self.bdist_dir, strip_module(filename) + ".py"
          )
          self.stubs.append(pyfile)
          log.info("creating stub loader for %s", ext_name)
          if not self.dry_run:
              write_stub(os.path.basename(ext_name), pyfile)
          to_compile.append(pyfile)
          ext_outputs[p] = ext_name.replace(os.sep, "/")
  
      if to_compile:
          cmd.byte_compile(to_compile)
      if self.distribution.data_files:
          self.do_install_data()
  
      # Make the EGG-INFO directory
      archive_root = self.bdist_dir
      egg_info = os.path.join(archive_root, "EGG-INFO")
      self.mkpath(egg_info)
      if self.distribution.scripts:
          script_dir = os.path.join(egg_info, "scripts")
          log.info("installing scripts to %s", script_dir)
          self.call_command(
              "install_scripts", install_dir=script_dir, no_ep=1
          )
  
      self.copy_metadata_to(egg_info)
      native_libs = os.path.join(egg_info, "native_libs.txt")
      if all_outputs:
          log.info("writing %s", native_libs)
          if not self.dry_run:
              ensure_directory(native_libs)
              libs_file = open(native_libs, "wt")
              libs_file.write("\n".join(all_outputs))
              libs_file.write("\n")
              libs_file.close()
      elif os.path.isfile(native_libs):
          log.info("removing %s", native_libs)
          if not self.dry_run:
              os.unlink(native_libs)
  
      write_safety_flag(
          os.path.join(archive_root, "EGG-INFO"), self.zip_safe()
      )
  
      if os.path.exists(os.path.join(self.egg_info, "depends.txt")):
          log.warn(
              "WARNING: 'depends.txt' will not be used by setuptools 0.6!\n"
              "Use the install_requires/extras_require setup() args instead."
          )
  
      if self.exclude_source_files:
          self.zap_pyfiles()
  
      # Make the archive
      make_zipfile(
          self.egg_output,
          archive_root,
          verbose=self.verbose,
          dry_run=self.dry_run,
          mode=self.gen_header(),
      )
      if not self.keep_temp:
          remove_tree(self.bdist_dir, dry_run=self.dry_run)
  
      # Add to 'Distribution.dist_files' so that the "upload" command works
      getattr(self.distribution, "dist_files", []).append(
          ("bdist_egg", get_python_version(), self.egg_output)
      )
  
imports: from distutils.dir_util import remove_tree, mkpath
  from distutils import log
  from types import CodeType
  import sys
  import os
  import re
  import textwrap
  import marshal
  from setuptools.extension import Library
  from setuptools import Command
  from .._path import ensure_directory
  from sysconfig import get_path, get_python_version
label_desc: Use image node_id 6 for calling the bdist_egg obj's underlying member method code with example usage: obj.run() without return types