class Bundler::PubGrub::VersionSolver

def choose_package_version

def choose_package_version
  if solution.unsatisfied.empty?
    logger.info "No packages unsatisfied. Solving complete!"
    return nil
  end
  package = next_package_to_try
  unsatisfied_term = solution.unsatisfied.find { |t| t.package == package }
  version = source.versions_for(package, unsatisfied_term.constraint.range).first
  logger.debug { "attempting #{package} #{version}" }
  if version.nil?
    add_incompatibility source.no_versions_incompatibility_for(package, unsatisfied_term)
    return package
  end
  conflict = false
  source.incompatibilities_for(package, version).each do |incompatibility|
    if @seen_incompatibilities.include?(incompatibility)
      logger.debug { "knew: #{incompatibility}" }
      next
    end
    @seen_incompatibilities[incompatibility] = true
    add_incompatibility incompatibility
    conflict ||= incompatibility.terms.all? do |term|
      term.package == package || solution.satisfies?(term)
    end
  end
  unless conflict
    logger.info { "selected #{package} #{version}" }
    solution.decide(package, version)
  else
    logger.info { "conflict: #{conflict.inspect}" }
  end
  package
end