homebrew-core/Formula/pyenv.rb
2015-03-27 23:13:51 +08:00

47 lines
1.6 KiB
Ruby

class Pyenv < Formula
homepage "https://github.com/yyuu/pyenv"
head "https://github.com/yyuu/pyenv.git"
url "https://github.com/yyuu/pyenv/archive/v20150326.tar.gz"
sha256 "faee42d2a409ca8af2d65987eca88584bfef0dfc686150377af5850358db6b37"
bottle do
sha256 "1fe982632bcdd6fd439f0bd5f3db37579e08a5236820173ca030414e11039293" => :yosemite
sha256 "a3a60f07b23c672b06dab378ff214d5d9191c15de52e9fa18172dc7fb0462e04" => :mavericks
sha256 "ab214ebad6b614b5394818d4d913bc68df17d073cb1317f6da06ff1aee5606a1" => :mountain_lion
end
depends_on "autoconf" => [:recommended, :run]
depends_on "pkg-config" => [:recommended, :run]
def install
inreplace "libexec/pyenv", "/usr/local", HOMEBREW_PREFIX
prefix.install "bin", "completions", "libexec"
prefix.install "plugins" => "default-plugins"
var_lib = "#{HOMEBREW_PREFIX}/var/lib/pyenv"
%w[plugins versions].each do |dir|
var_dir = "#{var_lib}/#{dir}"
mkdir_p var_dir
ln_sf var_dir, "#{prefix}/#{dir}"
end
rm_f "#{var_lib}/plugins/python-build"
ln_sf "#{prefix}/default-plugins/python-build", "#{var_lib}/plugins/python-build"
%w[pyenv-install pyenv-uninstall python-build].each do |cmd|
bin.install_symlink "#{prefix}/default-plugins/python-build/bin/#{cmd}"
end
end
def caveats; <<-EOS.undent
To enable shims and autocompletion add to your profile:
if which pyenv > /dev/null; then eval "$(pyenv init -)"; fi
To use Homebrew's directories rather than ~/.pyenv add to your profile:
export PYENV_ROOT=#{opt_prefix}
EOS
end
test do
shell_output("eval \"$(#{bin}/pyenv init -)\" && pyenv versions")
end
end