homebrew-core/Formula/pipenv.rb
2017-10-31 05:22:41 -07:00

136 lines
6.3 KiB
Ruby

class Pipenv < Formula
include Language::Python::Virtualenv
desc "Python dependency management tool"
homepage "https://docs.pipenv.org/"
url "https://files.pythonhosted.org/packages/3e/f3/891bbdccb526dc49fa867dfe9edd3cb449e79154f67d32c91fcf47ef2265/pipenv-8.3.1.tar.gz"
sha256 "1bc97cb9bb7dea5a6ebadb9f477f5e6e171bd0c43be0ec058be914dcf2e901c7"
bottle do
cellar :any_skip_relocation
sha256 "1f9f1ff9db275f72c4f1d8d4c2e11d2916c45cefbcaf756970a2beffcecd734f" => :high_sierra
sha256 "a69d195a57bf02fe47b05626ae5e4d837b8f3b0fe11777ff181ffa7f3adcc090" => :sierra
sha256 "f65109ae74c7c8f9d2609fe5a4d91c298d2fd19426f8f8db22299bbe84e9f5b3" => :el_capitan
end
depends_on :python if MacOS.version <= :snow_leopard
resource "backports.shutil_get_terminal_size" do
url "https://files.pythonhosted.org/packages/ec/9c/368086faa9c016efce5da3e0e13ba392c9db79e3ab740b763fe28620b18b/backports.shutil_get_terminal_size-1.0.0.tar.gz"
sha256 "713e7a8228ae80341c70586d1cc0a8caa5207346927e23d09dcbcaf18eadec80"
end
resource "certifi" do
url "https://files.pythonhosted.org/packages/20/d0/3f7a84b0c5b89e94abbd073a5f00c7176089f526edb056686751d5064cbd/certifi-2017.7.27.1.tar.gz"
sha256 "40523d2efb60523e113b44602298f0960e900388cf3bb6043f645cf57ea9e3f5"
end
resource "chardet" do
url "https://files.pythonhosted.org/packages/fc/bb/a5768c230f9ddb03acc9ef3f0d4a3cf93462473795d18e9535498c8f929d/chardet-3.0.4.tar.gz"
sha256 "84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae"
end
resource "configparser" do
url "https://files.pythonhosted.org/packages/7c/69/c2ce7e91c89dc073eb1aa74c0621c3eefbffe8216b3f9af9d3885265c01c/configparser-3.5.0.tar.gz"
sha256 "5308b47021bc2340965c371f0f058cc6971a04502638d4244225c49d80db273a"
end
resource "enum34" do
url "https://files.pythonhosted.org/packages/bf/3e/31d502c25302814a7c2f1d3959d2a3b3f78e509002ba91aea64993936876/enum34-1.1.6.tar.gz"
sha256 "8ad8c4783bf61ded74527bffb48ed9b54166685e4230386a9ed9b1279e2df5b1"
end
resource "flake8" do
url "https://files.pythonhosted.org/packages/1e/ab/7730f6d6cdf73a3b7f98a2fe3b2cdf68e9e760a4a133e083607497d4c3a6/flake8-3.5.0.tar.gz"
sha256 "7253265f7abd8b313e3892944044a365e3f4ac3fcdcfb4298f55ee9ddf188ba0"
end
resource "idna" do
url "https://files.pythonhosted.org/packages/f4/bd/0467d62790828c23c47fc1dfa1b1f052b24efdf5290f071c7a91d0d82fd3/idna-2.6.tar.gz"
sha256 "2c6a5de3089009e3da7c5dde64a141dbc8551d5b7f6cf4ed7c2568d0cc520a8f"
end
resource "mccabe" do
url "https://files.pythonhosted.org/packages/06/18/fa675aa501e11d6d6ca0ae73a101b2f3571a565e0f7d38e062eec18a91ee/mccabe-0.6.1.tar.gz"
sha256 "dd8d182285a0fe56bace7f45b5e7d1a6ebcbf524e8f3bd87eb0f125271b8831f"
end
resource "pathlib" do
url "https://files.pythonhosted.org/packages/ac/aa/9b065a76b9af472437a0059f77e8f962fe350438b927cb80184c32f075eb/pathlib-1.0.1.tar.gz"
sha256 "6940718dfc3eff4258203ad5021090933e5c04707d5ca8cc9e73c94a7894ea9f"
end
resource "pew" do
url "https://files.pythonhosted.org/packages/a4/be/efe77f7dcb088f263bfc5eac09121b2f9a6e59c3bdfdff7a801d2253f2ac/pew-1.1.0.tar.gz"
sha256 "d0f9d127cf321c959bb857e59080f7eaa59c8bbeb2d53aa07d3350aae50e1f2d"
end
resource "pycodestyle" do
url "https://files.pythonhosted.org/packages/e1/88/0e2cbf412bd849ea6f1af1f97882add46a374f4ba1d2aea39353609150ad/pycodestyle-2.3.1.tar.gz"
sha256 "682256a5b318149ca0d2a9185d365d8864a768a28db66a84a2ea946bcc426766"
end
resource "pyflakes" do
url "https://files.pythonhosted.org/packages/26/85/f6a315cd3c1aa597fb3a04cc7d7dbea5b3cc66ea6bd13dfa0478bf4876e6/pyflakes-1.6.0.tar.gz"
sha256 "8d616a382f243dbf19b54743f280b80198be0bca3a5396f1d2e1fca6223e8805"
end
resource "requests" do
url "https://files.pythonhosted.org/packages/b0/e1/eab4fc3752e3d240468a8c0b284607899d2fbfb236a56b7377a329aa8d09/requests-2.18.4.tar.gz"
sha256 "9c443e7324ba5b85070c4a818ade28bfabedf16ea10206da1132edaa6dda237e"
end
resource "shutilwhich" do
url "https://files.pythonhosted.org/packages/66/be/783f181594bb8bcfde174d6cd1e41956b986d0d8d337d535eb2555b92f8d/shutilwhich-1.1.0.tar.gz"
sha256 "db1f39c6461e42f630fa617bb8c79090f7711c9ca493e615e43d0610ecb64dc6"
end
resource "urllib3" do
url "https://files.pythonhosted.org/packages/ee/11/7c59620aceedcc1ef65e156cc5ce5a24ef87be4107c2b74458464e437a5d/urllib3-1.22.tar.gz"
sha256 "cc44da8e1145637334317feebd728bd869a35285b93cbb4cca2577da7e62db4f"
end
resource "virtualenv" do
url "https://files.pythonhosted.org/packages/d4/0c/9840c08189e030873387a73b90ada981885010dd9aea134d6de30cd24cb8/virtualenv-15.1.0.tar.gz"
sha256 "02f8102c2436bb03b3ee6dede1919d1dac8a427541652e5ec95171ec8adbc93a"
end
resource "virtualenv-clone" do
url "https://files.pythonhosted.org/packages/36/66/d95f83255138ded1aec242de5ee51536226fa7b2582a7ce0863fea5dc4f2/virtualenv-clone-0.2.6.tar.gz"
sha256 "6b3be5cab59e455f08c9eda573d23006b7d6fb41fae974ddaa2b275c93cc4405"
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)
venv.pip_install resources
venv.pip_install buildpath
# `pipenv` needs to be able to find `virtualenv` and `pew` on PATH. Rather
# than installing symlinks for those scripts into `#{bin}` we leave them in
# `#{libexec}/bin` and create a wrapper script for `pipenv` which adds
# `#{libexec}/bin` to PATH.
env = {
:PATH => "#{libexec}/bin:$PATH",
}
(bin/"pipenv").write_env_script(libexec/"bin/pipenv", env)
# `#{libexec}/bin` - which we've just added to PATH - contains symlinks
# linking python2 and python2.7 to ./python. We remove those symlinks so
# that pipenv options that search for a python version, like `pipenv --two`
# and `pipenv --python=2.7`, respect the user's unmodified PATH rather than
# finding the copy of system python that we have just prepended to it.
rm libexec/"bin/python2"
rm libexec/"bin/python2.7"
end
test do
assert_match "Commands", shell_output("#{bin}/pipenv")
system "#{bin}/pipenv", "install", "requests"
assert_predicate testpath/"Pipfile", :exist?
assert_predicate testpath/"Pipfile.lock", :exist?
assert_match "requests", (testpath/"Pipfile").read
end
end