homebrew-core/Formula/dvc.rb

60 lines
2.2 KiB
Ruby

class Dvc < Formula
include Language::Python::Virtualenv
desc "Git for data science projects"
homepage "https://dvc.org"
url "https://github.com/iterative/dvc/archive/1.1.11.tar.gz"
sha256 "f603831720b1313c2ab31392ef613fa93b3a18affa2b17d7b1e6251027faaf69"
license "Apache-2.0"
bottle do
cellar :any
sha256 "ffee07548a00b707825471c29fde915cfd4e508514cdb6671aa558bf7ed69b9a" => :catalina
sha256 "45bcdc2a1af9699ce058db9dcc8b3a8846a49d55ddd9b63762ce538e05756891" => :mojave
sha256 "fd2057d1cb9f243c40f7745656ca1862f9afea78f282e573911d8c733cc4ea4b" => :high_sierra
end
depends_on "pkg-config" => :build
depends_on "apache-arrow"
depends_on "openssl@1.1"
depends_on "python@3.8"
def install
venv = virtualenv_create(libexec, Formula["python@3.8"].opt_bin/"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,gdrive]"
# 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/"dvc").write `#{bin}/dvc completion -s bash`
(zsh_completion/"_dvc").write `#{bin}/dvc completion -s zsh`
end
test do
system "#{bin}/dvc", "version"
end
end