changeset 64:4ffac7dedddf

merged and tested to work with python27 numpy161 on ubuntu1204
author gyorgyf
date Sat, 05 Oct 2013 13:41:03 +0100
parents 577b251cad2f (diff) c3b1580fec04 (current diff)
children 0df94e3f0fdb
files
diffstat 4 files changed, 21 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile.linux	Thu Feb 28 14:47:17 2013 +0000
+++ b/Makefile.linux	Sat Oct 05 13:41:03 2013 +0100
@@ -1,6 +1,6 @@
 
-CXXFLAGS	:= -DHAVE_NUMPY -O2 -Wall -I/usr/include/python2.6 -I/usr/lib/python2.6/dist-packages/numpy/core/include -fPIC
-LDFLAGS		:= -shared -Wl,-Bstatic -lvamp-sdk -Wl,-Bdynamic -lpython2.6 -lpthread -Wl,--version-script=vamp-plugin.map
+CXXFLAGS	:= -DHAVE_NUMPY -O2 -Wall -I/usr/include/python2.7 -I/usr/lib/python2.7/dist-packages/numpy/core/include -fPIC
+LDFLAGS		:= -shared -Wl,-Bstatic -lvamp-sdk -Wl,-Bdynamic -lpython2.7 -lpthread -Wl,--version-script=vamp-plugin.map
 
 default: vampy.so 
 all: vampy.so vampymod.so
@@ -18,7 +18,7 @@
 # Install plugin
 #
 INSTALL_DIR			:=$(DESTDIR)/usr/local/lib/vamp
-PYEXAMPLE_DIR			:='Example VamPy Plugins'
+PYEXAMPLE_DIR		:='Example VamPy Plugins'
 PLUGIN_NAME			:=vampy
 PLUGIN_EXT			:=.so
 
--- a/PyTypeInterface.cpp	Thu Feb 28 14:47:17 2013 +0000
+++ b/PyTypeInterface.cpp	Sat Oct 05 13:41:03 2013 +0100
@@ -1019,6 +1019,9 @@
 		case p::quantizeStep:
 			_convert(pyValue,pd.quantizeStep);
 			break;
+		case p::valueNames:
+			_convert(pyValue,pd.valueNames);
+			break;
 		default :
 		 	setValueError("Unknown key in Vamp ParameterDescriptor",m_strict);
 			cerr << "Invalid key in Vamp ParameterDescriptor: " << key << endl; 
@@ -1180,6 +1183,7 @@
 	parmKeys["defaultValue"] = p::defaultValue;
 	parmKeys["isQuantized"] = p::isQuantized;
 	parmKeys["quantizeStep"] = p::quantizeStep;
+	parmKeys["valueNames"] = p::valueNames;
 
 	isMapInitialised = true;
 	return true;
--- a/PyTypeInterface.h	Thu Feb 28 14:47:17 2013 +0000
+++ b/PyTypeInterface.h	Sat Oct 05 13:41:03 2013 +0100
@@ -72,7 +72,8 @@
 	maxValue,
 	defaultValue,
 	isQuantized,
-	quantizeStep
+	quantizeStep,
+	valueNames
 	};
 }
 
--- a/vampy-main.cpp	Thu Feb 28 14:47:17 2013 +0000
+++ b/vampy-main.cpp	Sat Oct 05 13:41:03 2013 +0100
@@ -39,7 +39,7 @@
 #include "PyPlugin.h"
 #include "PyExtensionModule.h"
 #include "PyExtensionManager.h"
-
+#include <sstream>
 
 #ifdef _WIN32
 #define pathsep ('\\')
@@ -115,6 +115,7 @@
 #ifdef HAVE_NUMPY
 
 	string ver;
+	std::istringstream verStream;
 	float numpyVersion;
 
 	/// attmept to test numpy version before importing the array API
@@ -146,11 +147,16 @@
 
 	ver = PyString_AsString(pyVer);
 	ver = ver.substr(0,ver.rfind("."));
-	if(EOF == sscanf(ver.c_str(), "%f", &numpyVersion))
-	{
-		cerr << "Could not parse Numpy version information." << endl;
-		goto numpyFailure;
-	}
+	/*
+	Applied patch from here: http://vamp-plugins.org/forum/index.php/topic,162.msg387.html#msg387 to replace this:
+    if(EOF == sscanf(ver.c_str(), "%f", &numpyVersion))
+    {
+     cerr << "Could not parse Numpy version information." << endl;
+     goto numpyFailure;
+    }*/
+	// parse version string to float
+    verStream.str(ver);
+    verStream >> numpyVersion;
 
 	cerr << "Numpy runtime version: " << numpyVersion << endl;
 	if (numpyVersion < (float) NUMPY_SHORTVERSION) {