class Gcovr < Formula desc "Reports from gcov test coverage program" homepage "https://gcovr.com/" url "https://github.com/gcovr/gcovr/archive/4.0.tar.gz" sha256 "f9731a0ea516f2087e13b3bc310dbd8edaec4ce6a56b2462f5603ee925f40377" head "https://github.com/gcovr/gcovr.git" bottle do cellar :any_skip_relocation sha256 "59df642ddfc6f02b6b7d016b5981d052993810172ffd6c40b762b4b29f2cc945" => :high_sierra sha256 "d7af2533c0368f4b09171804c04e482dcb275bc733192dbb7ae614a65190ffc0" => :sierra sha256 "7a763937433619fc56d1a44f20ff21ac509a04da217b211743d0299e49f6d510" => :el_capitan end depends_on "python" resource "Jinja2" do url "https://files.pythonhosted.org/packages/56/e6/332789f295cf22308386cf5bbd1f4e00ed11484299c5d7383378cf48ba47/Jinja2-2.10.tar.gz" sha256 "f84be1bb0040caca4cea721fcbbbbd61f9be9464ca236387158b0feea01914a4" end resource "MarkupSafe" do url "https://files.pythonhosted.org/packages/4d/de/32d741db316d8fdb7680822dd37001ef7a448255de9699ab4bfcbdf4172b/MarkupSafe-1.0.tar.gz" sha256 "a6be69091dac236ea9c6bc7d012beab42010fa914c459791d627dad4910eb665" end def install xy = Language::Python.major_minor_version "python3" ENV.prepend_create_path "PYTHONPATH", libexec/"vendor/lib/python#{xy}/site-packages" resources.each do |r| r.stage do system "python3", *Language::Python.setup_install_args(libexec/"vendor") end end ENV.prepend_create_path "PYTHONPATH", libexec/"lib/python#{xy}/site-packages" system "python3", *Language::Python.setup_install_args(libexec) bin.install Dir[libexec/"bin/*"] bin.env_script_all_files(libexec/"bin", :PYTHONPATH => ENV["PYTHONPATH"]) end test do (testpath/"example.c").write "int main() { return 0; }" system "cc", "-fprofile-arcs", "-ftest-coverage", "-fPIC", "-O0", "-o", "example", "example.c" assert_match "Code Coverage Report", shell_output("#{bin}/gcovr -r .") end end