From 8797ad3502ded832f38aeacac1549dbd52f6c69a Mon Sep 17 00:00:00 2001 From: Enrico Ghirardi Date: Tue, 2 Sep 2014 22:29:50 +0200 Subject: vim, macvim: fix and test python linking. Closes #32056. Signed-off-by: Mike McQuaid --- Library/Formula/macvim.rb | 18 ++++++++++++++++++ Library/Formula/vim.rb | 16 ++++++++++++++++ 2 files changed, 34 insertions(+) (limited to 'Library') diff --git a/Library/Formula/macvim.rb b/Library/Formula/macvim.rb index b7f885027..126aeee23 100644 --- a/Library/Formula/macvim.rb +++ b/Library/Formula/macvim.rb @@ -68,6 +68,8 @@ class Macvim < Formula if build.with? "python3" args << "--enable-python3interp" elsif build.with? "python" + ENV.prepend "LDFLAGS", `python-config --ldflags`.chomp + ENV.prepend "CFLAGS", `python-config --cflags`.chomp args << "--enable-pythoninterp" end @@ -111,4 +113,20 @@ class Macvim < Formula EOS end end + + test do + # Simple test to check if MacVim was linked to Python version in $PATH + if build.with? "python" + vim_path = prefix/"MacVim.app/Contents/MacOS/Vim" + + # Get linked framework using otool + otool_output = `otool -L #{vim_path} | grep -m 1 Python`.gsub(/\(.*\)/, "").strip.chomp + + # Expand the link and get the python exec path + vim_framework_path = Pathname.new(otool_output).realpath.dirname.to_s.chomp + system_framework_path = `python-config --exec-prefix`.chomp + + assert_equal system_framework_path, vim_framework_path + end + end end diff --git a/Library/Formula/vim.rb b/Library/Formula/vim.rb index 25cd93738..319ed3286 100644 --- a/Library/Formula/vim.rb +++ b/Library/Formula/vim.rb @@ -92,4 +92,20 @@ class Vim < Formula system "make", "install", "prefix=#{prefix}", "STRIP=true" bin.install_symlink "vim" => "vi" if build.include? "override-system-vi" end + + test do + # Simple test to check if Vim was linked to Python version in $PATH + if build.with? "python" + vim_path = bin/"vim" + + # Get linked framework using otool + otool_output = `otool -L #{vim_path} | grep -m 1 Python`.gsub(/\(.*\)/, "").strip.chomp + + # Expand the link and get the python exec path + vim_framework_path = Pathname.new(otool_output).realpath.dirname.to_s.chomp + system_framework_path = `python-config --exec-prefix`.chomp + + assert_equal system_framework_path, vim_framework_path + end + end end -- cgit v1.2.3