From 110b454e2c8b01a932755844e00614f0b7ee15ea Mon Sep 17 00:00:00 2001 From: Jason Paryani Date: Tue, 18 Feb 2014 17:33:17 -0800 Subject: [PATCH] Add accesible version numbers for C++ libcapnp --- capnp/includes/capnp_cpp.pxd | 6 ++++++ capnp/lib/capnp.pyx | 5 +++++ setup.py | 5 +++++ 3 files changed, 16 insertions(+) diff --git a/capnp/includes/capnp_cpp.pxd b/capnp/includes/capnp_cpp.pxd index 6085ac5..f486ca8 100644 --- a/capnp/includes/capnp_cpp.pxd +++ b/capnp/includes/capnp_cpp.pxd @@ -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() diff --git a/capnp/lib/capnp.pyx b/capnp/lib/capnp.pyx index eaf5880..525c653 100644 --- a/capnp/lib/capnp.pyx +++ b/capnp/lib/capnp.pyx @@ -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) diff --git a/setup.py b/setup.py index 050c5a0..d52abf8 100644 --- a/setup.py +++ b/setup.py @@ -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(