From dba92ceb1e9c7f1102f157075dadb75fb57d0b1c Mon Sep 17 00:00:00 2001 From: "Tim D. Smith" Date: Mon, 9 Feb 2015 13:13:38 -0800 Subject: [PATCH] sip: build test with sip's build system and set PYTHONPATH for the bot. Closes Homebrew/homebrew#36676. --- Formula/sip.rb | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/Formula/sip.rb b/Formula/sip.rb index a9897a0f2e..4eeba47a5b 100644 --- a/Formula/sip.rb +++ b/Formula/sip.rb @@ -78,23 +78,24 @@ class Sip < Formula void test(); }; EOS + (testpath/"generate.py").write <<-EOS.undent + from sipconfig import SIPModuleMakefile, Configuration + m = SIPModuleMakefile(Configuration(), "test.build") + m.extra_libs = ["test"] + m.extra_lib_dirs = ["."] + m.generate() + EOS (testpath/"run.py").write <<-EOS.undent from test import Test t = Test() t.test() EOS - system "#{bin}/sip", "-c", ".", "test.sip" - Language::Python.each_python(build) do |python, _version| - cppflags = `#{python}-config --cflags`.strip.split - ldflags = `#{python}-config --ldflags`.strip.split - cppflags << "-I#{include}" - ldflags += %w[-L#{lib} -shared -undefined dynamic_lookup] - Dir[testpath/"*.cpp"].each do |source| - object = File.basename(source, ".cpp") + ".o" - system ENV.cxx, "-c", source, "-o", object, *cppflags - end - link_args= Dir[testpath/"*.o"] + %w[-o test.so] + ldflags - system ENV.cxx, *link_args + system ENV.cxx, "-shared", "-o", "libtest.dylib", "test.cpp" + system "#{bin}/sip", "-b", "test.build", "-c", ".", "test.sip" + Language::Python.each_python(build) do |python, version| + ENV["PYTHONPATH"] = lib/"python#{version}/site-packages" + system python, "generate.py" + system "make", "-j1", "clean", "all" system python, "run.py" end end