Fix build for Cython 0.21

This commit is contained in:
Jason Paryani
2014-09-10 10:48:23 -07:00
parent e36f0bdc6b
commit e8ddfb9e91
7 changed files with 135 additions and 135 deletions

View File

@@ -1,6 +1,6 @@
from .capnp.includes.capnp_cpp cimport Maybe, DynamicStruct, Request, PyPromise, VoidPromise, PyPromiseArray, RemotePromise, DynamicCapability, InterfaceSchema, EnumSchema, StructSchema, DynamicValue, Capability, RpcSystem, MessageBuilder, MessageReader, TwoPartyVatNetwork, PyRestorer, AnyPointer, DynamicStruct_Builder, WaitScope, AsyncIoContext, StringPtr, TaskSet from capnp.includes.capnp_cpp cimport Maybe, DynamicStruct, Request, PyPromise, VoidPromise, PyPromiseArray, RemotePromise, DynamicCapability, InterfaceSchema, EnumSchema, StructSchema, DynamicValue, Capability, RpcSystem, MessageBuilder, MessageReader, TwoPartyVatNetwork, PyRestorer, AnyPointer, DynamicStruct_Builder, WaitScope, AsyncIoContext, StringPtr, TaskSet
from .capnp.includes.schema_cpp cimport ByteArray from capnp.includes.schema_cpp cimport ByteArray
from non_circular cimport reraise_kj_exception from non_circular cimport reraise_kj_exception

View File

@@ -5,8 +5,8 @@ cdef extern from "../helpers/checkCompiler.h":
pass pass
from schema_cpp cimport Node, Data, StructNode, EnumNode, InterfaceNode, MessageBuilder, MessageReader from schema_cpp cimport Node, Data, StructNode, EnumNode, InterfaceNode, MessageBuilder, MessageReader
from .capnp.helpers.non_circular cimport PythonInterfaceDynamicImpl, reraise_kj_exception, PyRefCounter, PyRestorer, PyEventPort, ErrorHandler from capnp.helpers.non_circular cimport PythonInterfaceDynamicImpl, reraise_kj_exception, PyRefCounter, PyRestorer, PyEventPort, ErrorHandler
from .capnp.includes.types cimport * from capnp.includes.types cimport *
cdef extern from "capnp/common.h" namespace " ::capnp": cdef extern from "capnp/common.h" namespace " ::capnp":
enum Void: enum Void:
@@ -43,7 +43,7 @@ cdef extern from "kj/exception.h" namespace " ::kj":
int getDurability() int getDurability()
StringPtr getDescription() StringPtr getDescription()
cdef extern from "kj/memory.h" namespace " ::kj": cdef extern from "kj/memory.h" namespace " ::kj":
cdef cppclass Own[T]: cdef cppclass Own[T]:
T& operator*() T& operator*()
Own[TwoPartyVatNetwork] makeTwoPartyVatNetwork" ::kj::heap< ::capnp::TwoPartyVatNetwork>"(AsyncIoStream& stream, Side) Own[TwoPartyVatNetwork] makeTwoPartyVatNetwork" ::kj::heap< ::capnp::TwoPartyVatNetwork>"(AsyncIoStream& stream, Side)

View File

@@ -5,9 +5,9 @@
from libc.stdint cimport * from libc.stdint cimport *
from capnp_cpp cimport DynamicOrphan from capnp_cpp cimport DynamicOrphan
from .capnp.helpers.non_circular cimport reraise_kj_exception from capnp.helpers.non_circular cimport reraise_kj_exception
from .capnp.includes.types cimport * from capnp.includes.types cimport *
cdef extern from "capnp/dynamic.h" namespace " ::capnp": cdef extern from "capnp/dynamic.h" namespace " ::capnp":
cdef cppclass DynamicValue: cdef cppclass DynamicValue:
@@ -34,7 +34,7 @@ cdef extern from "capnp/any.h" namespace " ::capnp":
pass pass
cppclass Builder: cppclass Builder:
pass pass
cdef extern from "capnp/blob.h" namespace " ::capnp": cdef extern from "capnp/blob.h" namespace " ::capnp":
cdef cppclass Data: cdef cppclass Data:
cppclass Reader: cppclass Reader:
@@ -118,7 +118,7 @@ cdef extern from "capnp/schema.capnp.h" namespace " ::capnp::schema":
_StructNode_Member_Body_fieldMember " ::capnp::schema::StructNode::Member::Body::Which::FIELD_MEMBER" _StructNode_Member_Body_fieldMember " ::capnp::schema::StructNode::Member::Body::Which::FIELD_MEMBER"
_StructNode_Member_Body_unionMember " ::capnp::schema::StructNode::Member::Body::Which::UNION_MEMBER" _StructNode_Member_Body_unionMember " ::capnp::schema::StructNode::Member::Body::Which::UNION_MEMBER"
cdef cppclass CodeGeneratorRequest cdef cppclass CodeGeneratorRequest
cdef cppclass InterfaceNode cdef cppclass InterfaceNode
cdef cppclass Value cdef cppclass Value
cdef cppclass ConstNode cdef cppclass ConstNode
@@ -131,13 +131,13 @@ cdef extern from "capnp/schema.capnp.h" namespace " ::capnp::schema":
cdef cppclass Annotation cdef cppclass Annotation
cdef cppclass CodeGeneratorRequest: cdef cppclass CodeGeneratorRequest:
cppclass Reader: cppclass Reader:
List[CodeGeneratorRequest.Node].Reader getNodes() List[CodeGeneratorRequest.Node].Reader getNodes()
List[UInt64].Reader getRequestedFiles() List[UInt64].Reader getRequestedFiles()
cppclass Builder: cppclass Builder:
List[CodeGeneratorRequest.Node].Builder getNodes() List[CodeGeneratorRequest.Node].Builder getNodes()
List[CodeGeneratorRequest.Node].Builder initNodes(int) List[CodeGeneratorRequest.Node].Builder initNodes(int)
List[UInt64].Builder getRequestedFiles() List[UInt64].Builder getRequestedFiles()
@@ -145,22 +145,22 @@ cdef extern from "capnp/schema.capnp.h" namespace " ::capnp::schema":
cdef cppclass InterfaceNode: cdef cppclass InterfaceNode:
cppclass Method cppclass Method
cppclass Method: cppclass Method:
cppclass Param cppclass Param
cppclass Param: cppclass Param:
cppclass Reader: cppclass Reader:
Value getDefaultValue() Value getDefaultValue()
Type getType() Type getType()
Text.Reader getName() Text.Reader getName()
List[InterfaceNode.Method.Param.Annotation].Reader getAnnotations() List[InterfaceNode.Method.Param.Annotation].Reader getAnnotations()
cppclass Builder: cppclass Builder:
Value getDefaultValue() Value getDefaultValue()
void setDefaultValue(Value) void setDefaultValue(Value)
Type getType() Type getType()
@@ -170,7 +170,7 @@ cdef extern from "capnp/schema.capnp.h" namespace " ::capnp::schema":
List[InterfaceNode.Method.Param.Annotation].Builder getAnnotations() List[InterfaceNode.Method.Param.Annotation].Builder getAnnotations()
List[InterfaceNode.Method.Param.Annotation].Builder initAnnotations(int) List[InterfaceNode.Method.Param.Annotation].Builder initAnnotations(int)
cppclass Reader: cppclass Reader:
UInt16 getCodeOrder() UInt16 getCodeOrder()
Text.Reader getName() Text.Reader getName()
List[InterfaceNode.Method.InterfaceNode.Method.Param].Reader getParams() List[InterfaceNode.Method.InterfaceNode.Method.Param].Reader getParams()
@@ -178,7 +178,7 @@ cdef extern from "capnp/schema.capnp.h" namespace " ::capnp::schema":
Type getReturnType() Type getReturnType()
List[InterfaceNode.Method.Annotation].Reader getAnnotations() List[InterfaceNode.Method.Annotation].Reader getAnnotations()
cppclass Builder: cppclass Builder:
UInt16 getCodeOrder() UInt16 getCodeOrder()
void setCodeOrder(UInt16) void setCodeOrder(UInt16)
Text.Builder getName() Text.Builder getName()
@@ -192,19 +192,19 @@ cdef extern from "capnp/schema.capnp.h" namespace " ::capnp::schema":
List[InterfaceNode.Method.Annotation].Builder getAnnotations() List[InterfaceNode.Method.Annotation].Builder getAnnotations()
List[InterfaceNode.Method.Annotation].Builder initAnnotations(int) List[InterfaceNode.Method.Annotation].Builder initAnnotations(int)
cppclass Reader: cppclass Reader:
List[InterfaceNode.InterfaceNode.Method].Reader getMethods() List[InterfaceNode.InterfaceNode.Method].Reader getMethods()
cppclass Builder: cppclass Builder:
List[InterfaceNode.InterfaceNode.Method].Builder getMethods() List[InterfaceNode.InterfaceNode.Method].Builder getMethods()
List[InterfaceNode.InterfaceNode.Method].Builder initMethods(int) List[InterfaceNode.InterfaceNode.Method].Builder initMethods(int)
cdef cppclass Value: cdef cppclass Value:
cppclass Body cppclass Body
cppclass Body: cppclass Body:
cppclass Reader: cppclass Reader:
int which() int which()
UInt32 getUint32Value() UInt32 getUint32Value()
@@ -267,21 +267,21 @@ cdef extern from "capnp/schema.capnp.h" namespace " ::capnp::schema":
Object getObjectValue() Object getObjectValue()
void setObjectValue(Object) void setObjectValue(Object)
cppclass Reader: cppclass Reader:
Value.Body getBody() Value.Body getBody()
cppclass Builder: cppclass Builder:
Value.Body getBody() Value.Body getBody()
void setBody(Value.Body) void setBody(Value.Body)
cdef cppclass ConstNode: cdef cppclass ConstNode:
cppclass Reader: cppclass Reader:
Type getType() Type getType()
Value getValue() Value getValue()
cppclass Builder: cppclass Builder:
Type getType() Type getType()
void setType(Type) void setType(Type)
Value getValue() Value getValue()
@@ -289,10 +289,10 @@ cdef extern from "capnp/schema.capnp.h" namespace " ::capnp::schema":
cdef cppclass Type: cdef cppclass Type:
cppclass Body cppclass Body
cppclass Body: cppclass Body:
cppclass Reader: cppclass Reader:
int which() int which()
Void getBoolType() Void getBoolType()
@@ -355,44 +355,44 @@ cdef extern from "capnp/schema.capnp.h" namespace " ::capnp::schema":
Void getInt16Type() Void getInt16Type()
void setInt16Type(Void) void setInt16Type(Void)
cppclass Reader: cppclass Reader:
Type.Body getBody() Type.Body getBody()
cppclass Builder: cppclass Builder:
Type.Body getBody() Type.Body getBody()
void setBody(Type.Body) void setBody(Type.Body)
cdef cppclass FileNode: cdef cppclass FileNode:
cppclass Import cppclass Import
cppclass Import: cppclass Import:
cppclass Reader: cppclass Reader:
UInt64 getId() UInt64 getId()
Text.Reader getName() Text.Reader getName()
cppclass Builder: cppclass Builder:
UInt64 getId() UInt64 getId()
void setId(UInt64) void setId(UInt64)
Text.Builder getName() Text.Builder getName()
void setName(Text) void setName(Text)
cppclass Reader: cppclass Reader:
List[FileNode.FileNode.Import].Reader getImports() List[FileNode.FileNode.Import].Reader getImports()
cppclass Builder: cppclass Builder:
List[FileNode.FileNode.Import].Builder getImports() List[FileNode.FileNode.Import].Builder getImports()
List[FileNode.FileNode.Import].Builder initImports(int) List[FileNode.FileNode.Import].Builder initImports(int)
cdef cppclass Node: cdef cppclass Node:
cppclass Body cppclass Body
cppclass NestedNode cppclass NestedNode
cppclass Body: cppclass Body:
cppclass Reader: cppclass Reader:
int which() int which()
AnnotationNode getAnnotationNode() AnnotationNode getAnnotationNode()
@@ -416,20 +416,20 @@ cdef extern from "capnp/schema.capnp.h" namespace " ::capnp::schema":
FileNode getFileNode() FileNode getFileNode()
void setFileNode(FileNode) void setFileNode(FileNode)
cppclass NestedNode: cppclass NestedNode:
cppclass Reader: cppclass Reader:
Text.Reader getName() Text.Reader getName()
UInt64 getId() UInt64 getId()
cppclass Builder: cppclass Builder:
Text.Builder getName() Text.Builder getName()
void setName(Text) void setName(Text)
UInt64 getId() UInt64 getId()
void setId(UInt64) void setId(UInt64)
cppclass Reader: cppclass Reader:
Node.Body getBody() Node.Body getBody()
Text.Reader getDisplayName() Text.Reader getDisplayName()
List[Node.Annotation].Reader getAnnotations() List[Node.Annotation].Reader getAnnotations()
@@ -443,7 +443,7 @@ cdef extern from "capnp/schema.capnp.h" namespace " ::capnp::schema":
bint isConst() bint isConst()
bint isAnnotation() bint isAnnotation()
cppclass Builder: cppclass Builder:
Node.Body getBody() Node.Body getBody()
void setBody(Node.Body) void setBody(Node.Body)
Text.Builder getDisplayName() Text.Builder getDisplayName()
@@ -464,9 +464,9 @@ cdef extern from "capnp/schema.capnp.h" namespace " ::capnp::schema":
bint isAnnotation() bint isAnnotation()
cdef cppclass AnnotationNode: cdef cppclass AnnotationNode:
cppclass Reader: cppclass Reader:
Bool getTargetsField() Bool getTargetsField()
Bool getTargetsConst() Bool getTargetsConst()
Bool getTargetsFile() Bool getTargetsFile()
@@ -480,7 +480,7 @@ cdef extern from "capnp/schema.capnp.h" namespace " ::capnp::schema":
Bool getTargetsInterface() Bool getTargetsInterface()
Bool getTargetsMethod() Bool getTargetsMethod()
cppclass Builder: cppclass Builder:
Bool getTargetsField() Bool getTargetsField()
void setTargetsField(Bool) void setTargetsField(Bool)
Bool getTargetsConst() Bool getTargetsConst()
@@ -508,17 +508,17 @@ cdef extern from "capnp/schema.capnp.h" namespace " ::capnp::schema":
cdef cppclass EnumNode: cdef cppclass EnumNode:
cppclass Enumerant cppclass Enumerant
cppclass Enumerant: cppclass Enumerant:
cppclass Reader: cppclass Reader:
UInt16 getCodeOrder() UInt16 getCodeOrder()
Text.Reader getName() Text.Reader getName()
List[EnumNode.Enumerant.Annotation].Reader getAnnotations() List[EnumNode.Enumerant.Annotation].Reader getAnnotations()
cppclass Builder: cppclass Builder:
UInt16 getCodeOrder() UInt16 getCodeOrder()
void setCodeOrder(UInt16) void setCodeOrder(UInt16)
Text.Builder getName() Text.Builder getName()
@@ -526,10 +526,10 @@ cdef extern from "capnp/schema.capnp.h" namespace " ::capnp::schema":
List[EnumNode.Enumerant.Annotation].Builder getAnnotations() List[EnumNode.Enumerant.Annotation].Builder getAnnotations()
List[EnumNode.Enumerant.Annotation].Builder initAnnotations(int) List[EnumNode.Enumerant.Annotation].Builder initAnnotations(int)
cppclass Reader: cppclass Reader:
List[EnumNode.EnumNode.Enumerant].Reader getEnumerants() List[EnumNode.EnumNode.Enumerant].Reader getEnumerants()
cppclass Builder: cppclass Builder:
List[EnumNode.EnumNode.Enumerant].Builder getEnumerants() List[EnumNode.EnumNode.Enumerant].Builder getEnumerants()
List[EnumNode.EnumNode.Enumerant].Builder initEnumerants(int) List[EnumNode.EnumNode.Enumerant].Builder initEnumerants(int)
cdef cppclass StructNode: cdef cppclass StructNode:
@@ -537,27 +537,27 @@ cdef extern from "capnp/schema.capnp.h" namespace " ::capnp::schema":
cppclass Member cppclass Member
cppclass Field cppclass Field
cppclass Union: cppclass Union:
cppclass Reader: cppclass Reader:
UInt32 getDiscriminantOffset() UInt32 getDiscriminantOffset()
List[StructNode.Union.StructNode.Member].Reader getMembers() List[StructNode.Union.StructNode.Member].Reader getMembers()
cppclass Builder: cppclass Builder:
UInt32 getDiscriminantOffset() UInt32 getDiscriminantOffset()
void setDiscriminantOffset(UInt32) void setDiscriminantOffset(UInt32)
List[StructNode.Union.StructNode.Member].Builder getMembers() List[StructNode.Union.StructNode.Member].Builder getMembers()
List[StructNode.Union.StructNode.Member].Builder initMembers(int) List[StructNode.Union.StructNode.Member].Builder initMembers(int)
cppclass Member: cppclass Member:
cppclass Body cppclass Body
cppclass Body: cppclass Body:
cppclass Reader: cppclass Reader:
int which() int which()
Field getFieldMember() Field getFieldMember()
@@ -569,14 +569,14 @@ cdef extern from "capnp/schema.capnp.h" namespace " ::capnp::schema":
Union getUnionMember() Union getUnionMember()
void setUnionMember(Union) void setUnionMember(Union)
cppclass Reader: cppclass Reader:
UInt16 getOrdinal() UInt16 getOrdinal()
StructNode.Member.Body getBody() StructNode.Member.Body getBody()
UInt16 getCodeOrder() UInt16 getCodeOrder()
Text.Reader getName() Text.Reader getName()
List[StructNode.Member.Annotation].Reader getAnnotations() List[StructNode.Member.Annotation].Reader getAnnotations()
cppclass Builder: cppclass Builder:
UInt16 getOrdinal() UInt16 getOrdinal()
void setOrdinal(UInt16) void setOrdinal(UInt16)
StructNode.Member.Body getBody() StructNode.Member.Body getBody()
@@ -588,15 +588,15 @@ cdef extern from "capnp/schema.capnp.h" namespace " ::capnp::schema":
List[StructNode.Member.Annotation].Builder getAnnotations() List[StructNode.Member.Annotation].Builder getAnnotations()
List[StructNode.Member.Annotation].Builder initAnnotations(int) List[StructNode.Member.Annotation].Builder initAnnotations(int)
cppclass Field: cppclass Field:
cppclass Reader: cppclass Reader:
Value getDefaultValue() Value getDefaultValue()
Type getType() Type getType()
UInt32 getOffset() UInt32 getOffset()
cppclass Builder: cppclass Builder:
Value getDefaultValue() Value getDefaultValue()
void setDefaultValue(Value) void setDefaultValue(Value)
Type getType() Type getType()
@@ -604,12 +604,12 @@ cdef extern from "capnp/schema.capnp.h" namespace " ::capnp::schema":
UInt32 getOffset() UInt32 getOffset()
void setOffset(UInt32) void setOffset(UInt32)
cppclass Reader: cppclass Reader:
UInt16 getDataSectionWordSize() UInt16 getDataSectionWordSize()
List[StructNode.StructNode.Member].Reader getMembers() List[StructNode.StructNode.Member].Reader getMembers()
UInt16 getPointerSectionSize() UInt16 getPointerSectionSize()
cppclass Builder: cppclass Builder:
UInt16 getDataSectionWordSize() UInt16 getDataSectionWordSize()
void setDataSectionWordSize(UInt16) void setDataSectionWordSize(UInt16)
List[StructNode.StructNode.Member].Builder getMembers() List[StructNode.StructNode.Member].Builder getMembers()
@@ -618,13 +618,13 @@ cdef extern from "capnp/schema.capnp.h" namespace " ::capnp::schema":
void setPointerSectionSize(UInt16) void setPointerSectionSize(UInt16)
cdef cppclass Annotation: cdef cppclass Annotation:
cppclass Reader: cppclass Reader:
UInt64 getId() UInt64 getId()
Value getValue() Value getValue()
cppclass Builder: cppclass Builder:
UInt64 getId() UInt64 getId()
void setId(UInt64) void setId(UInt64)
Value getValue() Value getValue()
@@ -658,7 +658,7 @@ cdef extern from "capnp/message.h" namespace " ::capnp":
StructNode.Builder initRootStructNode'initRoot< ::capnp::schema::StructNode>'() StructNode.Builder initRootStructNode'initRoot< ::capnp::schema::StructNode>'()
Annotation.Builder getRootAnnotation'getRoot< ::capnp::schema::Annotation>'() Annotation.Builder getRootAnnotation'getRoot< ::capnp::schema::Annotation>'()
Annotation.Builder initRootAnnotation'initRoot< ::capnp::schema::Annotation>'() Annotation.Builder initRootAnnotation'initRoot< ::capnp::schema::Annotation>'()
DynamicStruct_Builder getRootDynamicStruct'getRoot< ::capnp::DynamicStruct>'(StructSchema) DynamicStruct_Builder getRootDynamicStruct'getRoot< ::capnp::DynamicStruct>'(StructSchema)
DynamicStruct_Builder initRootDynamicStruct'initRoot< ::capnp::DynamicStruct>'(StructSchema) DynamicStruct_Builder initRootDynamicStruct'initRoot< ::capnp::DynamicStruct>'(StructSchema)
void setRootDynamicStruct'setRoot< ::capnp::DynamicStruct::Reader>'(DynamicStruct.Reader) void setRootDynamicStruct'setRoot< ::capnp::DynamicStruct::Reader>'(DynamicStruct.Reader)
@@ -682,7 +682,7 @@ cdef extern from "capnp/message.h" namespace " ::capnp":
DynamicStruct.Reader getRootDynamicStruct'getRoot< ::capnp::DynamicStruct>'(StructSchema) DynamicStruct.Reader getRootDynamicStruct'getRoot< ::capnp::DynamicStruct>'(StructSchema)
AnyPointer.Reader getRootAnyPointer'getRoot< ::capnp::AnyPointer>'() AnyPointer.Reader getRootAnyPointer'getRoot< ::capnp::AnyPointer>'()
cdef cppclass MallocMessageBuilder(MessageBuilder): cdef cppclass MallocMessageBuilder(MessageBuilder):
MallocMessageBuilder() MallocMessageBuilder()
MallocMessageBuilder(int) MallocMessageBuilder(int)

View File

@@ -1,10 +1,10 @@
from .capnp.includes cimport capnp_cpp as capnp from capnp.includes cimport capnp_cpp as capnp
from .capnp.includes cimport schema_cpp from capnp.includes cimport schema_cpp
from .capnp.includes.capnp_cpp cimport Schema as C_Schema, StructSchema as C_StructSchema, InterfaceSchema as C_InterfaceSchema, EnumSchema as C_EnumSchema, DynamicStruct as C_DynamicStruct, DynamicValue as C_DynamicValue, Type as C_Type, DynamicList as C_DynamicList, SchemaParser as C_SchemaParser, ParsedSchema as C_ParsedSchema, VOID, ArrayPtr, StringPtr, String, StringTree, DynamicOrphan as C_DynamicOrphan, AnyPointer as C_DynamicObject, DynamicCapability as C_DynamicCapability, Request, Response, RemotePromise, PyPromise, VoidPromise, CallContext, PyRestorer, RpcSystem, makeRpcServer, makeRpcClient, Capability as C_Capability, TwoPartyVatNetwork as C_TwoPartyVatNetwork, Side, AsyncIoStream, Own, makeTwoPartyVatNetwork, PromiseFulfillerPair as C_PromiseFulfillerPair, copyPromiseFulfillerPair, newPromiseAndFulfiller, PyArray, DynamicStruct_Builder from capnp.includes.capnp_cpp cimport Schema as C_Schema, StructSchema as C_StructSchema, InterfaceSchema as C_InterfaceSchema, EnumSchema as C_EnumSchema, DynamicStruct as C_DynamicStruct, DynamicValue as C_DynamicValue, Type as C_Type, DynamicList as C_DynamicList, SchemaParser as C_SchemaParser, ParsedSchema as C_ParsedSchema, VOID, ArrayPtr, StringPtr, String, StringTree, DynamicOrphan as C_DynamicOrphan, AnyPointer as C_DynamicObject, DynamicCapability as C_DynamicCapability, Request, Response, RemotePromise, PyPromise, VoidPromise, CallContext, PyRestorer, RpcSystem, makeRpcServer, makeRpcClient, Capability as C_Capability, TwoPartyVatNetwork as C_TwoPartyVatNetwork, Side, AsyncIoStream, Own, makeTwoPartyVatNetwork, PromiseFulfillerPair as C_PromiseFulfillerPair, copyPromiseFulfillerPair, newPromiseAndFulfiller, PyArray, DynamicStruct_Builder
from .capnp.includes.schema_cpp cimport Node as C_Node, EnumNode as C_EnumNode from capnp.includes.schema_cpp cimport Node as C_Node, EnumNode as C_EnumNode
from .capnp.includes.types cimport * from capnp.includes.types cimport *
from .capnp.helpers.non_circular cimport reraise_kj_exception from capnp.helpers.non_circular cimport reraise_kj_exception
from .capnp.helpers cimport helpers from capnp.helpers cimport helpers
cdef class _DynamicStructReader: cdef class _DynamicStructReader:
cdef C_DynamicStruct.Reader thisptr cdef C_DynamicStruct.Reader thisptr

View File

@@ -8,7 +8,7 @@
cimport cython cimport cython
from .capnp.helpers.helpers cimport makeRpcClientWithRestorer from capnp.helpers.helpers cimport makeRpcClientWithRestorer
from libc.stdlib cimport malloc, free from libc.stdlib cimport malloc, free
from cython.operator cimport dereference as deref from cython.operator cimport dereference as deref
@@ -100,7 +100,7 @@ cdef public VoidPromise * call_server_method(PyObject * _server, char * _method_
setattr(results, arg_name, arg_val) setattr(results, arg_name, arg_val)
return NULL return NULL
cdef public C_Capability.Client * call_py_restorer(PyObject * _restorer, C_DynamicObject.Reader & _reader) except *: cdef public C_Capability.Client * call_py_restorer(PyObject * _restorer, C_DynamicObject.Reader & _reader) except *:
restorer = <object>_restorer restorer = <object>_restorer
reader = _DynamicObjectReader()._init(_reader, None) reader = _DynamicObjectReader()._init(_reader, None)
@@ -149,13 +149,13 @@ def _make_enum(enum_name, *sequential, **named):
enums['reverse_mapping'] = reverse enums['reverse_mapping'] = reverse
return type(enum_name, (), enums) return type(enum_name, (), enums)
_Nature = _make_enum('_Nature', _Nature = _make_enum('_Nature',
PRECONDITION = 0, PRECONDITION = 0,
LOCAL_BUG = 1, LOCAL_BUG = 1,
OS_ERROR = 2, OS_ERROR = 2,
NETWORK_FAILURE = 3, NETWORK_FAILURE = 3,
OTHER = 4) OTHER = 4)
_Durability = _make_enum('_Durability', _Durability = _make_enum('_Durability',
PERMANENT = 0, PERMANENT = 0,
TEMPORARY = 1, TEMPORARY = 1,
OVERLOADED = 2) OVERLOADED = 2)
@@ -207,7 +207,7 @@ class KjException(Exception):
self.message = message self.message = message
self.nature = nature self.nature = nature
self.durability = durability self.durability = durability
@property @property
def file(self): def file(self):
return self.wrapper.file return self.wrapper.file
@@ -246,7 +246,7 @@ cdef public object wrap_kj_exception(capnp.Exception & exception):
cdef public object wrap_kj_exception_for_reraise(capnp.Exception & exception): cdef public object wrap_kj_exception_for_reraise(capnp.Exception & exception):
wrapper = _KjExceptionWrapper()._init(exception) wrapper = _KjExceptionWrapper()._init(exception)
wrapper_msg = str(wrapper) wrapper_msg = str(wrapper)
nature = wrapper.nature nature = wrapper.nature
if wrapper.nature == 'PRECONDITION': if wrapper.nature == 'PRECONDITION':
@@ -415,7 +415,7 @@ cdef class _DynamicResizableListBuilder:
person = addressbook.Person.new_message() person = addressbook.Person.new_message()
phones = person.init_resizable_list('phones') # This returns a _DynamicResizableListBuilder phones = person.init_resizable_list('phones') # This returns a _DynamicResizableListBuilder
phone = phones.add() phone = phones.add()
phone.number = 'foo' phone.number = 'foo'
phone = phones.add() phone = phones.add()
@@ -447,7 +447,7 @@ cdef class _DynamicResizableListBuilder:
orphan_val = orphan.get() orphan_val = orphan.get()
self._list.append((orphan, orphan_val)) self._list.append((orphan, orphan_val))
return orphan_val return orphan_val
def __getitem__(self, index): def __getitem__(self, index):
return self._list[index][1] return self._list[index][1]
@@ -477,7 +477,7 @@ cdef class _DynamicListBuilder:
person = addressbook.Person.new_message() person = addressbook.Person.new_message()
phones = person.init('phones', 2) # This returns a _DynamicListBuilder phones = person.init('phones', 2) # This returns a _DynamicListBuilder
phone = phones[0] phone = phones[0]
phone.number = 'foo' phone.number = 'foo'
phone = phones[1] phone = phones[1]
@@ -942,7 +942,7 @@ cdef class _DynamicStructBuilder:
This class is almost a 1 for 1 wrapping of the Cap'n Proto C++ DynamicStruct::Builder. The only difference is that instead of a `get`/`set` method, __getattr__/__setattr__ is overloaded and the field name is passed onto the C++ equivalent function. This means you just use . syntax to access or set any field. For field names that don't follow valid python naming convention for fields, use the global functions :py:func:`getattr`/:py:func:`setattr`:: This class is almost a 1 for 1 wrapping of the Cap'n Proto C++ DynamicStruct::Builder. The only difference is that instead of a `get`/`set` method, __getattr__/__setattr__ is overloaded and the field name is passed onto the C++ equivalent function. This means you just use . syntax to access or set any field. For field names that don't follow valid python naming convention for fields, use the global functions :py:func:`getattr`/:py:func:`setattr`::
person = addressbook.Person.new_message() # This returns a _DynamicStructBuilder person = addressbook.Person.new_message() # This returns a _DynamicStructBuilder
person.name = 'foo' # using . syntax person.name = 'foo' # using . syntax
print person.name # using . syntax print person.name # using . syntax
@@ -968,15 +968,15 @@ cdef class _DynamicStructBuilder:
def write(self, file): def write(self, file):
"""Writes the struct's containing message to the given file object in unpacked binary format. """Writes the struct's containing message to the given file object in unpacked binary format.
This is a shortcut for calling capnp._write_message_to_fd(). This can only be called on the This is a shortcut for calling capnp._write_message_to_fd(). This can only be called on the
message's root struct. message's root struct.
:type file: file :type file: file
:param file: A file or socket object (or anything with a fileno() method), open for write. :param file: A file or socket object (or anything with a fileno() method), open for write.
:rtype: void :rtype: void
:Raises: :exc:`exceptions.ValueError` if this isn't the message's root struct. :Raises: :exc:`exceptions.ValueError` if this isn't the message's root struct.
""" """
self._check_write() self._check_write()
@@ -985,15 +985,15 @@ cdef class _DynamicStructBuilder:
def write_packed(self, file): def write_packed(self, file):
"""Writes the struct's containing message to the given file object in packed binary format. """Writes the struct's containing message to the given file object in packed binary format.
This is a shortcut for calling capnp._write_packed_message_to_fd(). This can only be called on This is a shortcut for calling capnp._write_packed_message_to_fd(). This can only be called on
the message's root struct. the message's root struct.
:type file: file :type file: file
:param file: A file or socket object (or anything with a fileno() method), open for write. :param file: A file or socket object (or anything with a fileno() method), open for write.
:rtype: void :rtype: void
:Raises: :exc:`exceptions.ValueError` if this isn't the message's root struct. :Raises: :exc:`exceptions.ValueError` if this isn't the message's root struct.
""" """
self._check_write() self._check_write()
@@ -1044,7 +1044,7 @@ cdef class _DynamicStructBuilder:
cdef C_DynamicValue.Builder value = self.thisptr.get(field) cdef C_DynamicValue.Builder value = self.thisptr.get(field)
return to_python_builder(value, self._parent) return to_python_builder(value, self._parent)
def __getattr__(self, field): def __getattr__(self, field):
return self._get(field) return self._get(field)
@@ -1060,7 +1060,7 @@ cdef class _DynamicStructBuilder:
cpdef init(self, field, size=None): cpdef init(self, field, size=None):
"""Method for initializing fields that are of type union/struct/list """Method for initializing fields that are of type union/struct/list
Typically, you don't have to worry about initializing structs/unions, so this method is mainly for lists. Typically, you don't have to worry about initializing structs/unions, so this method is mainly for lists.
:type field: str :type field: str
:param field: The field name to initialize :param field: The field name to initialize
@@ -1080,7 +1080,7 @@ cdef class _DynamicStructBuilder:
cpdef init_resizable_list(self, field): cpdef init_resizable_list(self, field):
"""Method for initializing fields that are of type list (of structs) """Method for initializing fields that are of type list (of structs)
This version of init returns a :class:`_DynamicResizableListBuilder` that allows you to add members one at a time (ie. if you don't know the size for sure). This is only meant for lists of Cap'n Proto objects, since for primitive types you can just define a normal python list and fill it yourself. This version of init returns a :class:`_DynamicResizableListBuilder` that allows you to add members one at a time (ie. if you don't know the size for sure). This is only meant for lists of Cap'n Proto objects, since for primitive types you can just define a normal python list and fill it yourself.
.. warning:: You need to call :meth:`_DynamicResizableListBuilder.finish` on the list object before serializing the Cap'n Proto message. Failure to do so will cause your objects not to be written out as well as leaking orphan structs into your message. .. warning:: You need to call :meth:`_DynamicResizableListBuilder.finish` on the list object before serializing the Cap'n Proto message. Failure to do so will cause your objects not to be written out as well as leaking orphan structs into your message.
@@ -1854,7 +1854,7 @@ cdef class TwoPartyClient:
return sock return sock
cpdef restore(self, objectId) except +reraise_kj_exception: cpdef restore(self, objectId) except +reraise_kj_exception:
cdef _MessageBuilder builder cdef _MessageBuilder builder
cdef _MessageReader reader cdef _MessageReader reader
cdef _DynamicObjectBuilder object_builder cdef _DynamicObjectBuilder object_builder
cdef _DynamicObjectReader object_reader cdef _DynamicObjectReader object_reader
@@ -2191,7 +2191,7 @@ class _StructModule(object):
if field.which() == 'group': if field.which() == 'group':
name = field.name.capitalize() name = field.name.capitalize()
union_schema = schema.get_dependency(field.group.typeId).node.struct union_schema = schema.get_dependency(field.group.typeId).node.struct
if union_schema.discriminantCount == 0: if union_schema.discriminantCount == 0:
continue continue
@@ -2206,7 +2206,7 @@ class _StructModule(object):
:type file: file :type file: file
:param file: A python file-like object. It must be a "real" file, with a `fileno()` method. :param file: A python file-like object. It must be a "real" file, with a `fileno()` method.
:type traversal_limit_in_words: int :type traversal_limit_in_words: int
:param traversal_limit_in_words: Limits how many total words of data are allowed to be traversed. Is actually a uint64_t, and values can be up to 2^64-1. Default is 8*1024*1024. :param traversal_limit_in_words: Limits how many total words of data are allowed to be traversed. Is actually a uint64_t, and values can be up to 2^64-1. Default is 8*1024*1024.
@@ -2221,7 +2221,7 @@ class _StructModule(object):
:type file: file :type file: file
:param file: A python file-like object. It must be a "real" file, with a `fileno()` method. :param file: A python file-like object. It must be a "real" file, with a `fileno()` method.
:type traversal_limit_in_words: int :type traversal_limit_in_words: int
:param traversal_limit_in_words: Limits how many total words of data are allowed to be traversed. Is actually a uint64_t, and values can be up to 2^64-1. Default is 8*1024*1024. :param traversal_limit_in_words: Limits how many total words of data are allowed to be traversed. Is actually a uint64_t, and values can be up to 2^64-1. Default is 8*1024*1024.
@@ -2236,7 +2236,7 @@ class _StructModule(object):
:type file: file :type file: file
:param file: A python file-like object. It must be a "real" file, with a `fileno()` method. :param file: A python file-like object. It must be a "real" file, with a `fileno()` method.
:type traversal_limit_in_words: int :type traversal_limit_in_words: int
:param traversal_limit_in_words: Limits how many total words of data are allowed to be traversed. Is actually a uint64_t, and values can be up to 2^64-1. Default is 8*1024*1024. :param traversal_limit_in_words: Limits how many total words of data are allowed to be traversed. Is actually a uint64_t, and values can be up to 2^64-1. Default is 8*1024*1024.
@@ -2251,7 +2251,7 @@ class _StructModule(object):
:type file: file :type file: file
:param file: A python file-like object. It must be a "real" file, with a `fileno()` method. :param file: A python file-like object. It must be a "real" file, with a `fileno()` method.
:type traversal_limit_in_words: int :type traversal_limit_in_words: int
:param traversal_limit_in_words: Limits how many total words of data are allowed to be traversed. Is actually a uint64_t, and values can be up to 2^64-1. Default is 8*1024*1024. :param traversal_limit_in_words: Limits how many total words of data are allowed to be traversed. Is actually a uint64_t, and values can be up to 2^64-1. Default is 8*1024*1024.
@@ -2266,7 +2266,7 @@ class _StructModule(object):
:type buf: buffer :type buf: buffer
:param buf: Any Python object that supports the buffer interface. :param buf: Any Python object that supports the buffer interface.
:type traversal_limit_in_words: int :type traversal_limit_in_words: int
:param traversal_limit_in_words: Limits how many total words of data are allowed to be traversed. Is actually a uint64_t, and values can be up to 2^64-1. Default is 8*1024*1024. :param traversal_limit_in_words: Limits how many total words of data are allowed to be traversed. Is actually a uint64_t, and values can be up to 2^64-1. Default is 8*1024*1024.
@@ -2290,7 +2290,7 @@ class _StructModule(object):
:type buf: buffer :type buf: buffer
:param buf: Any Python object that supports the readable buffer interface. :param buf: Any Python object that supports the readable buffer interface.
:type traversal_limit_in_words: int :type traversal_limit_in_words: int
:param traversal_limit_in_words: Limits how many total words of data are allowed to be traversed. Is actually a uint64_t, and values can be up to 2^64-1. Default is 8*1024*1024. :param traversal_limit_in_words: Limits how many total words of data are allowed to be traversed. Is actually a uint64_t, and values can be up to 2^64-1. Default is 8*1024*1024.
@@ -2372,7 +2372,7 @@ cdef class SchemaParser:
return ret return ret
def load(self, file_name, display_name=None, imports=[]): def load(self, file_name, display_name=None, imports=[]):
"""Load a Cap'n Proto schema from a file """Load a Cap'n Proto schema from a file
You will have to load a schema before you can begin doing anything You will have to load a schema before you can begin doing anything
meaningful with this library. Loading a schema is much like loading meaningful with this library. Loading a schema is much like loading
@@ -2538,7 +2538,7 @@ cdef class _MessageBuilder:
:return: An AnyPointer that you can set fields in :return: An AnyPointer that you can set fields in
""" """
return _DynamicObjectBuilder()._init(self.thisptr.getRootAnyPointer(), self) return _DynamicObjectBuilder()._init(self.thisptr.getRootAnyPointer(), self)
cpdef set_root(self, value) except +reraise_kj_exception: cpdef set_root(self, value) except +reraise_kj_exception:
"""A method for instantiating Cap'n Proto structs by copying from an existing struct """A method for instantiating Cap'n Proto structs by copying from an existing struct
@@ -2694,7 +2694,7 @@ cdef class _PackedMessageReader(_MessageReader):
opts.traversalLimitInWords = traversal_limit_in_words opts.traversalLimitInWords = traversal_limit_in_words
if nesting_limit is not None: if nesting_limit is not None:
opts.nestingLimit = nesting_limit opts.nestingLimit = nesting_limit
self.thisptr = new schema_cpp.PackedMessageReader(stream, opts) self.thisptr = new schema_cpp.PackedMessageReader(stream, opts)
return self return self
@@ -2711,13 +2711,13 @@ cdef class _PackedMessageReaderBytes(_MessageReader):
opts.traversalLimitInWords = traversal_limit_in_words opts.traversalLimitInWords = traversal_limit_in_words
if nesting_limit is not None: if nesting_limit is not None:
opts.nestingLimit = nesting_limit opts.nestingLimit = nesting_limit
cdef const void *ptr cdef const void *ptr
cdef Py_ssize_t sz cdef Py_ssize_t sz
PyObject_AsReadBuffer(buf, &ptr, &sz) PyObject_AsReadBuffer(buf, &ptr, &sz)
self.stream = new schema_cpp.ArrayInputStream(schema_cpp.ByteArrayPtr(<byte *>ptr, sz)) self.stream = new schema_cpp.ArrayInputStream(schema_cpp.ByteArrayPtr(<byte *>ptr, sz))
self.thisptr = new schema_cpp.PackedMessageReader(deref(self.stream), opts) self.thisptr = new schema_cpp.PackedMessageReader(deref(self.stream), opts)
def __dealloc__(self): def __dealloc__(self):
@@ -2748,7 +2748,7 @@ cdef class _InputMessageReader(_MessageReader):
opts.traversalLimitInWords = traversal_limit_in_words opts.traversalLimitInWords = traversal_limit_in_words
if nesting_limit is not None: if nesting_limit is not None:
opts.nestingLimit = nesting_limit opts.nestingLimit = nesting_limit
self.thisptr = new schema_cpp.InputStreamMessageReader(stream, opts) self.thisptr = new schema_cpp.InputStreamMessageReader(stream, opts)
return self return self
@@ -2771,7 +2771,7 @@ cdef class _PackedFdMessageReader(_MessageReader):
opts.traversalLimitInWords = traversal_limit_in_words opts.traversalLimitInWords = traversal_limit_in_words
if nesting_limit is not None: if nesting_limit is not None:
opts.nestingLimit = nesting_limit opts.nestingLimit = nesting_limit
self.thisptr = new schema_cpp.PackedFdMessageReader(fd, opts) self.thisptr = new schema_cpp.PackedFdMessageReader(fd, opts)
cdef class _MultipleMessageReader: cdef class _MultipleMessageReader:
@@ -2784,7 +2784,7 @@ cdef class _MultipleMessageReader:
self.schema = schema self.schema = schema
self.traversal_limit_in_words = traversal_limit_in_words self.traversal_limit_in_words = traversal_limit_in_words
self.nesting_limit = nesting_limit self.nesting_limit = nesting_limit
self.stream = new schema_cpp.FdInputStream(fd) self.stream = new schema_cpp.FdInputStream(fd)
self.buffered_stream = new schema_cpp.BufferedInputStreamWrapper(deref(self.stream)) self.buffered_stream = new schema_cpp.BufferedInputStreamWrapper(deref(self.stream))
@@ -2815,7 +2815,7 @@ cdef class _MultiplePackedMessageReader:
self.schema = schema self.schema = schema
self.traversal_limit_in_words = traversal_limit_in_words self.traversal_limit_in_words = traversal_limit_in_words
self.nesting_limit = nesting_limit self.nesting_limit = nesting_limit
self.stream = new schema_cpp.FdInputStream(fd) self.stream = new schema_cpp.FdInputStream(fd)
self.buffered_stream = new schema_cpp.BufferedInputStreamWrapper(deref(self.stream)) self.buffered_stream = new schema_cpp.BufferedInputStreamWrapper(deref(self.stream))
@@ -2846,7 +2846,7 @@ cdef class _FlatArrayMessageReader(_MessageReader):
opts.traversalLimitInWords = traversal_limit_in_words opts.traversalLimitInWords = traversal_limit_in_words
if nesting_limit is not None: if nesting_limit is not None:
opts.nestingLimit = nesting_limit opts.nestingLimit = nesting_limit
cdef const void *ptr cdef const void *ptr
cdef Py_ssize_t sz cdef Py_ssize_t sz
PyObject_AsReadBuffer(buf, &ptr, &sz) PyObject_AsReadBuffer(buf, &ptr, &sz)
@@ -2937,7 +2937,7 @@ def _write_packed_message_to_fd(int fd, _MessageBuilder message):
_global_schema_parser = None _global_schema_parser = None
def load(file_name, display_name=None, imports=[]): def load(file_name, display_name=None, imports=[]):
"""Load a Cap'n Proto schema from a file """Load a Cap'n Proto schema from a file
You will have to load a schema before you can begin doing anything You will have to load a schema before you can begin doing anything
meaningful with this library. Loading a schema is much like loading meaningful with this library. Loading a schema is much like loading

View File

@@ -1,4 +1,4 @@
cython > 0.19 cython >= 0.21
setuptools >= 0.8 setuptools >= 0.8
pytest pytest
tox tox

View File

@@ -65,12 +65,12 @@ setup(
packages=["capnp"], packages=["capnp"],
version=VERSION, version=VERSION,
package_data={'capnp': ['*.pxd', '*.h', '*.capnp', 'helpers/*.pxd', 'helpers/*.h', 'includes/*.pxd', 'lib/*.pxd', 'lib/*.py', 'lib/*.pyx']}, package_data={'capnp': ['*.pxd', '*.h', '*.capnp', 'helpers/*.pxd', 'helpers/*.h', 'includes/*.pxd', 'lib/*.pxd', 'lib/*.py', 'lib/*.pyx']},
ext_modules=cythonize('capnp/lib/*.pyx', language="c++"), ext_modules=cythonize('capnp/lib/*.pyx'),
cmdclass = { cmdclass = {
'clean': clean 'clean': clean
}, },
install_requires=[ install_requires=[
'cython > 0.19', 'cython >= 0.21',
'setuptools >= 0.8'], 'setuptools >= 0.8'],
# PyPi info # PyPi info
description="A cython wrapping of the C++ Cap'n Proto library", description="A cython wrapping of the C++ Cap'n Proto library",