<commit_before>class NoQt5WebKitAlreadyRequirement < Requirement
  fatal true
  satisfy(:build_env => false) { !(Formula["qt5"].lib/"QtWebKit.framework").exist? }

  def message; <<~EOS
    Qt5 formula already has QtWebKit installed (e.g. built `--with-webkit`)
  EOS
  end
end

class NoQt5WebKitSandboxRequirement < Requirement
  fatal true

  def pour_bottle?
    # versions of macOS that have a bottle to install
    # if there is no bottle, --no-sandbox is required, since it will default to source install
    # TODO: handle case where pouring bottle fails (tricky here)
    MacOS.version >= :sierra
  end

  satisfy(:build_env => false) do
    (ARGV.build_all_from_source? || ARGV.build_from_source?) ? ARGV.no_sandbox? : ARGV.no_sandbox? || pour_bottle?
  end

  def message; <<~EOS
    Must be built with `brew install --no-sandbox ...`, or install steps will fail.
  EOS
  end
end

class Qt5Webkit < Formula
  desc "QtWebit module for Qt5"
  homepage "https://download.qt.io/official_releases/qt/5.11"
  url "https://github.com/qt/qtwebkit.git",
    :branch => "5.212",
    :commit => "72cfbd7664f21fcc0e62b869a6b01bf73eb5e7da"
  version "5.11.1"

  bottle do
    root_url "https://dl.bintray.com/homebrew-osgeo/osgeo-bottles"
    sha256 "49dbdda9a08a7e3921ad14aa095190e51926e4cef6e11731430a07c6d0395de3" => :sierra
    sha256 "689dc916f223b50ca697600edb7dcb995dc92fa17740197b1fbb13582a3a21ad" => :high_sierra
  end

  keg_only "because Qt5 is keg-only"

  depends_on NoQt5WebKitAlreadyRequirement
  depends_on NoQt5WebKitSandboxRequirement

  depends_on "qt"

  depends_on :macos => :mountain_lion
  depends_on :xcode => :build
  depends_on "cmake" => :build
  depends_on "libjpeg"
  depends_on "libpng"
  depends_on "webp"

  def install
    # On Mavericks we want to target libc++, this requires a macx-clang flag.
    if ENV.compiler == :clang && MacOS.version >= :mavericks<commit_msg>Rebuild bottles after webp fixes.<commit_after>class NoQt5WebKitAlreadyRequirement < Requirement
  fatal true
  satisfy(:build_env => false) { !(Formula["qt5"].lib/"QtWebKit.framework").exist? }

  def message; <<~EOS
    Qt5 formula already has QtWebKit installed (e.g. built `--with-webkit`)
  EOS
  end
end

class NoQt5WebKitSandboxRequirement < Requirement
  fatal true

  def pour_bottle?
    # versions of macOS that have a bottle to install
    # if there is no bottle, --no-sandbox is required, since it will default to source install
    # TODO: handle case where pouring bottle fails (tricky here)
    MacOS.version >= :sierra
  end

  satisfy(:build_env => false) do
    (ARGV.build_all_from_source? || ARGV.build_from_source?) ? ARGV.no_sandbox? : ARGV.no_sandbox? || pour_bottle?
  end

  def message; <<~EOS
    Must be built with `brew install --no-sandbox ...`, or install steps will fail.
  EOS
  end
end

class Qt5Webkit < Formula
  desc "QtWebit module for Qt5"
  homepage "https://download.qt.io/official_releases/qt/5.11"
  url "https://github.com/qt/qtwebkit.git",
    :branch => "5.212",
    :commit => "<PASSWORD>"
  version "5.11.1"

  bottle do
    root_url "https://dl.bintray.com/homebrew-osgeo/osgeo-bottles"
    cellar :any
    rebuild 1
    sha256 "e747978ccf022d826d8133ddc15a27f5223ca1a6b2c02d2d61f36c72070a682f" => :high_sierra
    sha256 "84920602f319187267bd60fdcdad83e94a9c3e89333652595b8a630778547727" => :sierra
  end

  keg_only "because Qt5 is keg-only"

  depends_on NoQt5WebKitAlreadyRequirement
  depends_on NoQt5WebKitSandboxRequirement

  depends_on "qt"

  depends_on :macos => :mountain_lion
  depends_on :xcode => :build
  depends_on "cmake" => :build
  depends_on "libjpeg"
  depends_on "libpng"
  depends_on "webp"

  def install
    # On Mavericks we want to target libc++, this requires a macx-clang flag.
    if ENV.compiler == :clang && MacOS.version >= :mavericks
{'fraction_non_alphanumeric': 0.10162388685175484, 'fraction_numerical': 0.0644316396018858, 'mean_word_length': 3.97265625, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 26, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1163407', 'n_tokens_mistral': 1569, 'n_tokens_neox': 1429, 'n_words': 341}