class_docstr: Conditionally complement the setup.cfg options file.
  
  This class configures the include_dirs, library_dirs, libraries
  options as required by the system. Most of the configuration happens
  in finalize_options() method.
  
  If you want to set up the build step for a peculiar platform, add a
  method finalize_PLAT(), where PLAT matches your sys.platform.
docstr: Complete the build system configuration.
docstr_tok: ["Complete","the","build","system","configuration","."]
code: def finalize_options(self):
      """Complete the build system configuration."""
      # An empty option in the setup.cfg causes self.libraries to include
      # an empty string in the list of libraries
      if self.libraries is not None and not self.libraries.strip():
          self.libraries = None
  
      build_ext.finalize_options(self)
  
      pg_config_helper = PostgresConfig(self)
  
      self.include_dirs.append(".")
      if self.static_libpq:
          if not getattr(self, "link_objects", None):
              self.link_objects = []
          self.link_objects.append(
              os.path.join(pg_config_helper.query("libdir"), "libpq.a")
          )
      else:
          self.libraries.append("pq")
  
      try:
          self.library_dirs.append(pg_config_helper.query("libdir"))
          self.include_dirs.append(pg_config_helper.query("includedir"))
          self.include_dirs.append(
              pg_config_helper.query("includedir-server")
          )
  
          # if present, add includedirs from cppflags, libdirs from ldflags
          tokens = pg_config_helper.query(
              "ldflags", empty_ok=True
          ).split()
          for token in tokens:
              if token.startswith("-L"):
                  self.library_dirs.append(token[2:])
  
          tokens = pg_config_helper.query(
              "cppflags", empty_ok=True
          ).split()
          for token in tokens:
              if token.startswith("-I"):
                  self.include_dirs.append(token[2:])
  
          pgversion = pg_config_helper.query("version").split()[1]
  
          verre = re.compile(
              r"(\d+)(?:\.(\d+))?(?:(?:\.(\d+))|(devel|(?:alpha|beta|rc)\d+))?"
          )
          m = verre.match(pgversion)
          if m:
              pgmajor, pgminor, pgpatch = m.group(1, 2, 3)
              # Postgres >= 10 doesn't have pgminor anymore.
              pgmajor = int(pgmajor)
              if pgmajor >= 10:
                  pgminor, pgpatch = None, pgminor
              if pgminor is None or not pgminor.isdigit():
                  pgminor = 0
              if pgpatch is None or not pgpatch.isdigit():
                  pgpatch = 0
              pgminor = int(pgminor)
              pgpatch = int(pgpatch)
          else:
              sys.stderr.write(
                  f"Error: could not determine PostgreSQL version from "
                  f"'{pgversion}'"
              )
              sys.exit(1)
  
          define_macros.append(
              (
                  "PG_VERSION_NUM",
                  "%d%02d%02d" % (pgmajor, pgminor, pgpatch),
              )
          )
  
          # enable lo64 if libpq >= 9.3 and Python 64 bits
          if (pgmajor, pgminor) >= (9, 3) and is_py_64():
              define_macros.append(("HAVE_LO64", "1"))
  
              # Inject the flag in the version string already packed up
              # because we didn't know the version before.
              # With distutils everything is complicated.
              for i, t in enumerate(define_macros):
                  if t[0] == "PSYCOPG_VERSION":
                      n = t[1].find(")")
                      if n > 0:
                          define_macros[i] = (
                              t[0],
                              t[1][:n] + " lo64" + t[1][n:],
                          )
  
      except Warning:
          w = sys.exc_info()[1]  # work around py 2/3 different syntax
          sys.stderr.write(f"Error: {w}\n")
          sys.exit(1)
  
      if hasattr(self, "finalize_" + sys.platform):
          getattr(self, "finalize_" + sys.platform)()
  
imports: import os
  import sys
  import re
  import subprocess
  from setuptools import setup, Extension
  from distutils.command.build_ext import build_ext
  from distutils.ccompiler import get_default_compiler
  from distutils.errors import CompileError
  import configparser
label_desc: Use image node_id 11 for calling the psycopg_build_ext obj's underlying member method code with example usage: obj.finalize_options() without return types