aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula
diff options
context:
space:
mode:
authorEnrico Ghirardi2014-09-02 22:29:50 +0200
committerMike McQuaid2014-09-05 12:25:04 +0100
commit8797ad3502ded832f38aeacac1549dbd52f6c69a (patch)
tree19b133673b84e383189b9c2c84032d395fe0da26 /Library/Formula
parentab794c67e355ed045e2c250045fa7e7022c80ed0 (diff)
downloadhomebrew-8797ad3502ded832f38aeacac1549dbd52f6c69a.tar.bz2
vim, macvim: fix and test python linking.
Closes #32056. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
Diffstat (limited to 'Library/Formula')
-rw-r--r--Library/Formula/macvim.rb18
-rw-r--r--Library/Formula/vim.rb16
2 files changed, 34 insertions, 0 deletions
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