changeset 116:3489986a044c

Fixes for OS/X build
author Chris Cannam
date Wed, 17 Jun 2015 13:27:57 +0100
parents 899095c8760f
children b56c1052d111
files Makefile.osx native/PyRealTime.cpp test/test_process.py
diffstat 3 files changed, 28 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile.osx	Wed Jun 17 13:03:37 2015 +0100
+++ b/Makefile.osx	Wed Jun 17 13:27:57 2015 +0100
@@ -1,6 +1,11 @@
 
-PY_INCLUDE_PATH		:= /anaconda/include/python2.7
-NUMPY_INCLUDE_PATH 	:= /anaconda/pkgs/numpy-1.9.2-py27_0/lib/python2.7/site-packages/numpy/core/include
+PY_INCLUDE_PATH		:= /System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7
+NUMPY_INCLUDE_PATH 	:= /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy/core/include
+
+## or e.g.
+#PY_INCLUDE_PATH		:= /anaconda/include/python2.7
+#NUMPY_INCLUDE_PATH 	:= /anaconda/pkgs/numpy-1.9.2-py27_0/lib/python2.7/site-packages/numpy/core/include
+
 PY_LIB			:= python2.7
 PY_TEST			:= nosetests
 
@@ -9,18 +14,18 @@
 #PY_LIB			:= python3
 #PY_TEST			:= nosetests3
 
-ARCHFLAGS ?= -mmacosx-version-min=10.7 -arch x86_64 -arch i386 -stdlib=libc++
+ARCHFLAGS ?= -mmacosx-version-min=10.7 -arch x86_64 -stdlib=libc++
 
 # Compile flags
 #
 CFLAGS          += $(ARCHFLAGS) -fPIC -I$(PY_INCLUDE_PATH) -I$(NUMPY_INCLUDE_PATH) -I../vamp-plugin-sdk
 CXXFLAGS        += $(ARCHFLAGS) -O2 -Wall -I. -fPIC -I$(PY_INCLUDE_PATH) -I$(NUMPY_INCLUDE_PATH) -I../vamp-plugin-sdk
 
-LDFLAGS 		:= -dynamiclib -L../vamp-plugin-sdk -lvamp-hostsdk -L/anaconda/lib/ -lpython -ldl
+LDFLAGS 		:= -dynamiclib -L../vamp-plugin-sdk -lvamp-hostsdk -l$(PY_LIB) -ldl
 
 NOSE			:= $(PY_TEST)
 
-LIBRARY_EXT 		:= .dylib
+LIBRARY_EXT 		:= .so
 
 MAKEFILE_EXT		:= .osx
 
--- a/native/PyRealTime.cpp	Wed Jun 17 13:03:37 2015 +0100
+++ b/native/PyRealTime.cpp	Wed Jun 17 13:27:57 2015 +0100
@@ -241,21 +241,27 @@
     const RealTime &a = *ap;
     const RealTime &b = *bp;
 
+//    cerr << "a = " << a << ", b = " << b << ", op = " << op << endl;
+
+    PyObject *result = Py_False;
+
     if (op == Py_LT) {
-        return (a < b) ? Py_True : Py_False;
+        result = (a < b) ? Py_True : Py_False;
     } else if (op == Py_LE) {
-        return (a <= b) ? Py_True : Py_False;
+        result = (a <= b) ? Py_True : Py_False;
     } else if (op == Py_EQ) {
-        return (a == b) ? Py_True : Py_False;
+        result = (a == b) ? Py_True : Py_False;
     } else if (op == Py_NE) {
-        return (a != b) ? Py_True : Py_False;
+        result = (a != b) ? Py_True : Py_False;
     } else if (op == Py_GT) {
-        return (a > b) ? Py_True : Py_False;
+        result = (a > b) ? Py_True : Py_False;
     } else if (op == Py_GE) {
-        return (a >= b) ? Py_True : Py_False;
-    } else {
-        return Py_False;
+        result = (a >= b) ? Py_True : Py_False;
     }
+
+//    cerr << "returning: " << (result == Py_True ? "true" : "false") << endl;
+
+    return result;
 }
 
 /* String representation called by e.g. str(realtime), print realtime*/
--- a/test/test_process.py	Wed Jun 17 13:03:37 2015 +0100
+++ b/test/test_process.py	Wed Jun 17 13:27:57 2015 +0100
@@ -200,6 +200,8 @@
         # half-way through the input buffer
         expected = i * (blocksize/2) + blocksize/2
         actual = results[i]["values"][0]
+        if actual == 2047 and expected == 2048:
+            print("This test fails because of a bug in the Vamp plugin SDK. Please update to SDK version 2.6.")
         assert actual == expected
 
 def test_process_multi_freq_timestamps():
@@ -211,6 +213,8 @@
         # half-way through the input buffer
         expected = i * (blocksize/2) + blocksize/2
         actual = results[i]["input-timestamp"]["values"][0]
+        if actual == 2047 and expected == 2048:
+            print("This test fails because of a bug in the Vamp plugin SDK. Please update to SDK version 2.6.")
         assert actual == expected
 
 def test_process_multiple_outputs():