310e431b62
Closes Homebrew/homebrew#45718. Signed-off-by: Xu Cheng <xucheng@me.com>
46 lines
1.4 KiB
Ruby
46 lines
1.4 KiB
Ruby
class Pyenv < Formula
|
|
desc "Python version management"
|
|
homepage "https://github.com/yyuu/pyenv"
|
|
url "https://github.com/yyuu/pyenv/archive/v20151105.tar.gz"
|
|
sha256 "3b35b1b3de2cd601679e28d6e6c411b22786e5d54e9777e9cf7c8f1b30c9ea72"
|
|
head "https://github.com/yyuu/pyenv.git"
|
|
|
|
bottle :unneeded
|
|
|
|
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"
|
|
|
|
%w[pyenv-install pyenv-uninstall python-build].each do |cmd|
|
|
bin.install_symlink "#{prefix}/default-plugins/python-build/bin/#{cmd}"
|
|
end
|
|
end
|
|
|
|
def post_install
|
|
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
|
|
|
|
(var_lib/"plugins").install_symlink "#{prefix}/default-plugins/python-build"
|
|
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=#{var}/pyenv
|
|
EOS
|
|
end
|
|
|
|
test do
|
|
shell_output("eval \"$(#{bin}/pyenv init -)\" && pyenv versions")
|
|
end
|
|
end
|