diff options
| author | Xu Cheng | 2015-09-09 21:28:42 +0800 |
|---|---|---|
| committer | Xu Cheng | 2015-09-10 13:37:14 +0800 |
| commit | 12a4cf380814305c6972274dbee823414d5d200d (patch) | |
| tree | 85cd337ada638371be3cacea1592122dbd145dc7 /Library | |
| parent | 9dc461cb9f05a7f09c822ef9a45f5cace919e4c4 (diff) | |
| download | brew-12a4cf380814305c6972274dbee823414d5d200d.tar.bz2 | |
config: read ruby/python interpreter directly
Closes Homebrew/homebrew#43750.
Signed-off-by: Xu Cheng <xucheng@me.com>
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/cmd/config.rb | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/Library/Homebrew/cmd/config.rb b/Library/Homebrew/cmd/config.rb index 9db2c43c6..855cb515c 100644 --- a/Library/Homebrew/cmd/config.rb +++ b/Library/Homebrew/cmd/config.rb @@ -74,19 +74,26 @@ module Homebrew def describe_python python = which "python" - if %r{/shims/python$} =~ python && which("pyenv") - "#{python} => #{Pathname.new(`pyenv which python`.strip).realpath}" rescue describe_path(python) + return "N/A" if python.nil? + python_binary = Utils.popen_read python, "-c", "import sys; sys.stdout.write(sys.executable)" + python_binary = Pathname.new(python_binary).realpath + if python == python_binary + python else - describe_path(python) + "#{python} => #{python_binary}" end end def describe_ruby ruby = which "ruby" - if %r{/shims/ruby$} =~ ruby && which("rbenv") - "#{ruby} => #{Pathname.new(`rbenv which ruby`.strip).realpath}" rescue describe_path(ruby) + return "N/A" if ruby.nil? + ruby_binary = Utils.popen_read ruby, "-e", \ + 'include RbConfig;print"#{CONFIG["bindir"]}/#{CONFIG["ruby_install_name"]}#{CONFIG["EXEEXT"]}"' + ruby_binary = Pathname.new(ruby_binary).realpath + if ruby == ruby_binary + ruby else - describe_path(ruby) + "#{ruby} => #{ruby_binary}" end end |
