libxml2: cleanup python usage.

This commit is contained in:
Mike McQuaid committed 2014-01-04 13:35:43 +00:00
1 parent eb74878591
commit 18cd018cc5
1 file changed
+5 -33
+5 -33
View File
@@ -10,9 +10,9 @@ class Libxml2 < Formula
# 2.9.1 cannot build with Python 2.6: https://github.com/Homebrew/homebrew/issues/20249
if MacOS.version <= :snow_leopard
depends_on :python => ["2.7", :optional]
depends_on 'python' => :optional
else
depends_on :python => ["2.7", :recommended]
depends_on :python => :recommended
end
end
@@ -48,38 +48,10 @@ class Libxml2 < Formula
ENV.deparallelize
system "make install"
python do
# This python do block sets up the site-packages in the Cellar.
cd 'python' do
# We need to insert our include dir first
inreplace 'setup.py', 'includes_dir = [', "includes_dir = ['#{include}', '#{MacOS.sdk_path}/usr/include',"
system python, 'setup.py', "install", "--prefix=#{prefix}"
end
# This is keg_only but it makes sense to have the python bindings:
ohai 'Linking python bindings'
Dir["#{python.site_packages}/*"].each{ |f|
path = python.global_site_packages/(Pathname.new(f).basename)
puts path
rm path if path.exist?
ln_s f, path
}
end if build.with? 'python'
end
def caveats
if build.with? 'python'
<<-EOS.undent
Even if this formula is keg_only, the python bindings have been linked
into Homebrew's global site-packages for your convenience.
#{python.global_site_packages}
EOS
end
end
test do
python do
system python, '-c', "import libxml2"
# We need to insert our include dir first
inreplace 'setup.py', 'includes_dir = [', "includes_dir = ['#{include}', '#{MacOS.sdk_path}/usr/include',"
system "python", 'setup.py', "install", "--prefix=#{prefix}"
end
end
end