[lxc-devel] [PATCH 3/3] python: Add get_version to binding

Serge Hallyn serge.hallyn at ubuntu.com
Mon Mar 11 16:07:55 UTC 2013


Quoting Stéphane Graber (stgraber at ubuntu.com):
> Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>

Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>

> ---
>  src/python-lxc/lxc.c           | 8 ++++++++
>  src/python-lxc/lxc/__init__.py | 1 +
>  2 files changed, 9 insertions(+)
> 
> diff --git a/src/python-lxc/lxc.c b/src/python-lxc/lxc.c
> index 8fd0a78..f2b25c1 100644
> --- a/src/python-lxc/lxc.c
> +++ b/src/python-lxc/lxc.c
> @@ -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}
>  };
>  
> diff --git a/src/python-lxc/lxc/__init__.py b/src/python-lxc/lxc/__init__.py
> index 828a1cb..118a081 100644
> --- a/src/python-lxc/lxc/__init__.py
> +++ b/src/python-lxc/lxc/__init__.py
> @@ -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():
> -- 
> 1.8.1.2
> 
> 
> ------------------------------------------------------------------------------
> Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester  
> Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the  
> endpoint security space. For insight on selecting the right partner to 
> tackle endpoint security challenges, access the full report. 
> http://p.sf.net/sfu/symantec-dev2dev
> _______________________________________________
> Lxc-devel mailing list
> Lxc-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/lxc-devel




More information about the lxc-devel mailing list