diff --git a/Formula/vim.rb b/Formula/vim.rb index 9431fecb1e..e7f7cad82d 100644 --- a/Formula/vim.rb +++ b/Formula/vim.rb @@ -17,7 +17,6 @@ class Vim < Formula depends_on "gettext" depends_on "lua" depends_on "perl" - depends_on "python@3.9" depends_on "ruby" uses_from_macos "ncurses" @@ -28,17 +27,30 @@ class Vim < Formula conflicts_with "macvim", because: "vim and macvim both install vi* binaries" + def python_config_dir + `$(pyenv which python2-config) --prefix`.chomp+"/lib/python2.7/config" + end + + def python3_config_dir + `$(pyenv which python3-config) --configdir`.chomp + end + + def add_pyenv_to_path + user_home = `echo $(echo ~#{ENV["USER"]})`.chomp + dirs = [ "#{user_home}/.pyenv/shims", "#{user_home}/.pyenv/bin" ] + dirs.each do |dir| + ENV.prepend_path "PATH", dir + end + end + def install # Fix error: '__declspec' attributes are not enabled ENV.append_to_cflags "-fdeclspec" - ENV.prepend_path "PATH", Formula["python@3.9"].opt_libexec/"bin" - # https://github.com/Homebrew/homebrew-core/pull/1046 ENV.delete("SDKROOT") - # vim doesn't require any Python package, unset PYTHONPATH. - ENV.delete("PYTHONPATH") + add_pyenv_to_path # We specify HOMEBREW_PREFIX as the prefix to make vim look in the # the right place (HOMEBREW_PREFIX/share/vim/{vimrc,vimfiles}) for @@ -55,7 +67,12 @@ class Vim < Formula "--enable-terminal", "--enable-perlinterp", "--enable-rubyinterp", - "--enable-python3interp", + #"--enable-pythoninterp=dynamic", + #"--with-python-command=python2", + #"--with-python-config-dir="+python_config_dir, + "--enable-python3interp=dynamic", + "--with-python3-command=python3", + "--with-python3-config-dir="+python3_config_dir, "--enable-gui=no", "--without-x", "--enable-luainterp",