config: read ruby/python interpreter directly
Closes Homebrew/homebrew#43750. Signed-off-by: Xu Cheng <xucheng@me.com>
This commit is contained in:
parent
9dc461cb9f
commit
12a4cf3808
@ -74,19 +74,26 @@ module Homebrew
|
|||||||
|
|
||||||
def describe_python
|
def describe_python
|
||||||
python = which "python"
|
python = which "python"
|
||||||
if %r{/shims/python$} =~ python && which("pyenv")
|
return "N/A" if python.nil?
|
||||||
"#{python} => #{Pathname.new(`pyenv which python`.strip).realpath}" rescue describe_path(python)
|
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
|
else
|
||||||
describe_path(python)
|
"#{python} => #{python_binary}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def describe_ruby
|
def describe_ruby
|
||||||
ruby = which "ruby"
|
ruby = which "ruby"
|
||||||
if %r{/shims/ruby$} =~ ruby && which("rbenv")
|
return "N/A" if ruby.nil?
|
||||||
"#{ruby} => #{Pathname.new(`rbenv which ruby`.strip).realpath}" rescue describe_path(ruby)
|
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
|
else
|
||||||
describe_path(ruby)
|
"#{ruby} => #{ruby_binary}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user