Remove many lint warnings
Mostly whitespace changes, with max-line-length set to 120 and double-quotes used, adopting black settings. Related to https://github.com/capnproto/pycapnp/issues/128
This commit is contained in:
4
.github/workflows/packagingtest.yml
vendored
4
.github/workflows/packagingtest.yml
vendored
@@ -32,8 +32,8 @@ jobs:
|
||||
- name: Lint with flake8
|
||||
run: |
|
||||
pip install flake8
|
||||
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --exclude benchmark
|
||||
flake8 . --count --max-complexity=10 --max-line-length=127 --statistics --exclude benchmark
|
||||
flake8 . --filename '*.py,*.pyx,*.pxd' --count --max-complexity=10 --max-line-length=120 --ignore=E211,E225,E226,E227,E231,E251,E261,E262,E265,E402,E722,E999 --show-source --statistics --exclude benchmark,build,capnp/templates/module.pyx
|
||||
flake8 . --count --max-complexity=10 --max-line-length=120 --show-source --statistics --exclude benchmark,build
|
||||
- name: Packaging
|
||||
run: |
|
||||
python setup.py bdist_wheel
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
from capnp.includes.capnp_cpp cimport Maybe, ReaderOptions, DynamicStruct, Request, Response, PyPromise, VoidPromise, PyPromiseArray, RemotePromise, DynamicCapability, InterfaceSchema, EnumSchema, StructSchema, DynamicValue, Capability, RpcSystem, MessageBuilder, MessageReader, TwoPartyVatNetwork, AnyPointer, DynamicStruct_Builder, WaitScope, AsyncIoContext, StringPtr, TaskSet, Timer, AsyncIoStreamReadHelper
|
||||
from capnp.includes.capnp_cpp cimport (
|
||||
Maybe, ReaderOptions, DynamicStruct, Request, Response, PyPromise, VoidPromise, PyPromiseArray,
|
||||
RemotePromise, DynamicCapability, InterfaceSchema, EnumSchema, StructSchema, DynamicValue,
|
||||
Capability, RpcSystem, MessageBuilder, MessageReader, TwoPartyVatNetwork, AnyPointer,
|
||||
DynamicStruct_Builder, WaitScope, AsyncIoContext, StringPtr, TaskSet, Timer, AsyncIoStreamReadHelper,
|
||||
)
|
||||
|
||||
from capnp.includes.schema_cpp cimport ByteArray
|
||||
|
||||
|
||||
@@ -4,8 +4,12 @@ cdef extern from "capnp/helpers/checkCompiler.h":
|
||||
pass
|
||||
|
||||
from libcpp cimport bool
|
||||
from capnp.helpers.non_circular cimport PythonInterfaceDynamicImpl, reraise_kj_exception, PyRefCounter, PyEventPort, ErrorHandler
|
||||
from capnp.includes.schema_cpp cimport Node, Data, StructNode, EnumNode, InterfaceNode, MessageBuilder, MessageReader, ReaderOptions
|
||||
from capnp.helpers.non_circular cimport (
|
||||
PythonInterfaceDynamicImpl, reraise_kj_exception, PyRefCounter, PyEventPort, ErrorHandler,
|
||||
)
|
||||
from capnp.includes.schema_cpp cimport (
|
||||
Node, Data, StructNode, EnumNode, InterfaceNode, MessageBuilder, MessageReader, ReaderOptions,
|
||||
)
|
||||
from capnp.includes.types cimport *
|
||||
|
||||
cdef extern from "capnp/common.h" namespace " ::capnp":
|
||||
@@ -46,8 +50,10 @@ cdef extern from "kj/memory.h" namespace " ::kj":
|
||||
cdef cppclass Own[T]:
|
||||
T& operator*()
|
||||
T* get()
|
||||
Own[TwoPartyVatNetwork] makeTwoPartyVatNetwork" ::kj::heap< ::capnp::TwoPartyVatNetwork>"(AsyncIoStream& stream, Side, ReaderOptions)
|
||||
Own[PromiseFulfillerPair] copyPromiseFulfillerPair" ::kj::heap< ::kj::PromiseFulfillerPair<void> >"(PromiseFulfillerPair&)
|
||||
Own[TwoPartyVatNetwork] makeTwoPartyVatNetwork" ::kj::heap< ::capnp::TwoPartyVatNetwork>"(
|
||||
AsyncIoStream& stream, Side, ReaderOptions)
|
||||
Own[PromiseFulfillerPair] copyPromiseFulfillerPair" ::kj::heap< ::kj::PromiseFulfillerPair<void> >"(
|
||||
PromiseFulfillerPair&)
|
||||
Own[PyRefCounter] makePyRefCounter" ::kj::heap< PyRefCounter >"(PyObject *)
|
||||
|
||||
cdef extern from "kj/async.h" namespace " ::kj":
|
||||
@@ -309,7 +315,8 @@ cdef extern from "capnp/dynamic.h" namespace " ::capnp":
|
||||
DynamicValueForward.Pipeline get(char *)
|
||||
StructSchema getSchema()
|
||||
|
||||
cdef cppclass DynamicStruct_Builder" ::capnp::DynamicStruct::Builder": # Need to flatten this class out, since nested C++ classes cause havoc with cython fused types
|
||||
cdef cppclass DynamicStruct_Builder" ::capnp::DynamicStruct::Builder":
|
||||
# Need to flatten this class out, since nested C++ classes cause havoc with cython fused types
|
||||
DynamicStruct_Builder()
|
||||
DynamicStruct_Builder(DynamicStruct_Builder &)
|
||||
DynamicValueForward.Builder get(char *) except +reraise_kj_exception
|
||||
@@ -344,7 +351,8 @@ cdef extern from "capnp/dynamic.h" namespace " ::capnp":
|
||||
cdef extern from "capnp/capability.h" namespace " ::capnp":
|
||||
cdef cppclass Response" ::capnp::Response< ::capnp::DynamicStruct>"(DynamicStruct.Reader):
|
||||
Response(Response)
|
||||
cdef cppclass RemotePromise" ::capnp::RemotePromise< ::capnp::DynamicStruct>"(Promise[Response], DynamicStruct.Pipeline):
|
||||
cdef cppclass RemotePromise" ::capnp::RemotePromise< ::capnp::DynamicStruct>"(
|
||||
Promise[Response], DynamicStruct.Pipeline):
|
||||
RemotePromise(RemotePromise)
|
||||
cdef cppclass Capability:
|
||||
cppclass Client:
|
||||
@@ -404,20 +412,23 @@ cdef extern from "capnp/any.h" namespace " ::capnp":
|
||||
cdef cppclass AnyPointer:
|
||||
cppclass Reader:
|
||||
DynamicStruct.Reader getAs"getAs< ::capnp::DynamicStruct>"(StructSchema) except +reraise_kj_exception
|
||||
DynamicCapability.Client getAsCapability"getAs< ::capnp::DynamicCapability>"(InterfaceSchema) except +reraise_kj_exception
|
||||
DynamicCapability.Client getAsCapability"getAs< ::capnp::DynamicCapability>"(
|
||||
InterfaceSchema) except +reraise_kj_exception
|
||||
DynamicList.Reader getAsList"getAs< ::capnp::DynamicList>"(ListSchema) except +reraise_kj_exception
|
||||
StringPtr getAsText"getAs< ::capnp::Text>"() except +reraise_kj_exception
|
||||
cppclass Builder:
|
||||
Builder(Builder)
|
||||
DynamicStruct_Builder getAs"getAs< ::capnp::DynamicStruct>"(StructSchema) except +reraise_kj_exception
|
||||
DynamicCapability.Client getAsCapability"getAs< ::capnp::DynamicCapability>"(InterfaceSchema) except +reraise_kj_exception
|
||||
DynamicCapability.Client getAsCapability"getAs< ::capnp::DynamicCapability>"(
|
||||
InterfaceSchema) except +reraise_kj_exception
|
||||
DynamicList.Builder getAsList"getAs< ::capnp::DynamicList>"(ListSchema) except +reraise_kj_exception
|
||||
StringPtr getAsText"getAs< ::capnp::Text>"() except +reraise_kj_exception
|
||||
void setAsStruct"setAs< ::capnp::DynamicStruct>"(DynamicStruct.Reader&) except +reraise_kj_exception
|
||||
void setAsText"setAs< ::capnp::Text>"(char*) except +reraise_kj_exception
|
||||
AnyPointer.Reader asReader() except +reraise_kj_exception
|
||||
void set(AnyPointer.Reader) except +reraise_kj_exception
|
||||
DynamicStruct_Builder initAsStruct"initAs< ::capnp::DynamicStruct>"(StructSchema) except +reraise_kj_exception
|
||||
DynamicStruct_Builder initAsStruct"initAs< ::capnp::DynamicStruct>"(
|
||||
StructSchema) except +reraise_kj_exception
|
||||
DynamicList.Builder initAsList"initAs< ::capnp::DynamicList>"(ListSchema, uint) except +reraise_kj_exception
|
||||
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ cdef extern from "capnp/message.h" namespace " ::capnp":
|
||||
uint size()
|
||||
|
||||
cdef extern from "capnp/schema.capnp.h" namespace " ::capnp::schema":
|
||||
enum :
|
||||
enum:
|
||||
_ElementSize_inlineComposite " ::capnp::schema::ElementSize::INLINE_COMPOSITE"
|
||||
_ElementSize_eightBytes " ::capnp::schema::ElementSize::EIGHT_BYTES"
|
||||
_ElementSize_pointer " ::capnp::schema::ElementSize::POINTER"
|
||||
@@ -133,7 +133,6 @@ cdef extern from "capnp/schema.capnp.h" namespace " ::capnp::schema":
|
||||
cdef cppclass Annotation
|
||||
cdef cppclass CodeGeneratorRequest:
|
||||
|
||||
|
||||
cppclass Reader:
|
||||
|
||||
List[CodeGeneratorRequest.Node].Reader getNodes()
|
||||
@@ -144,17 +143,15 @@ cdef extern from "capnp/schema.capnp.h" namespace " ::capnp::schema":
|
||||
List[CodeGeneratorRequest.Node].Builder initNodes(int)
|
||||
List[UInt64].Builder getRequestedFiles()
|
||||
List[UInt64].Builder initRequestedFiles(int)
|
||||
|
||||
cdef cppclass InterfaceNode:
|
||||
cppclass Method
|
||||
|
||||
|
||||
cppclass Method:
|
||||
cppclass Param
|
||||
|
||||
|
||||
cppclass Param:
|
||||
|
||||
|
||||
cppclass Reader:
|
||||
|
||||
Value getDefaultValue()
|
||||
@@ -171,6 +168,7 @@ cdef extern from "capnp/schema.capnp.h" namespace " ::capnp::schema":
|
||||
void setName(Text)
|
||||
List[InterfaceNode.Method.Param.Annotation].Builder getAnnotations()
|
||||
List[InterfaceNode.Method.Param.Annotation].Builder initAnnotations(int)
|
||||
|
||||
cppclass Reader:
|
||||
|
||||
UInt16 getCodeOrder()
|
||||
@@ -179,6 +177,7 @@ cdef extern from "capnp/schema.capnp.h" namespace " ::capnp::schema":
|
||||
UInt16 getRequiredParamCount()
|
||||
Type getReturnType()
|
||||
List[InterfaceNode.Method.Annotation].Reader getAnnotations()
|
||||
|
||||
cppclass Builder:
|
||||
|
||||
UInt16 getCodeOrder()
|
||||
@@ -193,20 +192,21 @@ cdef extern from "capnp/schema.capnp.h" namespace " ::capnp::schema":
|
||||
void setReturnType(Type)
|
||||
List[InterfaceNode.Method.Annotation].Builder getAnnotations()
|
||||
List[InterfaceNode.Method.Annotation].Builder initAnnotations(int)
|
||||
|
||||
cppclass Reader:
|
||||
|
||||
List[InterfaceNode.InterfaceNode.Method].Reader getMethods()
|
||||
|
||||
cppclass Builder:
|
||||
|
||||
List[InterfaceNode.InterfaceNode.Method].Builder getMethods()
|
||||
List[InterfaceNode.InterfaceNode.Method].Builder initMethods(int)
|
||||
|
||||
cdef cppclass Value:
|
||||
cppclass Body
|
||||
|
||||
|
||||
cppclass Body:
|
||||
|
||||
|
||||
cppclass Reader:
|
||||
int which()
|
||||
UInt32 getUint32Value()
|
||||
@@ -228,6 +228,7 @@ cdef extern from "capnp/schema.capnp.h" namespace " ::capnp::schema":
|
||||
Text.Reader getTextValue()
|
||||
UInt64 getUint64Value()
|
||||
Object getObjectValue()
|
||||
|
||||
cppclass Builder:
|
||||
int which()
|
||||
UInt32 getUint32Value()
|
||||
@@ -268,33 +269,35 @@ cdef extern from "capnp/schema.capnp.h" namespace " ::capnp::schema":
|
||||
void setUint64Value(UInt64)
|
||||
Object getObjectValue()
|
||||
void setObjectValue(Object)
|
||||
|
||||
cppclass Reader:
|
||||
|
||||
Value.Body getBody()
|
||||
|
||||
cppclass Builder:
|
||||
|
||||
Value.Body getBody()
|
||||
void setBody(Value.Body)
|
||||
cdef cppclass ConstNode:
|
||||
|
||||
cdef cppclass ConstNode:
|
||||
|
||||
cppclass Reader:
|
||||
|
||||
Type getType()
|
||||
Value getValue()
|
||||
|
||||
cppclass Builder:
|
||||
|
||||
Type getType()
|
||||
void setType(Type)
|
||||
Value getValue()
|
||||
void setValue(Value)
|
||||
|
||||
cdef cppclass Type:
|
||||
cppclass Body
|
||||
|
||||
|
||||
cppclass Body:
|
||||
|
||||
|
||||
cppclass Reader:
|
||||
int which()
|
||||
Void getBoolType()
|
||||
@@ -316,6 +319,7 @@ cdef extern from "capnp/schema.capnp.h" namespace " ::capnp::schema":
|
||||
Void getUint64Type()
|
||||
Void getTextType()
|
||||
Void getInt16Type()
|
||||
|
||||
cppclass Builder:
|
||||
int which()
|
||||
Void getBoolType()
|
||||
@@ -356,45 +360,48 @@ cdef extern from "capnp/schema.capnp.h" namespace " ::capnp::schema":
|
||||
void setTextType(Void)
|
||||
Void getInt16Type()
|
||||
void setInt16Type(Void)
|
||||
|
||||
cppclass Reader:
|
||||
|
||||
Type.Body getBody()
|
||||
|
||||
cppclass Builder:
|
||||
|
||||
Type.Body getBody()
|
||||
void setBody(Type.Body)
|
||||
|
||||
cdef cppclass FileNode:
|
||||
cppclass Import
|
||||
|
||||
|
||||
cppclass Import:
|
||||
|
||||
|
||||
cppclass Reader:
|
||||
|
||||
UInt64 getId()
|
||||
Text.Reader getName()
|
||||
|
||||
cppclass Builder:
|
||||
|
||||
UInt64 getId()
|
||||
void setId(UInt64)
|
||||
Text.Builder getName()
|
||||
void setName(Text)
|
||||
|
||||
cppclass Reader:
|
||||
|
||||
List[FileNode.FileNode.Import].Reader getImports()
|
||||
|
||||
cppclass Builder:
|
||||
|
||||
List[FileNode.FileNode.Import].Builder getImports()
|
||||
List[FileNode.FileNode.Import].Builder initImports(int)
|
||||
|
||||
cdef cppclass Node:
|
||||
cppclass Body
|
||||
cppclass NestedNode
|
||||
|
||||
|
||||
cppclass Body:
|
||||
|
||||
|
||||
cppclass Reader:
|
||||
int which()
|
||||
AnnotationNode getAnnotationNode()
|
||||
@@ -417,8 +424,8 @@ cdef extern from "capnp/schema.capnp.h" namespace " ::capnp::schema":
|
||||
void setConstNode(ConstNode)
|
||||
FileNode getFileNode()
|
||||
void setFileNode(FileNode)
|
||||
cppclass NestedNode:
|
||||
|
||||
cppclass NestedNode:
|
||||
|
||||
cppclass Reader:
|
||||
|
||||
@@ -444,6 +451,7 @@ cdef extern from "capnp/schema.capnp.h" namespace " ::capnp::schema":
|
||||
bint isInterface()
|
||||
bint isConst()
|
||||
bint isAnnotation()
|
||||
|
||||
cppclass Builder:
|
||||
|
||||
Node.Body getBody()
|
||||
@@ -464,8 +472,8 @@ cdef extern from "capnp/schema.capnp.h" namespace " ::capnp::schema":
|
||||
bint isInterface()
|
||||
bint isConst()
|
||||
bint isAnnotation()
|
||||
cdef cppclass AnnotationNode:
|
||||
|
||||
cdef cppclass AnnotationNode:
|
||||
|
||||
cppclass Reader:
|
||||
|
||||
@@ -481,6 +489,7 @@ cdef extern from "capnp/schema.capnp.h" namespace " ::capnp::schema":
|
||||
Bool getTargetsEnum()
|
||||
Bool getTargetsInterface()
|
||||
Bool getTargetsMethod()
|
||||
|
||||
cppclass Builder:
|
||||
|
||||
Bool getTargetsField()
|
||||
@@ -507,18 +516,18 @@ cdef extern from "capnp/schema.capnp.h" namespace " ::capnp::schema":
|
||||
void setTargetsInterface(Bool)
|
||||
Bool getTargetsMethod()
|
||||
void setTargetsMethod(Bool)
|
||||
|
||||
cdef cppclass EnumNode:
|
||||
cppclass Enumerant
|
||||
|
||||
|
||||
cppclass Enumerant:
|
||||
|
||||
|
||||
cppclass Reader:
|
||||
|
||||
UInt16 getCodeOrder()
|
||||
Text.Reader getName()
|
||||
List[EnumNode.Enumerant.Annotation].Reader getAnnotations()
|
||||
|
||||
cppclass Builder:
|
||||
|
||||
UInt16 getCodeOrder()
|
||||
@@ -527,22 +536,23 @@ cdef extern from "capnp/schema.capnp.h" namespace " ::capnp::schema":
|
||||
void setName(Text)
|
||||
List[EnumNode.Enumerant.Annotation].Builder getAnnotations()
|
||||
List[EnumNode.Enumerant.Annotation].Builder initAnnotations(int)
|
||||
|
||||
cppclass Reader:
|
||||
|
||||
List[EnumNode.EnumNode.Enumerant].Reader getEnumerants()
|
||||
|
||||
cppclass Builder:
|
||||
|
||||
List[EnumNode.EnumNode.Enumerant].Builder getEnumerants()
|
||||
List[EnumNode.EnumNode.Enumerant].Builder initEnumerants(int)
|
||||
|
||||
cdef cppclass StructNode:
|
||||
cppclass Union
|
||||
cppclass Member
|
||||
cppclass Field
|
||||
|
||||
|
||||
cppclass Union:
|
||||
|
||||
|
||||
cppclass Reader:
|
||||
|
||||
UInt32 getDiscriminantOffset()
|
||||
@@ -556,10 +566,8 @@ cdef extern from "capnp/schema.capnp.h" namespace " ::capnp::schema":
|
||||
cppclass Member:
|
||||
cppclass Body
|
||||
|
||||
|
||||
cppclass Body:
|
||||
|
||||
|
||||
cppclass Reader:
|
||||
int which()
|
||||
Field getFieldMember()
|
||||
@@ -589,8 +597,8 @@ cdef extern from "capnp/schema.capnp.h" namespace " ::capnp::schema":
|
||||
void setName(Text)
|
||||
List[StructNode.Member.Annotation].Builder getAnnotations()
|
||||
List[StructNode.Member.Annotation].Builder initAnnotations(int)
|
||||
cppclass Field:
|
||||
|
||||
cppclass Field:
|
||||
|
||||
cppclass Reader:
|
||||
|
||||
@@ -620,7 +628,6 @@ cdef extern from "capnp/schema.capnp.h" namespace " ::capnp::schema":
|
||||
void setPointerSectionSize(UInt16)
|
||||
cdef cppclass Annotation:
|
||||
|
||||
|
||||
cppclass Reader:
|
||||
|
||||
UInt64 getId()
|
||||
|
||||
@@ -2,7 +2,18 @@
|
||||
|
||||
from capnp.includes cimport capnp_cpp as capnp
|
||||
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, ListSchema as C_ListSchema, 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, Promise, CallContext, RpcSystem, makeRpcServerBootstrap, makeRpcClient, Capability as C_Capability, TwoPartyVatNetwork as C_TwoPartyVatNetwork, Side, AsyncIoStream, Own, makeTwoPartyVatNetwork, PromiseFulfillerPair as C_PromiseFulfillerPair, copyPromiseFulfillerPair, newPromiseAndFulfiller, PyArray, DynamicStruct_Builder, TwoWayPipe
|
||||
from capnp.includes.capnp_cpp cimport (
|
||||
Schema as C_Schema, StructSchema as C_StructSchema, InterfaceSchema as C_InterfaceSchema,
|
||||
EnumSchema as C_EnumSchema, ListSchema as C_ListSchema, 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, Promise,
|
||||
CallContext, RpcSystem, makeRpcServerBootstrap, makeRpcClient, Capability as C_Capability,
|
||||
TwoPartyVatNetwork as C_TwoPartyVatNetwork, Side, AsyncIoStream, Own, makeTwoPartyVatNetwork,
|
||||
PromiseFulfillerPair as C_PromiseFulfillerPair, copyPromiseFulfillerPair, newPromiseAndFulfiller,
|
||||
PyArray, DynamicStruct_Builder, TwoWayPipe,
|
||||
)
|
||||
from capnp.includes.schema_cpp cimport Node as C_Node, EnumNode as C_EnumNode
|
||||
from capnp.includes.types cimport *
|
||||
from capnp.helpers.non_circular cimport reraise_kj_exception
|
||||
@@ -149,7 +160,8 @@ cdef _setDynamicFieldStatic(DynamicStruct_Builder thisptr, field, value, parent)
|
||||
|
||||
cdef api object wrap_dynamic_struct_reader(Response & r) with gil
|
||||
cdef api PyObject * wrap_remote_call(PyObject * func, Response & r) except * with gil
|
||||
cdef api Promise[void] * call_server_method(PyObject * _server, char * _method_name, CallContext & _context) except * with gil
|
||||
cdef api Promise[void] * call_server_method(
|
||||
PyObject * _server, char * _method_name, CallContext & _context) except * with gil
|
||||
cdef api convert_array_pyobject(PyArray & arr) with gil
|
||||
cdef api Promise[PyObject*] * extract_promise(object obj) with gil
|
||||
cdef api RemotePromise * extract_remote_promise(object obj) with gil
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
37
setup.py
37
setup.py
@@ -33,14 +33,13 @@ def write_version_py(filename=None):
|
||||
Generate pycapnp version
|
||||
'''
|
||||
cnt = """\
|
||||
from .lib.capnp import _CAPNP_VERSION_MAJOR as LIBCAPNP_VERSION_MAJOR # noqa: F401
|
||||
from .lib.capnp import _CAPNP_VERSION_MINOR as LIBCAPNP_VERSION_MINOR # noqa: F401
|
||||
from .lib.capnp import _CAPNP_VERSION_MICRO as LIBCAPNP_VERSION_MICRO # noqa: F401
|
||||
from .lib.capnp import _CAPNP_VERSION as LIBCAPNP_VERSION # noqa: F401
|
||||
|
||||
version = '%s'
|
||||
short_version = '%s'
|
||||
|
||||
# flake8: noqa E402 F401
|
||||
from .lib.capnp import _CAPNP_VERSION_MAJOR as LIBCAPNP_VERSION_MAJOR
|
||||
from .lib.capnp import _CAPNP_VERSION_MINOR as LIBCAPNP_VERSION_MINOR
|
||||
from .lib.capnp import _CAPNP_VERSION_MICRO as LIBCAPNP_VERSION_MICRO
|
||||
from .lib.capnp import _CAPNP_VERSION as LIBCAPNP_VERSION
|
||||
"""
|
||||
if not filename:
|
||||
filename = os.path.join(
|
||||
@@ -63,6 +62,7 @@ with open('CHANGELOG.md', encoding='utf-8') as f:
|
||||
changelog = '\nChangelog\n=============\n' + changelog
|
||||
long_description += changelog
|
||||
|
||||
|
||||
class clean(_clean):
|
||||
'''
|
||||
Clean command, invoked with `python setup.py clean`
|
||||
@@ -105,7 +105,8 @@ try:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
from Cython.Distutils import build_ext as build_ext_c
|
||||
from Cython.Distutils import build_ext as build_ext_c # noqa: E402
|
||||
|
||||
|
||||
class build_libcapnp_ext(build_ext_c):
|
||||
'''
|
||||
@@ -114,7 +115,7 @@ class build_libcapnp_ext(build_ext_c):
|
||||
def build_extension(self, ext):
|
||||
build_ext_c.build_extension(self, ext)
|
||||
|
||||
def run(self):
|
||||
def run(self): # noqa: C901
|
||||
if force_bundled_libcapnp:
|
||||
need_build = True
|
||||
elif force_system_libcapnp:
|
||||
@@ -123,9 +124,10 @@ class build_libcapnp_ext(build_ext_c):
|
||||
# Try to use capnp executable to find include and lib path
|
||||
capnp_executable = shutil.which("capnp")
|
||||
if capnp_executable:
|
||||
self.include_dirs += [os.path.join(os.path.dirname(capnp_executable), '..', 'include')]
|
||||
self.library_dirs += [os.path.join(os.path.dirname(capnp_executable), '..', 'lib{}'.format(8 * struct.calcsize("P")))]
|
||||
self.library_dirs += [os.path.join(os.path.dirname(capnp_executable), '..', 'lib')]
|
||||
capnp_dir = os.path.dirname(capnp_executable)
|
||||
self.include_dirs += [os.path.join(capnp_dir, "..", "include")]
|
||||
self.library_dirs += [os.path.join(capnp_dir, "..", "lib{}".format(8 * struct.calcsize("P")))]
|
||||
self.library_dirs += [os.path.join(capnp_dir, "..", "lib")]
|
||||
|
||||
# Look for capnproto using pkg-config (and minimum version)
|
||||
try:
|
||||
@@ -176,14 +178,16 @@ class build_libcapnp_ext(build_ext_c):
|
||||
|
||||
return build_ext_c.run(self)
|
||||
|
||||
|
||||
extra_compile_args = ['--std=c++14']
|
||||
extra_link_args = []
|
||||
if os.name == 'nt':
|
||||
extra_compile_args = ['/std:c++14', '/MD']
|
||||
extra_link_args = ['/MANIFEST']
|
||||
|
||||
import Cython.Build
|
||||
import Cython # noqa: F401
|
||||
import Cython.Build # noqa: E402
|
||||
import Cython # noqa: E402
|
||||
|
||||
extensions = [Extension(
|
||||
'*', ['capnp/helpers/capabilityHelper.cpp', 'capnp/lib/*.pyx'],
|
||||
extra_compile_args=extra_compile_args,
|
||||
@@ -208,14 +212,15 @@ setup(
|
||||
},
|
||||
install_requires=[],
|
||||
entry_points={
|
||||
'console_scripts' : ['capnpc-cython = capnp._gen:main']
|
||||
"console_scripts": ["capnpc-cython = capnp._gen:main"]
|
||||
},
|
||||
# PyPi info
|
||||
description="A cython wrapping of the C++ Cap'n Proto library",
|
||||
long_description=long_description,
|
||||
long_description_content_type = 'text/markdown',
|
||||
long_description_content_type="text/markdown",
|
||||
license='BSD',
|
||||
author="Jacob Alexander", # <- Current maintainer; Original author -> Jason Paryani (setup.py only supports 1 author...)
|
||||
# (setup.py only supports 1 author...)
|
||||
author="Jacob Alexander", # <- Current maintainer; Original author -> Jason Paryani
|
||||
author_email="haata@kiibohd.com",
|
||||
url='https://github.com/capnproto/pycapnp',
|
||||
download_url='https://github.com/haata/pycapnp/archive/v%s.zip' % VERSION,
|
||||
|
||||
@@ -297,7 +297,13 @@ def test_timer():
|
||||
assert test_timer_var is True
|
||||
|
||||
test_timer_var = False
|
||||
promise = capnp.Promise(0).then(lambda x: time.sleep(.1)).then(lambda x: time.sleep(.1)).then(lambda x: set_timer_var())
|
||||
promise = capnp.Promise(0).then(
|
||||
lambda x: time.sleep(.1)
|
||||
).then(
|
||||
lambda x: time.sleep(.1)
|
||||
).then(
|
||||
lambda x: set_timer_var()
|
||||
)
|
||||
|
||||
canceller = capnp.getTimer().after_delay(1).then(lambda: promise.cancel())
|
||||
|
||||
|
||||
Reference in New Issue
Block a user