109 lines
4.2 KiB
Ruby
109 lines
4.2 KiB
Ruby
class Pipenv < Formula
|
|
include Language::Python::Virtualenv
|
|
|
|
desc "Python dependency management tool"
|
|
homepage "https://pipenv.pypa.io/"
|
|
url "https://files.pythonhosted.org/packages/cc/0a/ed147c6bb2245ac9b275ef28db37b338181f1afe696317e0372786b57107/pipenv-2020.8.13.tar.gz"
|
|
sha256 "eff0e10eadb330f612edfa5051d3d8e775e9e0e918c3c50361da703bd0daa035"
|
|
license "MIT"
|
|
|
|
livecheck do
|
|
url :stable
|
|
end
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
sha256 "c5058ffbbadf6d538bd7eb2c721b27a31ae91203b3d2bbed6b75d0eff20c4782" => :catalina
|
|
sha256 "9c6ac58c1c92a49c90486b1457bd06d188f02adcd4e81b95860160b8b111304e" => :mojave
|
|
sha256 "c1d7054bcac7369353d537e86bee0553a0c1dc14248ea1c4e7b9746257cef2af" => :high_sierra
|
|
end
|
|
|
|
depends_on "python@3.8"
|
|
|
|
resource "appdirs" do
|
|
url "https://files.pythonhosted.org/packages/d7/d8/05696357e0311f5b5c316d7b95f46c669dd9c15aaeecbb48c7d0aeb88c40/appdirs-1.4.4.tar.gz"
|
|
sha256 "7d5d0167b2b1ba821647616af46a749d1c653740dd0d2415100fe26e27afdf41"
|
|
end
|
|
|
|
resource "certifi" do
|
|
url "https://files.pythonhosted.org/packages/40/a7/ded59fa294b85ca206082306bba75469a38ea1c7d44ea7e1d64f5443d67a/certifi-2020.6.20.tar.gz"
|
|
sha256 "5930595817496dd21bb8dc35dad090f1c2cd0adfaf21204bf6732ca5d8ee34d3"
|
|
end
|
|
|
|
resource "distlib" do
|
|
url "https://files.pythonhosted.org/packages/2f/83/1eba07997b8ba58d92b3e51445d5bf36f9fba9cb8166bcae99b9c3464841/distlib-0.3.1.zip"
|
|
sha256 "edf6116872c863e1aa9d5bb7cb5e05a022c519a4594dc703843343a9ddd9bff1"
|
|
end
|
|
|
|
resource "filelock" do
|
|
url "https://files.pythonhosted.org/packages/14/ec/6ee2168387ce0154632f856d5cc5592328e9cf93127c5c9aeca92c8c16cb/filelock-3.0.12.tar.gz"
|
|
sha256 "18d82244ee114f543149c66a6e0c14e9c4f8a1044b5cdaadd0f82159d6a6ff59"
|
|
end
|
|
|
|
resource "six" do
|
|
url "https://files.pythonhosted.org/packages/6b/34/415834bfdafca3c5f451532e8a8d9ba89a21c9743a0c59fbd0205c7f9426/six-1.15.0.tar.gz"
|
|
sha256 "30639c035cdb23534cd4aa2dd52c3bf48f06e5f4a941509c8bafd8ce11080259"
|
|
end
|
|
|
|
resource "virtualenv" do
|
|
url "https://files.pythonhosted.org/packages/fb/f8/5a5fd05ee4b85b819bc7c11d287a32f6925a970fe2f867eac1889b8760ed/virtualenv-20.0.30.tar.gz"
|
|
sha256 "7b54fd606a1b85f83de49ad8d80dbec08e983a2d2f96685045b262ebc7481ee5"
|
|
end
|
|
|
|
resource "virtualenv-clone" do
|
|
url "https://files.pythonhosted.org/packages/1d/51/076f3a72af6c874e560be8a6145d6ea5be70387f21e65d42ddd771cbd93a/virtualenv-clone-0.5.4.tar.gz"
|
|
sha256 "665e48dd54c84b98b71a657acb49104c54e7652bce9c1c4f6c6976ed4c827a29"
|
|
end
|
|
|
|
def install
|
|
# Using the virtualenv DSL here because the alternative of using
|
|
# write_env_script to set a PYTHONPATH breaks things.
|
|
# https://github.com/Homebrew/homebrew-core/pull/19060#issuecomment-338397417
|
|
venv = virtualenv_create(libexec, "python3")
|
|
venv.pip_install resources
|
|
venv.pip_install buildpath
|
|
|
|
# `pipenv` needs to be able to find `virtualenv` on PATH. So we
|
|
# install symlinks for those scripts in `#{libexec}/tools` and create a
|
|
# wrapper script for `pipenv` which adds `#{libexec}/tools` to PATH.
|
|
(libexec/"tools").install_symlink libexec/"bin/pip", libexec/"bin/virtualenv"
|
|
env = {
|
|
PATH: "#{libexec}/tools:$PATH",
|
|
}
|
|
(bin/"pipenv").write_env_script(libexec/"bin/pipenv", env)
|
|
|
|
output = Utils.safe_popen_read(
|
|
{ "PIPENV_SHELL" => "bash" }, libexec/"bin/pipenv", "--completion", { err: :err }
|
|
)
|
|
(bash_completion/"pipenv").write output
|
|
|
|
output = Utils.safe_popen_read(
|
|
{ "PIPENV_SHELL" => "zsh" }, libexec/"bin/pipenv", "--completion", { err: :err }
|
|
)
|
|
(zsh_completion/"_pipenv").write output
|
|
end
|
|
|
|
# Avoid relative paths
|
|
def post_install
|
|
lib_python_path = Pathname.glob(libexec/"lib/python*").first
|
|
lib_python_path.each_child do |f|
|
|
next unless f.symlink?
|
|
|
|
realpath = f.realpath
|
|
rm f
|
|
ln_s realpath, f
|
|
end
|
|
end
|
|
|
|
test do
|
|
ENV["LC_ALL"] = "en_US.UTF-8"
|
|
assert_match "Commands", shell_output("#{bin}/pipenv")
|
|
system "#{bin}/pipenv", "install", "requests"
|
|
system "#{bin}/pipenv", "install", "boto3"
|
|
assert_predicate testpath/"Pipfile", :exist?
|
|
assert_predicate testpath/"Pipfile.lock", :exist?
|
|
assert_match "requests", (testpath/"Pipfile").read
|
|
assert_match "boto3", (testpath/"Pipfile").read
|
|
end
|
|
end
|