text: from distutils.errors import CCompilerError, DistutilsExecError, DistutilsPlatformError
  
  from setuptools import Extension
  from setuptools.command.build_ext import build_ext
  
  
  class BuildFailed(Exception):
      pass
  
  
  class ExtBuilder(build_ext):
      def run(self):
          try:
              build_ext.run(self)
          except (DistutilsPlatformError, FileNotFoundError):
              pass
  
      def build_extension(self, ext):
          try:
              build_ext.build_extension(self, ext)
          except (CCompilerError, DistutilsExecError, DistutilsPlatformError, ValueError):
              pass
  
  
  def build(setup_kwargs):
      extensions = [
          Extension(
              "puyocore",
              sources=[
                  "src/wrapper.c",
                  "src/bottom.c",
                  "src/tall.c",
                  "src/bitboard.c",
                  "src/bottom_tree.c",
                  "src/tall_tree.c",
              ],
              include_dirs=["src/include"],
          ),
      ]
  
      setup_kwargs.update({"ext_modules": extensions, "cmdclass": {"build_ext": ExtBuilder}})
  