class Dvc < Formula include Language::Python::Virtualenv desc "Git for data science projects" homepage "https://dvc.org" url "https://github.com/iterative/dvc/archive/0.77.3.tar.gz" sha256 "ebe2cd4c5f06c7dcfa6ff984f279578340f784c543430311fade8958668de6c9" bottle do cellar :any sha256 "a30c6bf14c66c5dc8c57a8255038dc258e22256809e2a3f55ab82d3c335c29f6" => :catalina sha256 "5d493b85ddcc0e56d840071094e953e462de4e6aae60333dfc5f24ae717013de" => :mojave sha256 "c5b29e0c3c8ebcdebe00ab49917d5c66c3667bf8ef810ede0f6bfcd2a971b1ad" => :high_sierra end depends_on "pkg-config" => :build depends_on "apache-arrow" depends_on "openssl@1.1" depends_on "python" def install venv = virtualenv_create(libexec, "python3") system libexec/"bin/pip", "install", "--no-binary", ":all:", # NOTE: we will uninstall Pillow anyway, so there is no need to build it # from source. "--only-binary", "Pillow", "--ignore-installed", # NOTE: pyarrow is already installed as a part of apache-arrow package, # so we don't need to specify `hdfs` option. ".[gs,s3,azure,oss,ssh]" # NOTE: dvc depends on asciimatics, which depends on Pillow, which # uses liblcms2.2.dylib that causes troubles on mojave. See [1] # and [2] for more info. As a workaround, we need to simply # uninstall Pillow. # # [1] https://github.com/peterbrittain/asciimatics/issues/95 # [2] https://github.com/iterative/homebrew-dvc/issues/9 system libexec/"bin/pip", "uninstall", "-y", "Pillow" system libexec/"bin/pip", "uninstall", "-y", "dvc" # NOTE: dvc uses this file [1] to know which package it was installed from, # so that it is able to provide appropriate instructions for updates. # [1] https://github.com/iterative/dvc/blob/0.68.1/dvc/utils/pkg.py File.open("dvc/utils/build.py", "w+") { |file| file.write("PKG = \"brew\"") } venv.pip_install_and_link buildpath bash_completion.install "scripts/completion/dvc.bash" => "dvc" zsh_completion.install "scripts/completion/dvc.zsh" end test do system "#{bin}/dvc", "--version" end end