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" revision 1 head "https://github.com/gcovr/gcovr.git" bottle do cellar :any_skip_relocation sha256 "a867483ea9f602a4391c76d36b1a3b48a8a4225faba80887574baecfb75c0318" => :high_sierra sha256 "ec151f5b364790d59fbaa86fa0b5ce64cd4dab9b3cf83c91feb4410190fe379f" => :sierra sha256 "cdd8bc61abc55d29ba88a3a53bf573e7a3ab284fbf1dec3eceec595df825415f" => :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