parameters: ()
docstring: Installs the Kudu python module if possible, which depends on the toolchain and
    the compiled requirements in requirements.txt. If the toolchain isn't
    available, nothing will be done.
docstring_summary: Installs the Kudu python module if possible, which depends on the toolchain and
    the compiled requirements in requirements.txt. If the toolchain isn't
    available, nothing will be done.
docstring_tokens: Installs the Kudu python module if possible which depends on the toolchain and the compiled requirements in requirements . txt . If the toolchain isn t available nothing will be done .
function: def install_kudu_client_if_possible():
    '''Installs the Kudu python module if possible, which depends on the toolchain and
    the compiled requirements in requirements.txt. If the toolchain isn't
    available, nothing will be done.'''
    if reqs_are_installed(KUDU_REQS_PATH):
      LOG.debug("Skipping Kudu: matching kudu-installed-requirements.txt found")
      return
    kudu_base_dir = os.environ["IMPALA_KUDU_HOME"]
    if not os.path.exists(kudu_base_dir):
      LOG.debug("Skipping Kudu: %s doesn't exist" % kudu_base_dir)
      return
  
    LOG.info("Installing Kudu into the virtualenv")
    # The installation requires that KUDU_HOME/build/latest exists. An empty directory
    # structure will be made to satisfy that. The Kudu client headers and lib will be made
    # available through GCC environment variables.
    fake_kudu_build_dir = os.path.join(tempfile.gettempdir(), "virtualenv-kudu")
    try:
      artifact_dir = os.path.join(fake_kudu_build_dir, "build", "latest")
      if not os.path.exists(artifact_dir):
        os.makedirs(artifact_dir)
      cc = select_cc()
      assert cc is not None
      env = dict(os.environ)
      env["KUDU_HOME"] = fake_kudu_build_dir
      kudu_client_dir = find_kudu_client_install_dir()
      # Copy the include directory to the fake build directory
      kudu_include_dir = os.path.join(kudu_client_dir, "include")
      shutil.copytree(kudu_include_dir,
                      os.path.join(fake_kudu_build_dir, "build", "latest", "src"))
      env["CPLUS_INCLUDE_PATH"] = os.path.join(kudu_client_dir, "include")
      env["LIBRARY_PATH"] = os.path.pathsep.join([os.path.join(kudu_client_dir, 'lib'),
                                                  os.path.join(kudu_client_dir, 'lib64')])
      exec_pip_install(["-r", KUDU_REQS_PATH], cc=cc, env=env)
      mark_reqs_installed(KUDU_REQS_PATH)
    finally:
      try:
        shutil.rmtree(fake_kudu_build_dir)
      except Exception:
        LOG.debug("Error removing temp Kudu build dir", exc_info=True)
function_tokens: def install_kudu_client_if_possible ( ) : if reqs_are_installed ( KUDU_REQS_PATH ) : LOG . debug ( "Skipping Kudu: matching kudu-installed-requirements.txt found" ) return kudu_base_dir = os . environ [ "IMPALA_KUDU_HOME" ] if not os . path . exists ( kudu_base_dir ) : LOG . debug ( "Skipping Kudu: %s doesn't exist" % kudu_base_dir ) return LOG . info ( "Installing Kudu into the virtualenv" ) # The installation requires that KUDU_HOME/build/latest exists. An empty directory # structure will be made to satisfy that. The Kudu client headers and lib will be made # available through GCC environment variables. fake_kudu_build_dir = os . path . join ( tempfile . gettempdir ( ) , "virtualenv-kudu" ) try : artifact_dir = os . path . join ( fake_kudu_build_dir , "build" , "latest" ) if not os . path . exists ( artifact_dir ) : os . makedirs ( artifact_dir ) cc = select_cc ( ) assert cc is not None env = dict ( os . environ ) env [ "KUDU_HOME" ] = fake_kudu_build_dir kudu_client_dir = find_kudu_client_install_dir ( ) # Copy the include directory to the fake build directory kudu_include_dir = os . path . join ( kudu_client_dir , "include" ) shutil . copytree ( kudu_include_dir , os . path . join ( fake_kudu_build_dir , "build" , "latest" , "src" ) ) env [ "CPLUS_INCLUDE_PATH" ] = os . path . join ( kudu_client_dir , "include" ) env [ "LIBRARY_PATH" ] = os . path . pathsep . join ( [ os . path . join ( kudu_client_dir , 'lib' ) , os . path . join ( kudu_client_dir , 'lib64' ) ] ) exec_pip_install ( [ "-r" , KUDU_REQS_PATH ] , cc = cc , env = env ) mark_reqs_installed ( KUDU_REQS_PATH ) finally : try : shutil . rmtree ( fake_kudu_build_dir ) except Exception : LOG . debug ( "Error removing temp Kudu build dir" , exc_info = True )