2013-01-21 14:16:08 +00:00
|
|
|
class Pyenv < Formula
|
2014-05-20 04:02:42 +00:00
|
|
|
homepage "https://github.com/yyuu/pyenv"
|
|
|
|
head "https://github.com/yyuu/pyenv.git"
|
2015-02-04 03:09:53 +00:00
|
|
|
url "https://github.com/yyuu/pyenv/archive/v20150204.tar.gz"
|
|
|
|
sha1 "bba8eb5995897256ea8f038010be9a71bfb1f2cf"
|
2013-01-21 14:16:08 +00:00
|
|
|
|
2014-05-20 04:02:42 +00:00
|
|
|
depends_on "autoconf" => [:recommended, :run]
|
|
|
|
depends_on "pkg-config" => [:recommended, :run]
|
2013-01-21 14:16:08 +00:00
|
|
|
|
|
|
|
def install
|
2014-05-20 04:02:42 +00:00
|
|
|
inreplace "libexec/pyenv", "/usr/local", HOMEBREW_PREFIX
|
|
|
|
prefix.install "bin", "completions", "libexec"
|
2013-01-21 14:16:08 +00:00
|
|
|
prefix.install "plugins" => "default-plugins"
|
|
|
|
|
|
|
|
var_lib = "#{HOMEBREW_PREFIX}/var/lib/pyenv"
|
2014-05-20 04:02:42 +00:00
|
|
|
%w[plugins versions].each do |dir|
|
2013-01-21 14:16:08 +00:00
|
|
|
var_dir = "#{var_lib}/#{dir}"
|
|
|
|
mkdir_p var_dir
|
|
|
|
ln_sf var_dir, "#{prefix}/#{dir}"
|
|
|
|
end
|
|
|
|
|
2014-03-18 14:51:18 +00:00
|
|
|
rm_f "#{var_lib}/plugins/python-build"
|
2013-01-21 14:16:08 +00:00
|
|
|
ln_sf "#{prefix}/default-plugins/python-build", "#{var_lib}/plugins/python-build"
|
2014-05-20 04:02:42 +00:00
|
|
|
%w[pyenv-install pyenv-uninstall python-build].each do |cmd|
|
2013-01-21 14:16:08 +00:00
|
|
|
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
|
2015-01-03 08:48:51 +00:00
|
|
|
|
|
|
|
test do
|
|
|
|
shell_output("eval \"$(#{bin}/pyenv init -)\" && pyenv versions")
|
|
|
|
end
|
2013-01-21 14:16:08 +00:00
|
|
|
end
|