class Diffoscope < Formula desc "In-depth comparison of files, archives, and directories" homepage "https://diffoscope.org" url "https://files.pythonhosted.org/packages/8e/31/f3f508bf8aea30d78cfa2cc87db9c2340ba4e38c6162d891941e3ad55e6c/diffoscope-94.tar.gz" sha256 "a6cbd7d6b207a92b5ffb9945be132cf56cff6e1cf34f7749761ffd993261ec1e" bottle do cellar :any_skip_relocation sha256 "0b377c127b98af9f52c7d23cc7ea41ca04dfbcc741db666a15558e159116350c" => :high_sierra sha256 "0b377c127b98af9f52c7d23cc7ea41ca04dfbcc741db666a15558e159116350c" => :sierra sha256 "0b377c127b98af9f52c7d23cc7ea41ca04dfbcc741db666a15558e159116350c" => :el_capitan end depends_on "libmagic" depends_on "libarchive" depends_on "gnu-tar" depends_on "python" resource "libarchive-c" do url "https://files.pythonhosted.org/packages/1f/4a/7421e8db5c7509cf75e34b92a32b69c506f2b6f6392a909c2f87f3e94ad2/libarchive-c-2.7.tar.gz" sha256 "56eadbc383c27ec9cf6aad3ead72265e70f80fa474b20944328db38bab762b04" end resource "python-magic" do url "https://files.pythonhosted.org/packages/84/30/80932401906eaf787f2e9bd86dc458f1d2e75b064b4c187341f29516945c/python-magic-0.4.15.tar.gz" sha256 "f3765c0f582d2dfc72c15f3b5a82aecfae9498bd29ca840d72f37d7bd38bfcd5" end def install ENV.delete("PYTHONPATH") # play nice with libmagic --with-python pyver = Language::Python.major_minor_version "python3" ENV.prepend_create_path "PYTHONPATH", libexec/"vendor/lib/python#{pyver}/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#{pyver}/site-packages" system "python3", *Language::Python.setup_install_args(libexec) bin.install Dir[libexec/"bin/*"] libarchive = Formula["libarchive"].opt_lib/"libarchive.dylib" bin.env_script_all_files(libexec+"bin", :PYTHONPATH => ENV["PYTHONPATH"], :LIBARCHIVE => libarchive) end test do (testpath/"test1").write "test" cp testpath/"test1", testpath/"test2" system "#{bin}/diffoscope", "test1", "test2" end end