Add accesible version numbers for C++ libcapnp

This commit is contained in:
Jason Paryani
2014-02-18 17:33:17 -08:00
parent c3e34969ad
commit 110b454e2c
3 changed files with 16 additions and 0 deletions

View File

@@ -12,6 +12,12 @@ cdef extern from "capnp/common.h" namespace " ::capnp":
enum Void:
VOID " ::capnp::VOID"
cdef extern from "capnp/common.h":
int CAPNP_VERSION_MAJOR
int CAPNP_VERSION_MINOR
int CAPNP_VERSION_MICRO
int CAPNP_VERSION
cdef extern from "kj/string.h" namespace " ::kj":
cdef cppclass StringPtr:
StringPtr()

View File

@@ -26,6 +26,11 @@ import threading as _threading
import socket as _socket
import random as _random
_CAPNP_VERSION_MAJOR = capnp.CAPNP_VERSION_MAJOR
_CAPNP_VERSION_MINOR = capnp.CAPNP_VERSION_MINOR
_CAPNP_VERSION_MICRO = capnp.CAPNP_VERSION_MICRO
_CAPNP_VERSION = capnp.CAPNP_VERSION
# By making it public, we'll be able to call it from capabilityHelper.h
cdef public object wrap_dynamic_struct_reader(Response & r):
return _Response()._init_childptr(new Response(moveResponse(r)), None)

View File

@@ -25,6 +25,11 @@ def write_version_py(filename=None):
cnt = """\
version = '%s'
short_version = '%s'
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(