class_docstr: A command that runs Bazel to build a C/C++ extension.
class_docstr_tok: ["A","command","that","runs","Bazel","to","build","a","C\/C++","extension","."]
code: def run(self):
      _check_bazel()
      if IS_MAC:
          for ext in self.extensions:
              target_name = self.get_ext_fullpath(ext.name)
              # Build x86
              self._build_binary(
                  ext,
                  [
                      "--cpu=darwin",
                      "--ios_multi_cpus=i386,x86_64,armv7,arm64",
                  ],
              )
              x86_name = self.get_ext_fullpath(ext.name)
              # Build Arm64
              ext.name = ext.name + ".arm64"
              self._build_binary(
                  ext,
                  [
                      "--cpu=darwin_arm64",
                      "--ios_multi_cpus=i386,x86_64,armv7,arm64",
                  ],
              )
              arm64_name = self.get_ext_fullpath(ext.name)
              # Merge architectures
              lipo_command = [
                  "lipo",
                  "-create",
                  "-output",
                  target_name,
                  x86_name,
                  arm64_name,
              ]
              _invoke_shell_command(lipo_command)
              # Delete the arm64 file (the x86 file was overwritten by lipo)
              _invoke_shell_command(["rm", arm64_name])
      else:
          for ext in self.extensions:
              self._build_binary(ext)
      build_ext.build_ext.run(self)
  
imports: import glob
  import os
  import platform
  import posixpath
  import re
  import shlex
  import shutil
  import subprocess
  import sys
  import setuptools
  from setuptools.command import build_ext
  from setuptools.command import build_py
  from setuptools.command import install
label_desc: Use image node_id 3 for calling the BuildExtension obj's underlying member method code with example usage: obj.run() without return types