aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorTim D. Smith2015-02-09 13:13:38 -0800
committerTim D. Smith2015-02-10 22:38:28 -0800
commitec114149c20fe193a15b447f377fc6b3c58c6dd2 (patch)
treec08a92d24ecdd212a2b28739429e58a267e333e6 /Library
parent4b103faeed71f970844236dccc87d7dc5b767441 (diff)
downloadhomebrew-ec114149c20fe193a15b447f377fc6b3c58c6dd2.tar.bz2
sip: build test with sip's build system
and set PYTHONPATH for the bot. Closes #36676.
Diffstat (limited to 'Library')
-rw-r--r--Library/Formula/sip.rb25
1 files changed, 13 insertions, 12 deletions
diff --git a/Library/Formula/sip.rb b/Library/Formula/sip.rb
index a9897a0f2..4eeba47a5 100644
--- a/Library/Formula/sip.rb
+++ b/Library/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