code: def make_extension(python, **extra):
      # load platform specific configuration then user configuration
      cfg = init_cfg(
          "pythran.cfg",
          "pythran-{}.cfg".format(sys.platform),
          ".pythranrc",
          extra.get("config", None),
      )
  
      if "config" in extra:
          extra.pop("config")
  
      def parse_define(define):
          index = define.find("=")
          if index < 0:
              return (define, None)
          else:
              return define[:index], define[index + 1 :]
  
      extension = {
          "language": "c++",
          # forcing str conversion to handle Unicode case (the default on MS)
          "define_macros": [
              str(x) for x in shsplit(cfg.get("compiler", "defines"))
          ],
          "undef_macros": [
              str(x) for x in shsplit(cfg.get("compiler", "undefs"))
          ],
          "include_dirs": [
              str(x)
              for x in shsplit(cfg.get("compiler", "include_dirs"))
          ],
          "library_dirs": [
              str(x)
              for x in shsplit(cfg.get("compiler", "library_dirs"))
          ],
          "libraries": [
              str(x) for x in shsplit(cfg.get("compiler", "libs"))
          ],
          "extra_compile_args": [
              str(x) for x in shsplit(cfg.get("compiler", "cflags"))
          ],
          "extra_link_args": [
              str(x) for x in shsplit(cfg.get("compiler", "ldflags"))
          ],
          "extra_objects": [],
      }
  
      if python:
          extension["define_macros"].append("ENABLE_PYTHON_MODULE")
      extension["define_macros"].append(
          "__PYTHRAN__={}".format(sys.version_info.major)
      )
  
      pythonic_dir = get_include()
  
      extension["include_dirs"].append(pythonic_dir)
  
      extra.pop("language", None)  # forced to c++ anyway
      cxx = extra.pop("cxx", None)
      cc = extra.pop("cc", None)
  
      if cxx is None:
          cxx = compiler()
      if cxx is not None:
          extension["cxx"] = cxx
          extension["cc"] = cc or cxx
  
      # Honor CXXFLAGS (note: Pythran calls this `cflags` everywhere, however the
      # standard environment variable is `CXXFLAGS` not `CFLAGS`).
      cflags = os.environ.get("CXXFLAGS", None)
      if cflags is not None:
          extension["extra_compile_args"].extend(shsplit(cflags))
  
      # Honor LDFLAGS
      ldflags = os.environ.get("LDFLAGS", None)
      if ldflags is not None:
          extension["extra_link_args"].extend(shsplit(ldflags))
  
      for k, w in extra.items():
          extension[k].extend(w)
      if cfg.getboolean("pythran", "complex_hook"):
          # the patch is *not* portable
          extension["include_dirs"].append(
              pythonic_dir + "/pythonic/patch"
          )
  
      # numpy specific
      if python:
          extension["include_dirs"].append(numpy.get_include())
  
      # blas dependency
      reserved_blas_entries = "pythran-openblas", "none"
      user_blas = cfg.get("compiler", "blas")
      if user_blas == "pythran-openblas":
          try:
              import pythran_openblas as openblas
  
              # required to cope with atlas missing extern "C"
              extension["define_macros"].append("PYTHRAN_BLAS_OPENBLAS")
              extension["include_dirs"].extend(openblas.include_dirs)
              extension["extra_objects"].append(
                  os.path.join(
                      openblas.library_dir, openblas.static_library
                  )
              )
          except ImportError:
              logger.warning(
                  "Failed to find 'pythran-openblas' package. "
                  "Please install it or change the compiler.blas "
                  "setting. Defaulting to 'blas'"
              )
              user_blas = "blas"
      elif user_blas == "none":
          extension["define_macros"].append("PYTHRAN_BLAS_NONE")
  
      if user_blas not in reserved_blas_entries:
          if sys.version_info < (3, 12):
              # `numpy.distutils` not present for Python >= 3.12
              try:
                  import numpy.distutils.system_info as numpy_sys
  
                  # Numpy can pollute stdout with checks
                  with silent():
                      numpy_blas = numpy_sys.get_info(user_blas)
                      # required to cope with atlas missing extern "C"
                      extension["define_macros"].append(
                          "PYTHRAN_BLAS_{}".format(user_blas.upper())
                      )
                      extension["libraries"].extend(
                          numpy_blas.get("libraries", [])
                      )
                      extension["library_dirs"].extend(
                          numpy_blas.get("library_dirs", [])
                      )
                      extension["include_dirs"].extend(
                          numpy_blas.get("include_dirs", [])
                      )
              except Exception as exc:
                  raise RuntimeError(
                      "The likely cause of this failure is an incompatibility "
                      "between `setuptools` and `numpy.distutils. "
                  ) from exc
  
      # final macro normalization
      extension["define_macros"] = [
          dm if isinstance(dm, tuple) else parse_define(dm)
          for dm in extension["define_macros"]
      ]
      return extension
  
file_path: catboost/contrib/python/pythran/pythran/config.py
imports: import io
  import logging
  import os
  from shlex import split
  import sys
  import numpy
label_desc: Use image node_id 6 for calling a global function with example usage: make_extension(python) and returns: extension, define,  None, define,  define