class Diffoscope < Formula desc "In-depth comparison of files, archives, and directories" homepage "https://diffoscope.org" url "https://files.pythonhosted.org/packages/15/73/1f00224c9431933ae6bc3d20abff03f7f5d6ea7727ed2a70bc9cb1971a9b/diffoscope-93.tar.gz" sha256 "d2164f9d83c7469047a3cefa088ac69df8593d1cd48cf9e100539e808eb3203d" bottle do cellar :any_skip_relocation sha256 "1f102c56d8016438cbdafb346af9da30fe72789270e4694b19eb37987d8bba94" => :high_sierra sha256 "1f102c56d8016438cbdafb346af9da30fe72789270e4694b19eb37987d8bba94" => :sierra sha256 "1f102c56d8016438cbdafb346af9da30fe72789270e4694b19eb37987d8bba94" => :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