On Mon, Jun 07, 2010 at 11:24:24AM +0200, David Coppa wrote:
> On Sun, 06 Jun 2010, Christian Weisgerber wrote:
> 
> This is the py-ao fix (patches from debian/ubuntu).
> 
> Ciao, 
> David

I have the same diff (patches stolen from Debian).
But, in patch-src_aomodule_c, i added this line:
++ memset(&sample_format, 0, sizeof(sample_format));

This is needed after the recent libao update.
Regards,

Index: Makefile
===================================================================
RCS file: /cvs/ports/audio/py-ao/Makefile,v
retrieving revision 1.9
diff -u -p -r1.9 Makefile
--- Makefile    10 Mar 2009 22:21:48 -0000      1.9
+++ Makefile    7 Jun 2010 10:26:43 -0000
@@ -5,7 +5,7 @@ SHARED_ONLY=    Yes
 COMMENT=       Python wrapper module for the ao library
 
 DISTNAME=      pyao-0.82
-PKGNAME=       ${DISTNAME:S/py/py-/}p3
+PKGNAME=       ${DISTNAME:S/py/py-/}p4
 CATEGORIES=    audio
 HOMEPAGE=      http://ekyo.nerim.net/software/pyogg/
 
@@ -29,6 +29,7 @@ do-configure:
        @cd ${WRKSRC} && ${MODPY_BIN} ./config_unix.py --prefix ${PREFIX} 
 
 post-install:
+       @perl -pi -e 's,/usr/bin/python,${MODPY_BIN},g' ${WRKSRC}/test.py
        ${INSTALL_DATA_DIR} ${EXAMPLESDIR}
        ${INSTALL_DATA} ${WRKSRC}/test.py ${EXAMPLESDIR}
 
Index: patches/patch-src_aomodule_c
===================================================================
RCS file: patches/patch-src_aomodule_c
diff -N patches/patch-src_aomodule_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_aomodule_c        7 Jun 2010 10:26:43 -0000
@@ -0,0 +1,67 @@
+$OpenBSD$
+--- src/aomodule.c.orig        Sat May 15 17:27:14 2010
++++ src/aomodule.c     Sat May 15 17:30:51 2010
+@@ -4,7 +4,7 @@
+ static ao_option *
+ dict_to_options(PyObject *dict)
+ {
+-  int pos = 0;
++  Py_ssize_t pos = 0;  
+   PyObject *key, *val;
+   ao_option *head = NULL;
+   int ret;
+@@ -71,7 +71,7 @@ parse_args(PyObject *args, PyObject *kwargs, 
+   
+   *overwrite = 0;
+ 
+-  if(PyArg_ParseTupleAndKeywords(args, kwargs, "s|llllO!sl", 
++  if(PyArg_ParseTupleAndKeywords(args, kwargs, "s|iiiiO!si", 
+                                (char **) driver_name_kwlist,
+                                &driver_name, 
+                                &format->bits, 
+@@ -84,7 +84,7 @@ parse_args(PyObject *args, PyObject *kwargs, 
+     *driver_id = ao_driver_id(driver_name);
+   } else {
+     PyErr_Clear();
+-    if(!(PyArg_ParseTupleAndKeywords(args, kwargs, "i|llllO!sl",
++    if(!(PyArg_ParseTupleAndKeywords(args, kwargs, "i|iiiiO!si",
+                                    (char **) driver_id_kwlist,
+                                    driver_id, 
+                                    &format->bits, 
+@@ -114,6 +114,7 @@ py_ao_new(PyObject *self, PyObject *args, PyObject *kw
+   ao_sample_format sample_format;
+   ao_Object *retobj;
+ 
++  memset(&sample_format, 0, sizeof(sample_format));
+   if (!parse_args(args, kwargs, 
+                 &sample_format, &py_options,
+                 &filename, &driver_id, &overwrite))
+@@ -141,8 +142,9 @@ py_ao_new(PyObject *self, PyObject *args, PyObject *kw
+     return NULL;
+   }
+ 
+-  retobj = (ao_Object *) PyObject_NEW(ao_Object, &ao_Type);
++  retobj = (ao_Object *) PyObject_New(ao_Object, &ao_Type);
+   retobj->dev = dev;
++  retobj->driver_id = driver_id;
+   return (PyObject *) retobj;
+ }
+ 
+@@ -150,7 +152,7 @@ static void
+ py_ao_dealloc(ao_Object *self)
+ {
+   ao_close(self->dev);
+-  PyMem_DEL(self);
++  PyObject_Del(self);
+ }
+ 
+ static PyObject *
+@@ -184,7 +186,7 @@ py_ao_driver_info(PyObject *self, PyObject *args)
+ 
+     /* It's a method */
+     ao_Object *ao_self = (ao_Object *) self;
+-    info = ao_driver_info(ao_self->dev->driver_id);
++    info = ao_driver_info(ao_self->driver_id);
+ 
+   } else {
+ 
Index: patches/patch-src_aomodule_h
===================================================================
RCS file: patches/patch-src_aomodule_h
diff -N patches/patch-src_aomodule_h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_aomodule_h        7 Jun 2010 10:26:43 -0000
@@ -0,0 +1,11 @@
+$OpenBSD$
+--- src/aomodule.h.orig        Sat May 15 17:31:01 2010
++++ src/aomodule.h     Sat May 15 17:31:28 2010
+@@ -9,6 +9,7 @@
+ typedef struct {
+   PyObject_HEAD
+   ao_device *dev;
++  uint32_t driver_id;
+ } ao_Object;
+ 
+ static PyObject *Py_aoError;
Index: pkg/PLIST
===================================================================
RCS file: /cvs/ports/audio/py-ao/pkg/PLIST,v
retrieving revision 1.2
diff -u -p -r1.2 PLIST
--- pkg/PLIST   14 Sep 2004 23:16:55 -0000      1.2
+++ pkg/PLIST   7 Jun 2010 10:26:43 -0000
@@ -1,4 +1,5 @@
 @comment $OpenBSD: PLIST,v 1.2 2004/09/14 23:16:55 espie Exp $
 lib/python${MODPY_VERSION}/site-packages/aomodule.so
+lib/python${MODPY_VERSION}/site-packages/pyao-0.82-py${MODPY_VERSION}.egg-info
 share/examples/py-ao/
 share/examples/py-ao/test.py

Reply via email to