[prev in list] [next in list] [prev in thread] [next in thread] 

List:       macports-changes
Subject:    [102346] trunk/dports/python/py-zeroc-ice34
From:       blair () macports ! org
Date:       2013-01-31 19:31:26
Message-ID: 20130131193126.7F407140F7B () svn ! macports ! org
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Revision: 102346
          https://trac.macports.org/changeset/102346
Author:   blair@macports.org
Date:     2013-01-31 11:31:26 -0800 (Thu, 31 Jan 2013)
Log Message:
-----------
py-zeroc-ice34: add patch to use Thrift as a data interchange format.

Patch by: J Robert Ray jrray{_at_}imageworks{_dot_}com

Modified Paths:
--------------
    trunk/dports/python/py-zeroc-ice34/Portfile

Added Paths:
-----------
    trunk/dports/python/py-zeroc-ice34/files/patch-add-thrift-support.diff

Modified: trunk/dports/python/py-zeroc-ice34/Portfile
===================================================================
--- trunk/dports/python/py-zeroc-ice34/Portfile	2013-01-31 19:18:35 UTC (rev 102345)
+++ trunk/dports/python/py-zeroc-ice34/Portfile	2013-01-31 19:31:26 UTC (rev 102346)
@@ -5,7 +5,7 @@
 
 name            py-zeroc-ice34
 version         3.4.2
-revision        1
+revision        2
 set branch      [join [lrange [split ${version} .] 0 1] .]
 categories-append   devel
 maintainers     blair
@@ -38,7 +38,8 @@
 checksums       md5 e97672eb4a63c6b8dd202d0773e19dc7 \
                 sha1 8c84d6e3b227f583d05e08251e07047e6c3a6b42 \
                 rmd160 7ce680a4eb5fa9d0bb6f8b8910e267dfc2373d75
-patchfiles      patch-py.config.Make.rules.Darwin.diff
+patchfiles      patch-py.config.Make.rules.Darwin.diff \
+                patch-add-thrift-support.diff
 platforms       darwin
 
 python.versions 25 26 27

Added: trunk/dports/python/py-zeroc-ice34/files/patch-add-thrift-support.diff
===================================================================
--- trunk/dports/python/py-zeroc-ice34/files/patch-add-thrift-support.diff	           \
                (rev 0)
+++ trunk/dports/python/py-zeroc-ice34/files/patch-add-thrift-support.diff	2013-01-31 \
19:31:26 UTC (rev 102346) @@ -0,0 +1,241 @@
+# Patch to support Thrift as a data interchange format in the same
+# manner as Ice supports Google Protocol Buffers.
+#
+# Patch by: J Robert Ray jrray{_at_}imageworks{_dot_}com
+
+diff -ru ../Ice-3.4.2.orig/py/modules/IcePy/Types.cpp ./py/modules/IcePy/Types.cpp
+--- ../Ice-3.4.2.orig/py/modules/IcePy/Types.cpp	2011-06-15 12:44:00.000000000 -0700
++++ ./py/modules/IcePy/Types.cpp	2013-01-31 11:20:55.000000000 -0800
+@@ -1877,22 +1877,55 @@
+ {
+     assert(PyObject_IsInstance(p, pythonType.get()) == 1); // validate() should \
have caught this. + 
+-    PyObjectHandle obj = PyObject_CallMethod(p, STRCAST("IsInitialized"), 0);
+-    if(!obj.get())
+-    {
+-        throwPythonException();
+-    }
+-    if(!PyObject_IsTrue(obj.get()))
+-    {
+-        setPythonException(Ice::MarshalException(__FILE__, __LINE__, "type not \
fully initialized")); +-        throw AbortMarshaling();
++    PyObjectHandle obj;
++
++    if (thrift) {
++        PyObjectHandle transportOut = PyObject_Call(TMemoryBuffer.get(), \
emptyTuple.get(), NULL); ++        if (!transportOut.get()) {
++            throwPythonException();
++        }
++
++        PyObjectHandle tup = PyTuple_New(1);
++        if (!tup.get()) {
++            throwPythonException();
++        }
++        Py_INCREF(transportOut.get());
++        PyTuple_SET_ITEM(tup.get(), 0, transportOut.get());
++
++        PyObjectHandle protocolOut = PyObject_Call(TBinaryProtocol.get(), \
tup.get(), NULL); ++        if (!protocolOut.get()) {
++            throwPythonException();
++        }
++
++        obj = PyObject_CallMethodObjArgs(p, writeStr.get(), protocolOut.get(), \
NULL); ++        if (!obj.get()) {
++            throwPythonException();
++        }
++
++        obj = PyObject_CallMethodObjArgs(transportOut.get(), getvalueStr.get(), \
NULL); ++        if (!obj.get()) {
++            assert(PyErr_Occurred());
++            throw AbortMarshaling();
++        }
+     }
++    else {
++        PyObjectHandle obj = PyObject_CallMethod(p, STRCAST("IsInitialized"), 0);
++        if(!obj.get())
++        {
++            throwPythonException();
++        }
++        if(!PyObject_IsTrue(obj.get()))
++        {
++            setPythonException(Ice::MarshalException(__FILE__, __LINE__, "type not \
fully initialized")); ++            throw AbortMarshaling();
++        }
+ 
+-    obj = PyObject_CallMethod(p, STRCAST("SerializeToString"), 0);
+-    if(!obj.get())
+-    {
+-        assert(PyErr_Occurred());
+-        throw AbortMarshaling();
++        obj = PyObject_CallMethod(p, STRCAST("SerializeToString"), 0);
++        if(!obj.get())
++        {
++            assert(PyErr_Occurred());
++            throw AbortMarshaling();
++        }
+     }
+ 
+     assert(PyString_Check(obj.get()));
+@@ -1913,16 +1946,10 @@
+     int sz = static_cast<int>(seq.second - seq.first);
+ 
+     //
+-    // Create a new instance of the protobuf type.
++    // Create a new instance of the protobuf/thrift type.
+     //
+-    PyObjectHandle args = PyTuple_New(0);
+-    if(!args.get())
+-    {
+-        assert(PyErr_Occurred());
+-        throw AbortMarshaling();
+-    }
+     PyTypeObject* type = reinterpret_cast<PyTypeObject*>(pythonType.get());
+-    PyObjectHandle p = type->tp_new(type, args.get(), 0);
++    PyObjectHandle p = type->tp_new(type, emptyTuple.get(), 0);
+     if(!p.get())
+     {
+         assert(PyErr_Occurred());
+@@ -1932,7 +1959,7 @@
+     //
+     // Initialize the object.
+     //
+-    PyObjectHandle obj = PyObject_CallMethod(p.get(), STRCAST("__init__"), 0, 0);
++    PyObjectHandle obj = PyObject_CallMethodObjArgs(p.get(), initStr.get(), NULL);
+     if(!obj.get())
+     {
+         assert(PyErr_Occurred());
+@@ -1949,14 +1976,45 @@
+         throw AbortMarshaling();
+     }
+ 
+-    //
+-    // Parse the string.
+-    //
+-    obj = PyObject_CallMethod(p.get(), STRCAST("ParseFromString"), STRCAST("O"), \
obj.get(), 0); +-    if(!obj.get())
+-    {
+-        assert(PyErr_Occurred());
+-        throw AbortMarshaling();
++    if (thrift) {
++        PyObjectHandle tup = PyTuple_New(1);
++        if (!tup.get()) {
++            throwPythonException();
++        }
++        PyTuple_SET_ITEM(tup.get(), 0, obj.release());
++
++        PyObjectHandle transportIn = PyObject_Call(TMemoryBuffer.get(), tup.get(), \
NULL); ++        if (!transportIn.get()) {
++            throwPythonException();
++        }
++
++        tup = PyTuple_New(1);
++        if (!tup.get()) {
++            throwPythonException();
++        }
++        PyTuple_SET_ITEM(tup.get(), 0, transportIn.release());
++
++        PyObjectHandle protocolIn = PyObject_Call(TBinaryProtocol.get(), tup.get(), \
NULL); ++        if (!protocolIn.get()) {
++            throwPythonException();
++        }
++
++        obj = PyObject_CallMethodObjArgs(p.get(), readStr.get(), protocolIn.get(), \
NULL); ++        if (!obj.get()) {
++            assert(PyErr_Occurred());
++            throw AbortMarshaling();
++        }
++    }
++    else {
++        //
++        // Parse the string.
++        //
++        obj = PyObject_CallMethod(p.get(), STRCAST("ParseFromString"), \
STRCAST("O"), obj.get(), 0); ++        if(!obj.get())
++        {
++            assert(PyErr_Occurred());
++            throw AbortMarshaling();
++        }
+     }
+ 
+     cb->unmarshaled(p.get(), target, closure);
+@@ -3213,7 +3271,8 @@
+ {
+     char* id;
+     PyObject* type;
+-    if(!PyArg_ParseTuple(args, STRCAST("sO"), &id, &type))
++    char* encoder;
++    if(!PyArg_ParseTuple(args, STRCAST("sOs"), &id, &type, &encoder))
+     {
+         return 0;
+     }
+@@ -3223,6 +3282,52 @@
+     CustomInfoPtr info = new CustomInfo;
+     info->id = id;
+     info->pythonType = type;
++    if (!strncmp(encoder, "thrift", 6)) {
++        info->thrift = true;
++
++        PyObjectHandle TTransport = \
PyImport_ImportModule(STRCAST("thrift.transport.TTransport")); ++        if \
(!TTransport.get()) { ++            throwPythonException();
++        }
++        info->TMemoryBuffer = PyObject_GetAttrString(TTransport.get(), \
STRCAST("TMemoryBuffer")); ++        if (!info->TMemoryBuffer.get()) {
++            throwPythonException();
++        }
++
++        PyObjectHandle TBinaryProtocol = \
PyImport_ImportModule(STRCAST("thrift.protocol.TBinaryProtocol")); ++        if \
(!TBinaryProtocol.get()) { ++            throwPythonException();
++        }
++        info->TBinaryProtocol = PyObject_GetAttrString(TBinaryProtocol.get(), \
STRCAST("TBinaryProtocol")); ++        if (!info->TBinaryProtocol.get()) {
++            throwPythonException();
++        }
++
++        info->readStr = PyString_FromStringAndSize(STRCAST("read"), 4);
++        if (!info->readStr.get()) {
++            throwPythonException();
++        }
++
++        info->writeStr = PyString_FromStringAndSize(STRCAST("write"), 5);
++        if (!info->writeStr.get()) {
++            throwPythonException();
++        }
++
++        info->getvalueStr = PyString_FromStringAndSize(STRCAST("getvalue"), 8);
++        if (!info->getvalueStr.get()) {
++            throwPythonException();
++        }
++    }
++
++    info->emptyTuple = PyTuple_New(0);
++    if (!info->emptyTuple.get()) {
++        throwPythonException();
++    }
++
++    info->initStr = PyString_FromStringAndSize(STRCAST("__init__"), 8);
++    if (!info->initStr.get()) {
++        throwPythonException();
++    }
+ 
+     return createType(info);
+ }
+diff -ru ../Ice-3.4.2.orig/py/modules/IcePy/Types.h ./py/modules/IcePy/Types.h
+--- ../Ice-3.4.2.orig/py/modules/IcePy/Types.h	2011-06-15 12:44:00.000000000 -0700
++++ ./py/modules/IcePy/Types.h	2013-01-31 11:20:55.000000000 -0800
+@@ -271,6 +271,14 @@
+ 
+     std::string id;
+     PyObjectHandle pythonType;
++    bool thrift;
++    PyObjectHandle TMemoryBuffer;
++    PyObjectHandle TBinaryProtocol;
++    PyObjectHandle emptyTuple;
++    PyObjectHandle readStr;
++    PyObjectHandle writeStr;
++    PyObjectHandle getvalueStr;
++    PyObjectHandle initStr;
+ };
+ typedef IceUtil::Handle<CustomInfo> CustomInfoPtr;
+ 


[Attachment #5 (text/html)]

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[102346] trunk/dports/python/py-zeroc-ice34</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: \
verdana,arial,helvetica,sans-serif; font-size: 10pt;  } #msg dl a { font-weight: \
bold} #msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: \
bold; } #msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: \
6px; } #logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em \
0; } #logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg \
h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; } \
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; \
} #logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: \
-1.5em; padding-left: 1.5em; } #logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em \
1em 0 1em; background: white;} #logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid \
#fa0; border-bottom: 1px solid #fa0; background: #fff; } #logmsg table th { \
text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted \
#fa0; } #logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: \
0.2em 0.5em; } #logmsg table thead th { text-align: center; border-bottom: 1px solid \
#fa0; } #logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: \
6px; } #patch { width: 100%; }
#patch h4 {font-family: \
verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
 #patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, \
#patch .copfile {border:1px solid #ccc;margin:10px 0;} #patch ins \
{background:#dfd;text-decoration:none;display:block;padding:0 10px;} #patch del \
{background:#fdd;text-decoration:none;display:block;padding:0 10px;} #patch .lines, \
                .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a \
href="https://trac.macports.org/changeset/102346">102346</a></dd> <dt>Author</dt> \
<dd>blair@macports.org</dd> <dt>Date</dt> <dd>2013-01-31 11:31:26 -0800 (Thu, 31 Jan \
2013)</dd> </dl>

<h3>Log Message</h3>
<pre>py-zeroc-ice34: add patch to use Thrift as a data interchange format.

Patch by: J Robert Ray jrray{_at_}imageworks{_dot_}com</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkdportspythonpyzerocice34Portfile">trunk/dports/python/py-zeroc-ice34/Portfile</a></li>
 </ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkdportspythonpyzerocice34filespatchaddthriftsupportdiff">trunk/dports/python/py-zeroc-ice34/files/patch-add-thrift-support.diff</a></li>
 </ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkdportspythonpyzerocice34Portfile"></a>
<div class="modfile"><h4>Modified: trunk/dports/python/py-zeroc-ice34/Portfile \
(102345 => 102346)</h4> <pre class="diff"><span>
<span class="info">--- trunk/dports/python/py-zeroc-ice34/Portfile	2013-01-31 \
                19:18:35 UTC (rev 102345)
+++ trunk/dports/python/py-zeroc-ice34/Portfile	2013-01-31 19:31:26 UTC (rev 102346)
</span><span class="lines">@@ -5,7 +5,7 @@
</span><span class="cx"> 
</span><span class="cx"> name            py-zeroc-ice34
</span><span class="cx"> version         3.4.2
</span><del>-revision        1
</del><ins>+revision        2
</ins><span class="cx"> set branch      [join [lrange [split ${version} .] 0 1] .]
</span><span class="cx"> categories-append   devel
</span><span class="cx"> maintainers     blair
</span><span class="lines">@@ -38,7 +38,8 @@
</span><span class="cx"> checksums       md5 e97672eb4a63c6b8dd202d0773e19dc7 \
</span><span class="cx">                 sha1 \
8c84d6e3b227f583d05e08251e07047e6c3a6b42 \ </span><span class="cx">                 \
rmd160 7ce680a4eb5fa9d0bb6f8b8910e267dfc2373d75 </span><del>-patchfiles      \
patch-py.config.Make.rules.Darwin.diff </del><ins>+patchfiles      \
patch-py.config.Make.rules.Darwin.diff \ +                \
patch-add-thrift-support.diff </ins><span class="cx"> platforms       darwin
</span><span class="cx"> 
</span><span class="cx"> python.versions 25 26 27
</span></span></pre></div>
<a id="trunkdportspythonpyzerocice34filespatchaddthriftsupportdiff"></a>
<div class="addfile"><h4>Added: \
trunk/dports/python/py-zeroc-ice34/files/patch-add-thrift-support.diff (0 => \
102346)</h4> <pre class="diff"><span>
<span class="info">--- \
trunk/dports/python/py-zeroc-ice34/files/patch-add-thrift-support.diff	               \
                (rev 0)
+++ trunk/dports/python/py-zeroc-ice34/files/patch-add-thrift-support.diff	2013-01-31 \
19:31:26 UTC (rev 102346) </span><span class="lines">@@ -0,0 +1,241 @@
</span><ins>+# Patch to support Thrift as a data interchange format in the same
+# manner as Ice supports Google Protocol Buffers.
+#
+# Patch by: J Robert Ray jrray{_at_}imageworks{_dot_}com
+
+diff -ru ../Ice-3.4.2.orig/py/modules/IcePy/Types.cpp ./py/modules/IcePy/Types.cpp
+--- ../Ice-3.4.2.orig/py/modules/IcePy/Types.cpp	2011-06-15 12:44:00.000000000 -0700
++++ ./py/modules/IcePy/Types.cpp	2013-01-31 11:20:55.000000000 -0800
+@@ -1877,22 +1877,55 @@
+ {
+     assert(PyObject_IsInstance(p, pythonType.get()) == 1); // validate() should \
have caught this. + 
+-    PyObjectHandle obj = PyObject_CallMethod(p, STRCAST(&quot;IsInitialized&quot;), \
0); +-    if(!obj.get())
+-    {
+-        throwPythonException();
+-    }
+-    if(!PyObject_IsTrue(obj.get()))
+-    {
+-        setPythonException(Ice::MarshalException(__FILE__, __LINE__, &quot;type not \
fully initialized&quot;)); +-        throw AbortMarshaling();
++    PyObjectHandle obj;
++
++    if (thrift) {
++        PyObjectHandle transportOut = PyObject_Call(TMemoryBuffer.get(), \
emptyTuple.get(), NULL); ++        if (!transportOut.get()) {
++            throwPythonException();
++        }
++
++        PyObjectHandle tup = PyTuple_New(1);
++        if (!tup.get()) {
++            throwPythonException();
++        }
++        Py_INCREF(transportOut.get());
++        PyTuple_SET_ITEM(tup.get(), 0, transportOut.get());
++
++        PyObjectHandle protocolOut = PyObject_Call(TBinaryProtocol.get(), \
tup.get(), NULL); ++        if (!protocolOut.get()) {
++            throwPythonException();
++        }
++
++        obj = PyObject_CallMethodObjArgs(p, writeStr.get(), protocolOut.get(), \
NULL); ++        if (!obj.get()) {
++            throwPythonException();
++        }
++
++        obj = PyObject_CallMethodObjArgs(transportOut.get(), getvalueStr.get(), \
NULL); ++        if (!obj.get()) {
++            assert(PyErr_Occurred());
++            throw AbortMarshaling();
++        }
+     }
++    else {
++        PyObjectHandle obj = PyObject_CallMethod(p, \
STRCAST(&quot;IsInitialized&quot;), 0); ++        if(!obj.get())
++        {
++            throwPythonException();
++        }
++        if(!PyObject_IsTrue(obj.get()))
++        {
++            setPythonException(Ice::MarshalException(__FILE__, __LINE__, &quot;type \
not fully initialized&quot;)); ++            throw AbortMarshaling();
++        }
+ 
+-    obj = PyObject_CallMethod(p, STRCAST(&quot;SerializeToString&quot;), 0);
+-    if(!obj.get())
+-    {
+-        assert(PyErr_Occurred());
+-        throw AbortMarshaling();
++        obj = PyObject_CallMethod(p, STRCAST(&quot;SerializeToString&quot;), 0);
++        if(!obj.get())
++        {
++            assert(PyErr_Occurred());
++            throw AbortMarshaling();
++        }
+     }
+ 
+     assert(PyString_Check(obj.get()));
+@@ -1913,16 +1946,10 @@
+     int sz = static_cast&lt;int&gt;(seq.second - seq.first);
+ 
+     //
+-    // Create a new instance of the protobuf type.
++    // Create a new instance of the protobuf/thrift type.
+     //
+-    PyObjectHandle args = PyTuple_New(0);
+-    if(!args.get())
+-    {
+-        assert(PyErr_Occurred());
+-        throw AbortMarshaling();
+-    }
+     PyTypeObject* type = reinterpret_cast&lt;PyTypeObject*&gt;(pythonType.get());
+-    PyObjectHandle p = type-&gt;tp_new(type, args.get(), 0);
++    PyObjectHandle p = type-&gt;tp_new(type, emptyTuple.get(), 0);
+     if(!p.get())
+     {
+         assert(PyErr_Occurred());
+@@ -1932,7 +1959,7 @@
+     //
+     // Initialize the object.
+     //
+-    PyObjectHandle obj = PyObject_CallMethod(p.get(), \
STRCAST(&quot;__init__&quot;), 0, 0); ++    PyObjectHandle obj = \
PyObject_CallMethodObjArgs(p.get(), initStr.get(), NULL); +     if(!obj.get())
+     {
+         assert(PyErr_Occurred());
+@@ -1949,14 +1976,45 @@
+         throw AbortMarshaling();
+     }
+ 
+-    //
+-    // Parse the string.
+-    //
+-    obj = PyObject_CallMethod(p.get(), STRCAST(&quot;ParseFromString&quot;), \
STRCAST(&quot;O&quot;), obj.get(), 0); +-    if(!obj.get())
+-    {
+-        assert(PyErr_Occurred());
+-        throw AbortMarshaling();
++    if (thrift) {
++        PyObjectHandle tup = PyTuple_New(1);
++        if (!tup.get()) {
++            throwPythonException();
++        }
++        PyTuple_SET_ITEM(tup.get(), 0, obj.release());
++
++        PyObjectHandle transportIn = PyObject_Call(TMemoryBuffer.get(), tup.get(), \
NULL); ++        if (!transportIn.get()) {
++            throwPythonException();
++        }
++
++        tup = PyTuple_New(1);
++        if (!tup.get()) {
++            throwPythonException();
++        }
++        PyTuple_SET_ITEM(tup.get(), 0, transportIn.release());
++
++        PyObjectHandle protocolIn = PyObject_Call(TBinaryProtocol.get(), tup.get(), \
NULL); ++        if (!protocolIn.get()) {
++            throwPythonException();
++        }
++
++        obj = PyObject_CallMethodObjArgs(p.get(), readStr.get(), protocolIn.get(), \
NULL); ++        if (!obj.get()) {
++            assert(PyErr_Occurred());
++            throw AbortMarshaling();
++        }
++    }
++    else {
++        //
++        // Parse the string.
++        //
++        obj = PyObject_CallMethod(p.get(), STRCAST(&quot;ParseFromString&quot;), \
STRCAST(&quot;O&quot;), obj.get(), 0); ++        if(!obj.get())
++        {
++            assert(PyErr_Occurred());
++            throw AbortMarshaling();
++        }
+     }
+ 
+     cb-&gt;unmarshaled(p.get(), target, closure);
+@@ -3213,7 +3271,8 @@
+ {
+     char* id;
+     PyObject* type;
+-    if(!PyArg_ParseTuple(args, STRCAST(&quot;sO&quot;), &amp;id, &amp;type))
++    char* encoder;
++    if(!PyArg_ParseTuple(args, STRCAST(&quot;sOs&quot;), &amp;id, &amp;type, \
&amp;encoder)) +     {
+         return 0;
+     }
+@@ -3223,6 +3282,52 @@
+     CustomInfoPtr info = new CustomInfo;
+     info-&gt;id = id;
+     info-&gt;pythonType = type;
++    if (!strncmp(encoder, &quot;thrift&quot;, 6)) {
++        info-&gt;thrift = true;
++
++        PyObjectHandle TTransport = \
PyImport_ImportModule(STRCAST(&quot;thrift.transport.TTransport&quot;)); ++        if \
(!TTransport.get()) { ++            throwPythonException();
++        }
++        info-&gt;TMemoryBuffer = PyObject_GetAttrString(TTransport.get(), \
STRCAST(&quot;TMemoryBuffer&quot;)); ++        if (!info-&gt;TMemoryBuffer.get()) {
++            throwPythonException();
++        }
++
++        PyObjectHandle TBinaryProtocol = \
PyImport_ImportModule(STRCAST(&quot;thrift.protocol.TBinaryProtocol&quot;)); ++       \
if (!TBinaryProtocol.get()) { ++            throwPythonException();
++        }
++        info-&gt;TBinaryProtocol = PyObject_GetAttrString(TBinaryProtocol.get(), \
STRCAST(&quot;TBinaryProtocol&quot;)); ++        if (!info-&gt;TBinaryProtocol.get()) \
{ ++            throwPythonException();
++        }
++
++        info-&gt;readStr = PyString_FromStringAndSize(STRCAST(&quot;read&quot;), \
4); ++        if (!info-&gt;readStr.get()) {
++            throwPythonException();
++        }
++
++        info-&gt;writeStr = PyString_FromStringAndSize(STRCAST(&quot;write&quot;), \
5); ++        if (!info-&gt;writeStr.get()) {
++            throwPythonException();
++        }
++
++        info-&gt;getvalueStr = \
PyString_FromStringAndSize(STRCAST(&quot;getvalue&quot;), 8); ++        if \
(!info-&gt;getvalueStr.get()) { ++            throwPythonException();
++        }
++    }
++
++    info-&gt;emptyTuple = PyTuple_New(0);
++    if (!info-&gt;emptyTuple.get()) {
++        throwPythonException();
++    }
++
++    info-&gt;initStr = PyString_FromStringAndSize(STRCAST(&quot;__init__&quot;), \
8); ++    if (!info-&gt;initStr.get()) {
++        throwPythonException();
++    }
+ 
+     return createType(info);
+ }
+diff -ru ../Ice-3.4.2.orig/py/modules/IcePy/Types.h ./py/modules/IcePy/Types.h
+--- ../Ice-3.4.2.orig/py/modules/IcePy/Types.h	2011-06-15 12:44:00.000000000 -0700
++++ ./py/modules/IcePy/Types.h	2013-01-31 11:20:55.000000000 -0800
+@@ -271,6 +271,14 @@
+ 
+     std::string id;
+     PyObjectHandle pythonType;
++    bool thrift;
++    PyObjectHandle TMemoryBuffer;
++    PyObjectHandle TBinaryProtocol;
++    PyObjectHandle emptyTuple;
++    PyObjectHandle readStr;
++    PyObjectHandle writeStr;
++    PyObjectHandle getvalueStr;
++    PyObjectHandle initStr;
+ };
+ typedef IceUtil::Handle&lt;CustomInfo&gt; CustomInfoPtr;
+ 
</ins></span></pre>
</div>
</div>

</body>
</html>



_______________________________________________
macports-changes mailing list
macports-changes@lists.macosforge.org
https://lists.macosforge.org/mailman/listinfo/macports-changes


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic