class_docstr: Override build_extension to run cmake.
class_docstr_tok: ["Override","build_extension","to","run","cmake","."]
code: def build_extension(self, ext):
      cflags, libs = get_cflags_and_libs("../build/root")
  
      if len(libs) == 0:
          if is_sentencepiece_installed():
              cflags = cflags + run_pkg_config("cflags")
              libs = run_pkg_config("libs")
          else:
              subprocess.check_call(["./build_bundled.sh", __version__])
              cflags, libs = get_cflags_and_libs("./build/root")
  
      # Fix compile on some versions of Mac OSX
      # See: https://github.com/neulab/xnmt/issues/199
      if sys.platform == "darwin":
          cflags.append("-mmacosx-version-min=10.9")
      else:
          cflags.append("-Wl,-strip-all")
          libs.append("-Wl,-strip-all")
      if sys.platform == "linux":
          libs.append("-Wl,-Bsymbolic")
      print("## cflags={}".format(" ".join(cflags)))
      print("## libs={}".format(" ".join(libs)))
      ext.extra_compile_args = cflags
      ext.extra_link_args = libs
      _build_ext.build_extension(self, ext)
  
file_path: sentencepiece/python/setup.py
imports: import codecs
  import os
  import string
  import subprocess
  import sys
  from setuptools import Extension, setup
  from setuptools.command.build_ext import build_ext
  from setuptools.command.build_py import build_py
label_desc: Use image node_id 1 for calling the build_ext obj's underlying member method code with example usage: obj.build_extension(ext) without return types