code: def construct_build_ext(build_ext):
      # This class allows extension building to fail.
      # https://stackoverflow.com/questions/41778153/
      ext_errors = (
          CCompilerError,
          DistutilsExecError,
          DistutilsPlatformError,
          DistutilsError,
          IOError,
      )
  
      class WrappedBuildExt(build_ext):
          def run(self):
              try:
                  build_ext.run(self)
              except (DistutilsPlatformError, CompilerNotFound) as x:
                  raise BuildFailed(x)
  
          def build_extension(self, ext):
              try:
                  build_ext.build_extension(self, ext)
              except ext_errors as x:
                  raise BuildFailed(x)
  
      return WrappedBuildExt
  
file_path: dragonfly/setup.py
imports: import os
  from setuptools import find_packages
  from distutils.errors import CCompilerError, DistutilsExecError, DistutilsPlatformError, DistutilsError
  from numpy.distutils.core import setup, Extension
  from numpy.distutils.command.build_ext import build_ext
  from numpy.distutils.fcompiler import CompilerNotFound
label_desc: Use image node_id 1 for calling a global function with example usage: construct_build_ext(build_ext) and returns: WrappedBuildExt