[libvirt] [PATCH 3/1] build: avoid python 2.4 build failure

Daniel Veillard veillard at redhat.com
Fri Jun 24 08:58:43 UTC 2011


On Thu, Jun 23, 2011 at 10:26:03PM -0600, Eric Blake wrote:
> I'm not sure when Py_ssize_t was introduced; but Fedora 14 Python 2.7
> has it, while RHEL 5 Python 2.4 lacks it.
> 
> * python/typewrappers.h (Py_ssize_t): Define for older python.
> ---
> 
> This was the remaining patch needed to complete a build on RHEL 5,
> but I'm not sure if it's the right thing to do (or what the right
> maximum version would be for defining Py_ssize_t ourselves).
> 
>  python/typewrappers.h |    7 ++++++-
>  1 files changed, 6 insertions(+), 1 deletions(-)
> 
> diff --git a/python/typewrappers.h b/python/typewrappers.h
> index 305d594..70c15d9 100644
> --- a/python/typewrappers.h
> +++ b/python/typewrappers.h
> @@ -1,7 +1,7 @@
>  /*
>   * libvirt_wrap.h: type wrappers for libvir python bindings
>   *
> - * Copyright (C) 2005 Red Hat, Inc.
> + * Copyright (C) 2005, 2011 Red Hat, Inc.
>   *
>   * Daniel Veillard <veillard at redhat.com>
>   */
> @@ -21,6 +21,11 @@
>  # define ATTRIBUTE_UNUSED
>  #endif
> 
> +/* Work around really old python.  */
> +#if PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION < 7
> +typedef ssize_t Py_ssize_t;
> +#endif
> +
>  #define PyvirConnect_Get(v) (((v) == Py_None) ? NULL : \
>          (((PyvirConnect_Object *)(v))->obj))
> 

  I think the workaround is fine, if we ever hit a protability problem
due to this then we can refine, but that looks simple enough for me and
does the job

 ACK,

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel at veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/




More information about the libvir-list mailing list