]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
python: Add get_version to binding
authorStéphane Graber <stgraber@ubuntu.com>
Mon, 11 Mar 2013 15:57:52 +0000 (11:57 -0400)
committerStéphane Graber <stgraber@ubuntu.com>
Mon, 11 Mar 2013 16:19:35 +0000 (12:19 -0400)
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
src/python-lxc/lxc.c
src/python-lxc/lxc/__init__.py

index 8fd0a78921410637ac92b74f45cac65453b77a03..f2b25c19f6791d0ed6008b94a16e6befa14029d6 100644 (file)
@@ -101,6 +101,12 @@ get_default_config_path(Container *self, PyObject *args, PyObject *kwds)
     return PyUnicode_FromString(lxc_get_default_config_path());
 }
 
+static PyObject *
+get_version(Container *self, PyObject *args, PyObject *kwds)
+{
+    return PyUnicode_FromString(lxc_get_version());
+}
+
 // Container properties
 static PyObject *
 Container_config_file_name(Container *self, PyObject *args, PyObject *kwds)
@@ -637,6 +643,8 @@ PyVarObject_HEAD_INIT(NULL, 0)
 static PyMethodDef LXC_methods[] = {
     {"get_default_config_path",  (PyCFunction)get_default_config_path, METH_NOARGS,
      "Returns the current LXC config path"},
+    {"get_version",  (PyCFunction)get_version, METH_NOARGS,
+     "Returns the current LXC library version"},
     {NULL, NULL, 0, NULL}
 };
 
index 828a1cb323fb1a8a7f8239f07dd8ce416ed48f13..118a08125849df5cf647a198b77d77417be16cd0 100644 (file)
@@ -33,6 +33,7 @@ warnings.warn("The python-lxc API isn't yet stable "
               "and may change at any point in the future.", Warning, 2)
 
 default_config_path = _lxc.get_default_config_path()
+version = _lxc.get_version()
 
 
 class ContainerNetwork():