code: def fixup_build_ext(cmd: Incomplete) -> None:
      """Function needed to make build_ext tests pass.
  
      When Python was built with --enable-shared on Unix, -L. is not enough to
      find libpython<blah>.so, because regrtest runs in a tempdir, not in the
      source directory where the .so lives.
  
      When Python was built with in debug mode on Windows, build_ext commands
      need their debug attribute set, and it is not done automatically for
      some reason.
  
      This function handles both of these things.  Example use:
  
          cmd = build_ext(dist)
          support.fixup_build_ext(cmd)
          cmd.ensure_finalized()
  
      Unlike most other Unix platforms, Mac OS X embeds absolute paths
      to shared libraries into executables, so the fixup is not needed there.
  
      Taken from distutils (was part of the CPython stdlib until Python 3.11)
      """
      if os.name == "nt":
          cmd.debug = sys.executable.endswith("_d.exe")
      elif sysconfig.get_config_var("Py_ENABLE_SHARED"):
          # To further add to the shared builds fun on Unix, we can't just add
          # library_dirs to the Extension() instance because that doesn't get
          # plumbed through to the final compiler command.
          runshared = sysconfig.get_config_var("RUNSHARED")
          if runshared is None:
              cmd.library_dirs = ["."]
          else:
              if sys.platform == "darwin":
                  cmd.library_dirs = []
              else:
                  name, equals, value = runshared.partition("=")
                  cmd.library_dirs = [
                      d for d in value.split(os.pathsep) if d
                  ]
  
imports: import itertools
  import logging
  import os
  import pathlib
  import sys
  import sysconfig
  import tempfile
  import tokenize
  from typing import IO, Any, Dict, List, Optional, Set, Tuple
  from pegen.c_generator import CParserGenerator
  from pegen.grammar import Grammar
  from pegen.grammar_parser import GeneratedParser
  from pegen.parser import Parser
  from pegen.parser_generator import ParserGenerator
  from pegen.python_generator import PythonParserGenerator
  from pegen.tokenizer import Tokenizer
label_desc: Use image node_id 2 for calling a global function with example usage: fixup_build_ext(cmd) without return types