class Twoping < Formula desc "Ping utility to determine directional packet loss" homepage "https://www.finnie.org/software/2ping/" url "https://www.finnie.org/software/2ping/2ping-4.3.tar.gz" sha256 "d729c021ed5bcd29137da520a465632e19cf4c4339e0426546593379a570327e" head "https://github.com/rfinnie/2ping.git" bottle do cellar :any_skip_relocation sha256 "263a94b215874f6bcc0478cbc14d3a83e656ba4428d2b9d4f0031782a2b5fdda" => :mojave sha256 "ede1052f3ad05e51c653d49935e2f9a1be9b7bc39ee5f77da20e5fc81ffa3dd7" => :high_sierra sha256 "ede1052f3ad05e51c653d49935e2f9a1be9b7bc39ee5f77da20e5fc81ffa3dd7" => :sierra end depends_on "python" def install pyver = Language::Python.major_minor_version "python3" ENV.prepend_create_path "PYTHONPATH", libexec/"lib/python#{pyver}/site-packages" system "python3", *Language::Python.setup_install_args(libexec) man1.install "doc/2ping.1" man1.install_symlink "2ping.1" => "2ping6.1" bin.install Dir["#{libexec}/bin/*"] bin.env_script_all_files(libexec/"bin", :PYTHONPATH => ENV["PYTHONPATH"]) end plist_options :manual => "2ping --listen", :startup => true def plist; <<~EOS Label #{plist_name} ProgramArguments #{opt_bin}/2ping --listen --quiet UserName nobody StandardErrorPath /dev/null StandardOutPath /dev/null RunAtLoad KeepAlive EOS end test do system bin/"2ping", "-c", "5", "test.2ping.net" end end