libxml2: always build python bindings

Fixes chunks of https://github.com/Homebrew/homebrew-core/issues/13133
and seems a pretty harmless change.
This commit is contained in:
Dominyk Tiller 2017-05-29 02:38:40 +01:00 committed by ilovezfs
parent bc5d3eb18d
commit 2ccc955c1a

View file

@ -1,7 +1,7 @@
class Libxml2 < Formula class Libxml2 < Formula
desc "GNOME XML library" desc "GNOME XML library"
homepage "http://xmlsoft.org" homepage "http://xmlsoft.org"
revision 2 revision 3
stable do stable do
url "http://xmlsoft.org/sources/libxml2-2.9.4.tar.gz" url "http://xmlsoft.org/sources/libxml2-2.9.4.tar.gz"
@ -41,7 +41,7 @@ class Libxml2 < Formula
keg_only :provided_by_osx keg_only :provided_by_osx
depends_on :python => :optional depends_on :python if MacOS.version <= :snow_leopard
def install def install
if build.head? if build.head?
@ -57,12 +57,10 @@ class Libxml2 < Formula
ENV.deparallelize ENV.deparallelize
system "make", "install" system "make", "install"
if build.with? "python" cd "python" do
cd "python" do # We need to insert our include dir first
# We need to insert our include dir first inreplace "setup.py", "includes_dir = [", "includes_dir = ['#{include}', '#{MacOS.sdk_path}/usr/include',"
inreplace "setup.py", "includes_dir = [", "includes_dir = ['#{include}', '#{MacOS.sdk_path}/usr/include'," system "python", "setup.py", "install", "--prefix=#{prefix}"
system "python", "setup.py", "install", "--prefix=#{prefix}"
end
end end
end end
@ -83,5 +81,8 @@ class Libxml2 < Formula
args += %w[test.c -o test] args += %w[test.c -o test]
system ENV.cc, *args system ENV.cc, *args
system "./test" system "./test"
ENV.prepend_path "PYTHONPATH", lib/"python2.7/site-packages"
system "python", "-c", "import libxml2"
end end
end end