code: def setup_benchbuild():
      
      LOG.debug("Setting up Benchbuild...")
  
      venv_dir = local.path("/benchbuild")
      prefixes = CFG["container"]["prefixes"].value
      prefixes.append(venv_dir)
      CFG["container"]["prefixes"] = prefixes
  
      src_dir = str(CFG["source_dir"])
      have_src = src_dir is not None
      if have_src:
          __mount_source(src_dir)
  
      benchbuild = find_benchbuild()
      if benchbuild and not requires_update(benchbuild):
          if have_src:
              __upgrade_from_source(venv_dir, with_deps=False)
          return
  
      setup_virtualenv(venv_dir)
      if have_src:
          __upgrade_from_source(venv_dir)
      else:
          __upgrade_from_pip(venv_dir)
docs: Setup benchbuild inside a container.
  
      This will query a for an existing installation of benchbuild and
      try to upgrade it to the latest version, if possible.