Revision: 104717 https://trac.macports.org/changeset/104717 Author: blair@macports.org Date: 2013-04-01 08:49:34 -0700 (Mon, 01 Apr 2013) Log Message: ----------- py-zeroc-ice34: support custom Ice::Dispatchers in Python (sort of). Modified Paths: -------------- trunk/dports/python/py-zeroc-ice34/Portfile Added Paths: ----------- trunk/dports/python/py-zeroc-ice34/files/patch-py.modules.IcePy.Communicator.cpp.diff Modified: trunk/dports/python/py-zeroc-ice34/Portfile =================================================================== --- trunk/dports/python/py-zeroc-ice34/Portfile 2013-04-01 15:20:14 UTC (rev 104716) +++ trunk/dports/python/py-zeroc-ice34/Portfile 2013-04-01 15:49:34 UTC (rev 104717) @@ -5,7 +5,7 @@ name py-zeroc-ice34 version 3.4.2 -revision 2 +revision 3 set branch [join [lrange [split ${version} .] 0 1] .] categories-append devel maintainers blair @@ -39,6 +39,7 @@ sha1 8c84d6e3b227f583d05e08251e07047e6c3a6b42 \ rmd160 7ce680a4eb5fa9d0bb6f8b8910e267dfc2373d75 patchfiles patch-py.config.Make.rules.Darwin.diff \ + patch-py.modules.IcePy.Communicator.cpp.diff \ patch-add-thrift-support.diff platforms darwin Added: trunk/dports/python/py-zeroc-ice34/files/patch-py.modules.IcePy.Communicator.cpp.diff =================================================================== --- trunk/dports/python/py-zeroc-ice34/files/patch-py.modules.IcePy.Communicator.cpp.diff (rev 0) +++ trunk/dports/python/py-zeroc-ice34/files/patch-py.modules.IcePy.Communicator.cpp.diff 2013-04-01 15:49:34 UTC (rev 104717) @@ -0,0 +1,43 @@ +From 7c25ae9ae71346357208fb714250ac75aae9fb61 Mon Sep 17 00:00:00 2001 +From: J Robert Ray jrray{_at_}imageworks{_dot_}com +Date: Mon, 20 Aug 2012 14:54:22 -0700 +Subject: [PATCH] Support custom Ice::Dispatchers in Python (sort of). + +This is a very thin shim to expose the InitializationData::dispatcher +member, but not a way to implement an Ice::Dispatcher in Python. + +Extend the wrapped Ice.InitializationData to check for a 'dispatcher' +attribute. In Python, the user is to pass in a PyCObject-wrapped +Ice::Dispatcher*. + +The custom Ice::Dispatcher must still be implemented in C++, and also +exposed to Python in some way. + +diff -ru ../Ice-3.4.2.orig/py/modules/IcePy/Communicator.cpp ./py/modules/IcePy/Communicator.cpp +--- ../Ice-3.4.2.orig/py/modules/IcePy/Communicator.cpp 2011-06-15 12:44:00.000000000 -0700 ++++ ./py/modules/IcePy/Communicator.cpp 2013-04-01 08:39:31.000000000 -0700 +@@ -142,6 +142,7 @@ + PyObjectHandle properties = PyObject_GetAttrString(initData, STRCAST("properties")); + PyObjectHandle logger = PyObject_GetAttrString(initData, STRCAST("logger")); + PyObjectHandle threadHook = PyObject_GetAttrString(initData, STRCAST("threadHook")); ++ PyObjectHandle dispatcher = PyObject_GetAttrString(initData, STRCAST("dispatcher")); + PyErr_Clear(); // PyObject_GetAttrString sets an error on failure. + + if(properties.get() && properties.get() != Py_None) +@@ -163,6 +164,16 @@ + { + data.threadHook = new ThreadNotificationWrapper(threadHook.get()); + } ++ ++ if(dispatcher.get() && dispatcher.get() != Py_None) ++ { ++ if (!PyCObject_Check(dispatcher.get())) { ++ PyErr_Format(PyExc_ValueError, STRCAST("Ice.InitializationData dispatcher must be a PyCObject-wrapped Ice::Dispatcher*")); ++ return -1; ++ } ++ ++ data.dispatcher = reinterpret_cast<Ice::Dispatcher*>(PyCObject_AsVoidPtr(dispatcher.get())); ++ } + } + + try