diff -Nru python-pyalsa-1.1.6/debian/changelog python-pyalsa-1.2.7/debian/changelog --- python-pyalsa-1.1.6/debian/changelog 2022-03-17 14:05:28.000000000 +0000 +++ python-pyalsa-1.2.7/debian/changelog 2022-06-30 19:41:47.000000000 +0000 @@ -1,8 +1,15 @@ -python-pyalsa (1.1.6-3build1) jammy; urgency=medium +python-pyalsa (1.2.7-1) unstable; urgency=medium - * No-change rebuild with Python 3.10 only. + * Team upload + * Update watch file to new URL and check package signature + * New upstream version (Closes: #938965) + * Bump standard version to 4.6.1.0 + * Fix spelling errors + * Add Rules-Requires-Root: no + * Set hardening flags. + * Write Dep5 copyright - -- Matthias Klose Thu, 17 Mar 2022 15:05:28 +0100 + -- Francois Mazen Thu, 30 Jun 2022 21:41:47 +0200 python-pyalsa (1.1.6-3) unstable; urgency=medium diff -Nru python-pyalsa-1.1.6/debian/control python-pyalsa-1.2.7/debian/control --- python-pyalsa-1.1.6/debian/control 2021-11-20 02:38:05.000000000 +0000 +++ python-pyalsa-1.2.7/debian/control 2022-06-30 19:41:47.000000000 +0000 @@ -8,10 +8,11 @@ python3-all-dev, dh-python, libasound2-dev -Standards-Version: 4.1.4 +Standards-Version: 4.6.1.0 Homepage: http://www.alsa-project.org/main/index.php/Main_Page Vcs-Git: https://salsa.debian.org/python-team/packages/python-pyalsa.git Vcs-Browser: https://salsa.debian.org/python-team/packages/python-pyalsa +Rules-Requires-Root: no Package: python3-pyalsa Architecture: any diff -Nru python-pyalsa-1.1.6/debian/copyright python-pyalsa-1.2.7/debian/copyright --- python-pyalsa-1.1.6/debian/copyright 2021-11-20 02:38:05.000000000 +0000 +++ python-pyalsa-1.2.7/debian/copyright 2022-06-30 19:41:47.000000000 +0000 @@ -1,58 +1,52 @@ -This work was packaged for Debian by: - - TANIGUCHI Takaki on Mon, 15 Nov 2010 16:36:54 +0900 - -It was downloaded from: - - http://www.alsa-project.org/main/index.php/Main_Page - -Upstream Author: - - The ALSA Team - -Copyright: - - Copyright (c) 2007 by Jaroslav Kysela - Copyright (c) 2008 by Aldrin Martoq - -License: - - This package is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This package is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -On Debian systems, the complete text of the GNU Lesser General -Public License can be found in "/usr/share/common-licenses/LGPL-2". - -The Debian packaging is: - - Copyright (C) 2010 TANIGUCHI Takaki - -and is licensed under the GPL version 3, -see "/usr/share/common-licenses/GPL-3". - -util2/*: GPL2+ - -utils/aconnect.py: - Copyright (C) 2008 Aldrin Martoq - Copyright (C) 1999 Takashi Iwai - -utils/aplaymidi.py: - Copyright (C) 2008 Aldrin Martoq - Copyright (C) 2004-2006 Clemens Ladisch - -utils/aseqdump.py: - Copyright (C) 2008 Aldrin Martoq - Copyright (C) 2005 Clemens Ladisch - -test/seqtest*: - public domain +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: pyalsa +Upstream-Contact: The ALSA Team +Source: https://www.alsa-project.org/wiki/Download + +Files: * +Copyright: 2007 Jaroslav Kysela + 2008 Aldrin Martoq + 2009-2022 The ALSA Team +License: LGPL-2.0+ + +Files: utils/aconnect.py +Copyright: 1999 Takashi Iwai + 2008 Aldrin Martoq +License: GPL-2.0+ + +Files: utils/aplaymidi.py +Copyright: 2004-2006 Clemens Ladisch + 2008 Aldrin Martoq +License: GPL-2.0+ + +Files: utils/aseqdump.py +Copyright: 2005 Clemens Ladisch + 2008 Aldrin Martoq +License: GPL-2.0+ + +Files: test/seqtest* +Copyright: 2008 Aldrin Martoq +License: public-domain + +Files: debian/* +Copyright: 2010-2018 Takaki Taniguchi + 2018-2022 Debian Python Team +License: GPL-3.0 + +License: LGPL-2.0+ + On Debian systems, the complete text of the GNU Lesser General + Public License can be found in "/usr/share/common-licenses/LGPL-2". + +License: GPL-2.0+ + On Debian systems, the complete text of the GNU General + Public License version 2 can be found in + "/usr/share/common-licenses/GPL-2". + +License: GPL-3.0 + On Debian systems, the complete text of the GNU General + Public License version 3 can be found in + "/usr/share/common-licenses/GPL-3". + +License: public-domain + No license required for any purpose; + the work is not subject to copyright in any jurisdiction. diff -Nru python-pyalsa-1.1.6/debian/patches/fix_spelling_errors.patch python-pyalsa-1.2.7/debian/patches/fix_spelling_errors.patch --- python-pyalsa-1.1.6/debian/patches/fix_spelling_errors.patch 1970-01-01 00:00:00.000000000 +0000 +++ python-pyalsa-1.2.7/debian/patches/fix_spelling_errors.patch 2022-06-30 19:41:47.000000000 +0000 @@ -0,0 +1,69 @@ +Author: Francois Mazen +Description: fix spelling errors +Forwarded: not-needed + +--- a/pyalsa/alsaseq.c ++++ b/pyalsa/alsaseq.c +@@ -322,7 +322,7 @@ + " >>> print event.dest\n" + " (0, 0)\n" + "\n" +- "For b), you can get the name of the constant by calling the appropiate\n" ++ "For b), you can get the name of the constant by calling the appropriate\n" + "method (__str__ or __repr__). Example:\n" + " >>> print str(event.queue), repr(event.queue)\n" + " SEQ_QUEUE_DIRECT SEQ_QUEUE_DIRECT(0xfd)\n" +@@ -892,7 +892,7 @@ + "\n" + "Tuple representing the send source address of this alsaseq.SeqEvent.\n" + "The tuple is (client_id, port_id). If the client or port id are known,\n" +- "the appropiate constant may be used, otherwise integers are expected." ++ "the appropriate constant may be used, otherwise integers are expected." + ); + + /** alsaseq.SeqEvent source attribute: tp_getset getter() */ +@@ -941,7 +941,7 @@ + "\n" + "Tuple representing the destination address of this alsaseq.SeqEvent.\n" + "The tuple is (client_id, port_id). If the client or port id are known,\n" +- "the appropiate constant may be used, otherwise integers are expected." ++ "the appropriate constant may be used, otherwise integers are expected." + ); + + /** alsaseq.SeqEvent dest attribute: tp_getset getter() */ +@@ -1845,7 +1845,7 @@ + "from the given dictionary.\n" + "\n" + "The dictionary items should be the same as described in the get_data() \n" +- "method and be the appropiate for this SeqEvent type.\n" ++ "method and be the appropriate for this SeqEvent type.\n" + "\n" + "This method does not check if a given structure correspond to is valid \n" + "for this SeqEvent type; so setting the 'control.param' or the 'ext' \n" +@@ -2106,7 +2106,7 @@ + PyDoc_STRVAR(Sequencer_streams__doc__, + "streams -> Constant object\n" + "\n" +- "The streams of this alsaseq.Sequencer. Posible values:\n" ++ "The streams of this alsaseq.Sequencer. Possible values:\n" + "alsaseq.SEQ_OPEN_OUTPUT, alsaseq.SEQ_OPEN_INPUT, \n" + "alsaseq.SEQ_OPEN_DUPLEX.\n" + "Note: read-only attribute." +@@ -2233,7 +2233,7 @@ + " name -- name of the port\n" + " type -- type of port (use one of the alsaseq.SEQ_PORT_TYPE_*\n" + " constants)\n" +- " caps -- capabilites of the port (use bitwise alsaseq.SEQ_PORT_CAP_*\n" ++ " caps -- capabilities of the port (use bitwise alsaseq.SEQ_PORT_CAP_*\n" + " constants). Default=0\n" + "Returns:\n" + " the port id.\n" +@@ -2691,7 +2691,7 @@ + "Receive events.\n" + "\n" + "Parameters:\n" +- " timeout -- (int) time for wating for events in miliseconds\n" ++ " timeout -- (int) time for wating for events in milliseconds\n" + " maxevents -- (int) max events to be returned\n" + "Returns:\n" + " (list) a list of alsaseq.SeqEvent objects\n" diff -Nru python-pyalsa-1.1.6/debian/patches/python-3.10.patch python-pyalsa-1.2.7/debian/patches/python-3.10.patch --- python-pyalsa-1.1.6/debian/patches/python-3.10.patch 2021-11-20 02:38:05.000000000 +0000 +++ python-pyalsa-1.2.7/debian/patches/python-3.10.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,48 +0,0 @@ -From: Jaroslav Kysela -Date: Fri, 19 Nov 2021 22:33:11 -0400 -Subject: Fix PyTuple_SET_ITEM() usage - no return value - -As noted in bpo-30459 (link bellow) the PyTuple_SET_ITEM() macro -has not a return value. Let's make code compatible with python 3.10. - -Link: https://bugs.python.org/issue30459 -BugLink: #2 -Signed-off-by: Jaroslav Kysela - -Origin: upstream, https://github.com/alsa-project/alsa-python/commit/5ea2f8709b4d091700750661231f8a3ddce0fc7c -Bug-Debian: https://bugs.debian.org/999385 ---- - pyalsa/alsahcontrol.c | 4 ++-- - pyalsa/alsamixer.c | 4 ++-- - 2 files changed, 4 insertions(+), 4 deletions(-) - -diff --git a/pyalsa/alsahcontrol.c b/pyalsa/alsahcontrol.c -index ebee1b7..7c9321f 100644 ---- a/pyalsa/alsahcontrol.c -+++ b/pyalsa/alsahcontrol.c -@@ -1543,8 +1543,8 @@ static int element_callback(snd_hctl_elem_t *elem, unsigned int mask) - - t = PyTuple_New(2); - if (t) { -- if (PyTuple_SET_ITEM(t, 0, (PyObject *)pyhelem)) -- Py_INCREF(pyhelem); -+ PyTuple_SET_ITEM(t, 0, (PyObject *)pyhelem); -+ Py_INCREF(pyhelem); - PyTuple_SET_ITEM(t, 1, PyInt_FromLong(mask)); - r = PyObject_CallObject(o, t); - Py_DECREF(t); -diff --git a/pyalsa/alsamixer.c b/pyalsa/alsamixer.c -index 39d7387..91fe198 100644 ---- a/pyalsa/alsamixer.c -+++ b/pyalsa/alsamixer.c -@@ -1348,8 +1348,8 @@ static int element_callback(snd_mixer_elem_t *elem, unsigned int mask) - - t = PyTuple_New(2); - if (t) { -- if (PyTuple_SET_ITEM(t, 0, (PyObject *)pyelem)) -- Py_INCREF(pyelem); -+ PyTuple_SET_ITEM(t, 0, (PyObject *)pyelem); -+ Py_INCREF(pyelem); - PyTuple_SET_ITEM(t, 1, PyInt_FromLong(mask)); - r = PyObject_CallObject(o, t); - Py_DECREF(t); diff -Nru python-pyalsa-1.1.6/debian/patches/series python-pyalsa-1.2.7/debian/patches/series --- python-pyalsa-1.1.6/debian/patches/series 2021-11-20 02:38:05.000000000 +0000 +++ python-pyalsa-1.2.7/debian/patches/series 2022-06-30 19:41:47.000000000 +0000 @@ -1 +1 @@ -python-3.10.patch +fix_spelling_errors.patch diff -Nru python-pyalsa-1.1.6/debian/rules python-pyalsa-1.2.7/debian/rules --- python-pyalsa-1.1.6/debian/rules 2021-11-20 02:38:05.000000000 +0000 +++ python-pyalsa-1.2.7/debian/rules 2022-06-30 19:41:47.000000000 +0000 @@ -1,6 +1,7 @@ #!/usr/bin/make -f export PYBUILD_NAME=pyalsa +export DEB_BUILD_MAINT_OPTIONS = hardening=+all %: dh $@ --with python3 --buildsystem=pybuild diff -Nru python-pyalsa-1.1.6/debian/upstream/signing-key.asc python-pyalsa-1.2.7/debian/upstream/signing-key.asc --- python-pyalsa-1.1.6/debian/upstream/signing-key.asc 1970-01-01 00:00:00.000000000 +0000 +++ python-pyalsa-1.2.7/debian/upstream/signing-key.asc 2022-06-30 19:41:47.000000000 +0000 @@ -0,0 +1,29 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- + +mQINBF+PBUIBEACQ0eLhY6zJkZCztI3Zj7GiEkGyDYXFr10wMn2BmAxXEOhvGs5C +XtZYokNnYnojU2ehb14pdQiIYVm7YwjNjPhFmc6DnSJ74tlDtzI0ZfZYgU8B3/AU +hHCIe7NeH+uqaS4hQ4gQF3HB19GNQ21keQPtm/cZzNvkAwWQ6wxiIas/odQGt6sg +TULub4gXQw42iCW0jNeliNgeOc/4/2qtznN+Ss5G+Hs+EBh0kFCG4+5RcpgtKmYO +LEy+8qI/UmlgOeT+47eTXm4LjxHfRuKcbvSExfICUB5XLD2ZmeZbFyP48jkDvB7w +A4jNfImtlRfTvoviNlOl08Pk3aJoPR8IZIGw+EQCf3ChXTziadqOg37SAy4yGJ14 +BjirKgBNO4zB+lkLOAknsVKJOKRt3w54MevCuj0GGbfSyErZAeHvliXrfBa1ACLu +c2ynRDR/5j0FA3vPzRsHyOGFC4F34W5BhkXCuJBG2o2VDv/zANzjg/hw+0IbmH3G +kYn73EDIaz5giKJolE32WaWkz39DwuuoUaLLyfxyiN+c0p2/XQFCrOSqHNUMfI5z +Ll62nL1XruF6u9ApLKRv/uDJN7tLgds83rteYJP7/5/JSYCPB8PcUkmhB8OoVdpr +tYI8C/6Y6KREm3Jk4AdkySIFnPXZQCkiOR2qOmAuaQPeesjsrSkUtJYZcwARAQAB +tEVBTFNBIFJlbGVhc2UgVGVhbSAoUGFja2FnZSBTaWduaW5nIEtleSB2MSkgPHJl +bGVhc2VAYWxzYS1wcm9qZWN0Lm9yZz6JAk4EEwEIADgWIQTwTfUHN6waiExLPXGD +gFltpuWckQUCX48FQgIbAwULCQgHAgYVCgkICwIEFgIDAQIeAQIXgAAKCRCDgFlt +puWckRhVD/45DNoD79lHBJEu0Wv93OSlPZDUKR+BnkkdEDgDEhTvk+Bin/EWdb3g +Unc+rEczgAqjqblLH7ndBtFZPNGiQ2nu8eAdN0TrOFQx7bFg4Do7KXNUUqdPUETC +AgkozF3ucsgOcBbv6LwwDfdQDFjkg7CuNGy8CRcLSO5dLK7domq3RxF5mKl1dkOv +4brfw6ssn+pja/jkgM9BKt80ycIDiJtVRuXMBJD19ZB8EzQO9OQBdAPERSG8BwLX +LemTLAZqNd0mixVbn50qCQil64UOkOd5DHVBBokxgtlJEcDujqWaCUYSygSiP2ke +44ArDr7hRwG5KhhbFOigXo3nBYnKyiuWs0jpnrTQD9+uTxcetyBpJ6BW/i/Fy2a9 +NBFNhbDI07rCMXM25cLP8qbI5i6nTSDlkpLP40At9yUVYt8gIO6ZpGpO04/lAhT1 +NxtbZkKMo1nphMHU/MDSusoHyLxUXpppdbXTdMgsuFrXae3gcFDowQbLZqb6ZAJ5 +opX4sDBIdoHDBsI6wCGTV7AAWB8RXWW0RTYMkyIxqixiiB2N2jaau4yHfqv9QWOY +oPcx6ySKqGN0HV50PeRis5eeq7kHIdRrVIOBd0tPIqCKIvyJZk1QXReKvvE84Km2 +dYPusBlhhF7/4WVovlE6HFwyLSOyb32m4qf5dV35op07ew8i4DHpkQ== +=n4lM +-----END PGP PUBLIC KEY BLOCK----- diff -Nru python-pyalsa-1.1.6/debian/watch python-pyalsa-1.2.7/debian/watch --- python-pyalsa-1.1.6/debian/watch 2021-11-20 02:38:05.000000000 +0000 +++ python-pyalsa-1.2.7/debian/watch 2022-06-30 19:41:47.000000000 +0000 @@ -1,2 +1,3 @@ -version=3 -ftp://ftp.alsa-project.org/pub/pyalsa/pyalsa-(.*)\.tar\.bz2 +version=4 +opts=pgpsigurlmangle=s/$/.sig/ \ +https://www.alsa-project.org/files/pub/pyalsa/pyalsa-(.*)\.tar\.bz2 diff -Nru python-pyalsa-1.1.6/MANIFEST.in python-pyalsa-1.2.7/MANIFEST.in --- python-pyalsa-1.1.6/MANIFEST.in 1970-01-01 00:00:00.000000000 +0000 +++ python-pyalsa-1.2.7/MANIFEST.in 2022-05-31 14:25:37.000000000 +0000 @@ -0,0 +1,3 @@ +include pyalsa/*.h +include test/*.py +include utils/*.py diff -Nru python-pyalsa-1.1.6/PKG-INFO python-pyalsa-1.2.7/PKG-INFO --- python-pyalsa-1.1.6/PKG-INFO 2018-04-03 16:47:19.000000000 +0000 +++ python-pyalsa-1.2.7/PKG-INFO 2022-05-31 14:54:02.412001800 +0000 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: pyalsa -Version: 1.1.6 +Version: 1.2.7 Summary: Python binding for the ALSA library. Home-page: http://www.alsa-project.org Author: The ALSA Team diff -Nru python-pyalsa-1.1.6/pyalsa/alsahcontrol.c python-pyalsa-1.2.7/pyalsa/alsahcontrol.c --- python-pyalsa-1.1.6/pyalsa/alsahcontrol.c 2018-04-03 16:45:38.000000000 +0000 +++ python-pyalsa-1.2.7/pyalsa/alsahcontrol.c 2022-05-31 14:25:37.000000000 +0000 @@ -621,7 +621,7 @@ pyalsahcontrolelement_dealloc(struct pyalsahcontrolelement *self) { if (self->elem) { - Py_DECREF(self->callback); + Py_XDECREF(self->callback); snd_hctl_elem_set_callback(self->elem, NULL); } Py_XDECREF(self->pyhandle); @@ -1543,8 +1543,8 @@ t = PyTuple_New(2); if (t) { - if (PyTuple_SET_ITEM(t, 0, (PyObject *)pyhelem)) - Py_INCREF(pyhelem); + PyTuple_SET_ITEM(t, 0, (PyObject *)pyhelem); + Py_INCREF(pyhelem); PyTuple_SET_ITEM(t, 1, PyInt_FromLong(mask)); r = PyObject_CallObject(o, t); Py_DECREF(t); diff -Nru python-pyalsa-1.1.6/pyalsa/alsamixer.c python-pyalsa-1.2.7/pyalsa/alsamixer.c --- python-pyalsa-1.1.6/pyalsa/alsamixer.c 2018-04-03 16:45:38.000000000 +0000 +++ python-pyalsa-1.2.7/pyalsa/alsamixer.c 2022-05-31 14:25:37.000000000 +0000 @@ -1348,8 +1348,8 @@ t = PyTuple_New(2); if (t) { - if (PyTuple_SET_ITEM(t, 0, (PyObject *)pyelem)) - Py_INCREF(pyelem); + PyTuple_SET_ITEM(t, 0, (PyObject *)pyelem); + Py_INCREF(pyelem); PyTuple_SET_ITEM(t, 1, PyInt_FromLong(mask)); r = PyObject_CallObject(o, t); Py_DECREF(t); diff -Nru python-pyalsa-1.1.6/pyalsa/alsaseq.c python-pyalsa-1.2.7/pyalsa/alsaseq.c --- python-pyalsa-1.1.6/pyalsa/alsaseq.c 2018-04-03 16:45:38.000000000 +0000 +++ python-pyalsa-1.2.7/pyalsa/alsaseq.c 2022-05-31 14:25:37.000000000 +0000 @@ -51,9 +51,6 @@ /* the C variable of a constant dict */ #define TDICT(subtype) _dictPYALSASEQ_CONST_##subtype -/* the C enumeration of a constant dict */ -#define TTYPE(subtype) PYALSASEQ_CONST_##subtype - /* defines constant dict by type */ #define TCONSTDICT(subtype) \ static PyObject * TDICT(subtype); @@ -71,7 +68,7 @@ /* creates a typed constant and add it to the module and dictionary */ #define TCONSTADD(module, subtype, name) { \ PyObject *tmp = \ - Constant_create(#name, SND_##name, TTYPE(subtype)); \ + Constant_create(#name, SND_##name); \ if (tmp == NULL) { \ return MOD_ERROR_VAL; \ } \ @@ -109,46 +106,6 @@ } \ } - -/* num protocol support for binary Constant operations */ -#define NUMPROTOCOL2(name, oper) \ - static PyObject * \ - Constant_##name (PyObject *v, PyObject *w) { \ - int type = 0; \ - long val1, val2, val; \ - if (get_long1(v, &val1) || get_long1(w, &val2)) { \ - Py_INCREF(Py_NotImplemented); \ - return Py_NotImplemented; \ - } \ - val = val1 oper val2; \ - /* always asume left will be the type */ \ - if (PyObject_TypeCheck(v, &ConstantType)) { \ - type = ((ConstantObject *) v)->type; \ - } else if (PyObject_TypeCheck(w, &ConstantType)) { \ - type = ((ConstantObject *) w)->type; \ - } \ - PyObject *self = Constant_create(#oper, val, type); \ - return self; \ - } - -/* num protocol support for unary Constant operations */ -#define NUMPROTOCOL1(name, oper) \ - static PyObject * \ - Constant_##name (PyObject *v) { \ - int type = 0; \ - long val1, val; \ - if (get_long1(v, &val1)) { \ - Py_INCREF(Py_NotImplemented); \ - return Py_NotImplemented; \ - } \ - val = oper val1; \ - if (PyObject_TypeCheck(v, &ConstantType)) { \ - type = ((ConstantObject *) v)->type; \ - } \ - PyObject *self = Constant_create(#oper, val, type); \ - return self; \ - } - /* sets the object into the dict */ #define SETDICTOBJ(name, object) \ PyDict_SetItemString(dict, name, object) @@ -294,6 +251,13 @@ int len = PyList_Size(list); \ self->event->data.ext.len = len; \ if (len > 0) { \ + self->buff = malloc(len); \ + if (self->buff == NULL) { \ + PyErr_SetString(PyExc_TypeError, \ + name " no memory"); \ + self->event->data.ext.len = 0; \ + return NULL; \ + } \ int i; \ long val; \ for (i = 0; i < len; i++) { \ @@ -302,18 +266,12 @@ PyErr_SetString(PyExc_TypeError, \ name " must be a list of integers"); \ self->event->data.ext.len = 0; \ - return NULL; \ + free(self->buff); \ + self->buff = NULL; \ + return NULL; \ } \ - } \ - self->buff = malloc(len); \ - if (self->buff == NULL) { \ - PyErr_SetString(PyExc_TypeError, \ - name " no memory"); \ - self->event->data.ext.len = 0; \ - return NULL; \ - } \ - for (i = 0; i < len; i++) \ self->buff[i] = val; \ + } \ self->event->data.ext.ptr = self->buff; \ } \ } \ @@ -328,21 +286,6 @@ // alsaseq.Constant implementation ////////////////////////////////////////////////////////////////////////////// -/* alsaseq.Constant->type enumeration */ -enum { - PYALSASEQ_CONST_STREAMS, - PYALSASEQ_CONST_MODE, - PYALSASEQ_CONST_QUEUE, - PYALSASEQ_CONST_CLIENT_TYPE, - PYALSASEQ_CONST_PORT_CAP, - PYALSASEQ_CONST_PORT_TYPE, - PYALSASEQ_CONST_EVENT_TYPE, - PYALSASEQ_CONST_EVENT_TIMESTAMP, - PYALSASEQ_CONST_EVENT_TIMEMODE, - PYALSASEQ_CONST_ADDR_CLIENT, - PYALSASEQ_CONST_ADDR_PORT, -}; - // constants dictionaries TCONSTDICT(STREAMS); @@ -390,34 +333,66 @@ "Python number protocol." ); -/** alsaseq.Constant object structure type */ +/** alsaseq.Constant additional fields */ +/* This follows the variable length portion of the Long type */ typedef struct { - PyObject_HEAD - ; - - /* value of constant */ - unsigned long int value; /* name of constant */ const char *name; - /* type of constant */ - int type; +} ConstantExtraFields; + +/** alsaseq.Constant object structure type */ +typedef struct { +#if PY_MAJOR_VERSION < 3 + PyIntObject base; +#else + /* NOTE: this only works if the value fits in one digit */ + PyLongObject base; +#endif + /* This field is actually offset by the base type's variable size portion */ + ConstantExtraFields extra; } ConstantObject; +#if PY_MAJOR_VERSION < 3 +/* PyInt is fixed size in Python 2 */ +# define CONST_VALUE(x) PyInt_AsLong((PyObject *)x) +# define CONST_EXTRA(x) (&(x->extra)) +#else +/* PyLong is variable size in Python 3 */ +# define CONST_VALUE(x) PyLong_AsLong((PyObject *)x) +# define CONST_EXTRA(x) \ + ((ConstantExtraFields *)( \ + ((intptr_t)(&x->extra)) \ + + abs(Py_SIZE(&x->base)) * Py_TYPE(x)->tp_itemsize \ + )) +#endif + /** alsaseq.Constant type (initialized later...) */ static PyTypeObject ConstantType; /** alsaseq.Constant internal create */ static PyObject * -Constant_create(const char *name, long value, int type) { - ConstantObject *self = PyObject_New(ConstantObject, &ConstantType); +Constant_create(const char *name, long value) { +#if PY_MAJOR_VERSION < 3 + PyObject *val = PyInt_FromLong(value); +#else + PyObject *val = PyLong_FromLong(value); +#endif + + PyObject *args = PyTuple_Pack(1, val); + Py_DECREF(val); + +#if PY_MAJOR_VERSION < 3 + ConstantObject *self = (ConstantObject *)PyInt_Type.tp_new(&ConstantType, args, NULL); +#else + ConstantObject *self = (ConstantObject *)PyLong_Type.tp_new(&ConstantType, args, NULL); +#endif + Py_DECREF(args); if (self == NULL) { return NULL; } - self->value = value; - self->name = name; - self->type = type; + CONST_EXTRA(self)->name = name; return (PyObject *)self; } @@ -426,35 +401,17 @@ static PyObject * Constant_repr(ConstantObject *self) { return PyUnicode_FromFormat("%s(0x%x)", - self->name, - (unsigned int)self->value); + CONST_EXTRA(self)->name, + (unsigned int)CONST_VALUE(self)); } /** alsaseq.Constant tp_str */ static PyObject * Constant_str(ConstantObject *self) { return PyUnicode_FromFormat("%s", - self->name); + CONST_EXTRA(self)->name); } -/** alsaseq.Constant Number protocol support (note: not all ops supported) */ -NUMPROTOCOL2(Add, +) -NUMPROTOCOL2(Subtract, -) -NUMPROTOCOL2(Xor, ^) -NUMPROTOCOL2(Or, |) -NUMPROTOCOL2(And, &) -NUMPROTOCOL1(Invert, ~) - -/** alsaseq.Constant number protocol methods */ -static PyNumberMethods Constant_as_number = { - nb_add: (binaryfunc)Constant_Add, - nb_subtract: (binaryfunc)Constant_Subtract, - nb_xor: (binaryfunc)Constant_Xor, - nb_or: (binaryfunc)Constant_Or, - nb_and: (binaryfunc)Constant_And, - nb_invert: (unaryfunc)Constant_Invert -}; - /** alsaseq.Constant type */ static PyTypeObject ConstantType = { PyVarObject_HEAD_INIT(NULL, 0) @@ -464,7 +421,7 @@ #else tp_base: &PyLong_Type, #endif - tp_basicsize: sizeof(ConstantObject), + tp_basicsize: sizeof(ConstantObject) + sizeof(ConstantExtraFields), tp_flags: #if PY_MAJOR_VERSION < 3 Py_TPFLAGS_HAVE_GETCHARBUFFER @@ -474,7 +431,6 @@ 0, #endif tp_doc: Constant__doc__, - tp_as_number: &Constant_as_number, tp_free: PyObject_Del, tp_str: (reprfunc)Constant_str, tp_repr: (reprfunc)Constant_repr @@ -1722,16 +1678,11 @@ static PyObject * SeqEvent_repr(SeqEventObject *self) { PyObject *key = PyInt_FromLong(self->event->type); - ConstantObject *constObject = (ConstantObject *) - PyDict_GetItem(TDICT(EVENT_TYPE), key); - const char *typestr = "UNKNOWN"; + ConstantObject *typeObject = (ConstantObject *)PyDict_GetItem(TDICT(EVENT_TYPE), key); const char *timemode = ""; unsigned int dtime = 0; unsigned int ntime = 0; Py_DECREF(key); - if (constObject != NULL) { - typestr = constObject->name; - } if (snd_seq_ev_is_real(self->event)) { timemode = "real"; @@ -1742,17 +1693,18 @@ dtime = self->event->time.tick; } - return PyUnicode_FromFormat("", - typestr, + typeObject, self->event->type, self->event->flags, self->event->tag, self->event->queue, timemode, dtime, ntime, (self->event->source).client, (self->event->source).port, (self->event->dest).client, - (self->event->dest).port, self); + (self->event->dest).port, + self); } /** alsaseq.SeqEvent get_data() method: __doc__ */ diff -Nru python-pyalsa-1.1.6/pyalsa/common.h python-pyalsa-1.2.7/pyalsa/common.h --- python-pyalsa-1.1.6/pyalsa/common.h 2018-04-03 16:45:38.000000000 +0000 +++ python-pyalsa-1.2.7/pyalsa/common.h 2022-05-31 14:25:37.000000000 +0000 @@ -22,6 +22,8 @@ #ifndef __PYALSA_COMMON_H #define __PYALSA_COMMON_H +#define PY_SSIZE_T_CLEAN + #include "Python.h" #include "structmember.h" #include "frameobject.h" diff -Nru python-pyalsa-1.1.6/pyalsa.egg-info/dependency_links.txt python-pyalsa-1.2.7/pyalsa.egg-info/dependency_links.txt --- python-pyalsa-1.1.6/pyalsa.egg-info/dependency_links.txt 1970-01-01 00:00:00.000000000 +0000 +++ python-pyalsa-1.2.7/pyalsa.egg-info/dependency_links.txt 2022-05-31 14:54:02.000000000 +0000 @@ -0,0 +1 @@ + diff -Nru python-pyalsa-1.1.6/pyalsa.egg-info/PKG-INFO python-pyalsa-1.2.7/pyalsa.egg-info/PKG-INFO --- python-pyalsa-1.1.6/pyalsa.egg-info/PKG-INFO 1970-01-01 00:00:00.000000000 +0000 +++ python-pyalsa-1.2.7/pyalsa.egg-info/PKG-INFO 2022-05-31 14:54:02.000000000 +0000 @@ -0,0 +1,11 @@ +Metadata-Version: 1.1 +Name: pyalsa +Version: 1.2.7 +Summary: Python binding for the ALSA library. +Home-page: http://www.alsa-project.org +Author: The ALSA Team +Author-email: alsa-devel@alsa-project.org +License: LGPLv2+ +Download-URL: ftp://ftp.alsa-project.org/pub/pyalsa/ +Description: UNKNOWN +Platform: UNKNOWN diff -Nru python-pyalsa-1.1.6/pyalsa.egg-info/SOURCES.txt python-pyalsa-1.2.7/pyalsa.egg-info/SOURCES.txt --- python-pyalsa-1.1.6/pyalsa.egg-info/SOURCES.txt 1970-01-01 00:00:00.000000000 +0000 +++ python-pyalsa-1.2.7/pyalsa.egg-info/SOURCES.txt 2022-05-31 14:54:02.000000000 +0000 @@ -0,0 +1,27 @@ +MANIFEST.in +setup.py +pyalsa/__init__.py +pyalsa/alsacard.c +pyalsa/alsacontrol.c +pyalsa/alsahcontrol.c +pyalsa/alsamixer.c +pyalsa/alsaseq.c +pyalsa/common.h +pyalsa.egg-info/PKG-INFO +pyalsa.egg-info/SOURCES.txt +pyalsa.egg-info/dependency_links.txt +pyalsa.egg-info/top_level.txt +test/alsamemdebug.py +test/cardtest1.py +test/ctltest1.py +test/hctltest1.py +test/hctltest2.py +test/mixertest1.py +test/mixertest2.py +test/seqtest1.py +test/seqtest2.py +test/seqtest3.py +utils/aconnect.py +utils/aplaymidi.py +utils/aseqdump.py +utils/remove-user-ctl.py \ No newline at end of file diff -Nru python-pyalsa-1.1.6/pyalsa.egg-info/top_level.txt python-pyalsa-1.2.7/pyalsa.egg-info/top_level.txt --- python-pyalsa-1.1.6/pyalsa.egg-info/top_level.txt 1970-01-01 00:00:00.000000000 +0000 +++ python-pyalsa-1.2.7/pyalsa.egg-info/top_level.txt 2022-05-31 14:54:02.000000000 +0000 @@ -0,0 +1 @@ +pyalsa diff -Nru python-pyalsa-1.1.6/setup.cfg python-pyalsa-1.2.7/setup.cfg --- python-pyalsa-1.1.6/setup.cfg 1970-01-01 00:00:00.000000000 +0000 +++ python-pyalsa-1.2.7/setup.cfg 2022-05-31 14:54:02.413001800 +0000 @@ -0,0 +1,4 @@ +[egg_info] +tag_build = +tag_date = 0 + diff -Nru python-pyalsa-1.1.6/setup.py python-pyalsa-1.2.7/setup.py --- python-pyalsa-1.1.6/setup.py 2018-04-03 16:45:38.000000000 +0000 +++ python-pyalsa-1.2.7/setup.py 2022-05-31 14:25:37.000000000 +0000 @@ -9,7 +9,7 @@ except ImportError: from distutils.core import setup, Extension -VERSION='1.1.6' +VERSION='1.2.7' if os.path.exists("version"): fp = open("version", "r") diff -Nru python-pyalsa-1.1.6/test/cardtest1.py python-pyalsa-1.2.7/test/cardtest1.py --- python-pyalsa-1.1.6/test/cardtest1.py 2018-04-03 16:45:38.000000000 +0000 +++ python-pyalsa-1.2.7/test/cardtest1.py 2022-05-31 14:25:37.000000000 +0000 @@ -2,9 +2,9 @@ # -*- Python -*- import sys -sys.path.insert(0, '../pyalsa') +sys.path.insert(0, '..') del sys -import alsacard +from pyalsa import alsacard print('asoundlibVersion:', alsacard.asoundlib_version()) print('cardLoad:', alsacard.card_load(0)) diff -Nru python-pyalsa-1.1.6/test/ctltest1.py python-pyalsa-1.2.7/test/ctltest1.py --- python-pyalsa-1.1.6/test/ctltest1.py 2018-04-03 16:45:38.000000000 +0000 +++ python-pyalsa-1.2.7/test/ctltest1.py 2022-05-31 14:25:37.000000000 +0000 @@ -2,9 +2,9 @@ # -*- Python -*- import sys -sys.path.insert(0, '../pyalsa') +sys.path.insert(0, '..') del sys -import alsacontrol +from pyalsa import alsacontrol ctl = alsacontrol.Control() print('Card info:', ctl.card_info()) diff -Nru python-pyalsa-1.1.6/test/hctltest1.py python-pyalsa-1.2.7/test/hctltest1.py --- python-pyalsa-1.1.6/test/hctltest1.py 2018-04-03 16:45:38.000000000 +0000 +++ python-pyalsa-1.2.7/test/hctltest1.py 2022-05-31 14:25:37.000000000 +0000 @@ -2,9 +2,9 @@ # -*- Python -*- import sys -sys.path.insert(0, '../pyalsa') +sys.path.insert(0, '..') del sys -import alsahcontrol +from pyalsa import alsahcontrol def info(element): info = alsahcontrol.Info(element) diff -Nru python-pyalsa-1.1.6/test/hctltest2.py python-pyalsa-1.2.7/test/hctltest2.py --- python-pyalsa-1.1.6/test/hctltest2.py 2018-04-03 16:45:38.000000000 +0000 +++ python-pyalsa-1.2.7/test/hctltest2.py 2022-05-31 14:25:37.000000000 +0000 @@ -2,10 +2,10 @@ # -*- Python -*- import sys -sys.path.insert(0, '../pyalsa') +sys.path.insert(0, '..') del sys import select -import alsahcontrol +from pyalsa import alsahcontrol def parse_event_mask(events): if events == 0: diff -Nru python-pyalsa-1.1.6/test/mixertest1.py python-pyalsa-1.2.7/test/mixertest1.py --- python-pyalsa-1.1.6/test/mixertest1.py 2018-04-03 16:45:38.000000000 +0000 +++ python-pyalsa-1.2.7/test/mixertest1.py 2022-05-31 14:25:37.000000000 +0000 @@ -2,10 +2,10 @@ # -*- Python -*- import sys -sys.path.insert(0, '../pyalsa') +sys.path.insert(0, '..') del sys from alsamemdebug import debuginit, debug, debugdone -import alsamixer +from pyalsa import alsamixer def print_elem(e): direction = ["playback", "capture"] diff -Nru python-pyalsa-1.1.6/test/mixertest2.py python-pyalsa-1.2.7/test/mixertest2.py --- python-pyalsa-1.1.6/test/mixertest2.py 2018-04-03 16:45:38.000000000 +0000 +++ python-pyalsa-1.2.7/test/mixertest2.py 2022-05-31 14:25:37.000000000 +0000 @@ -4,7 +4,7 @@ import sys sys.path.insert(0, '../pyalsa') del sys -import alsamixer +from pyalsa import alsamixer import select def parse_event_mask(events): @@ -20,15 +20,15 @@ def event_callback(element, events): - print 'CALLBACK (DEF)! [%s] %s:%i' % (parse_event_mask(events), element.name, element.index) - print ' ', element.get_volume_tuple(), element.get_switch_tuple() + print('CALLBACK (DEF)! [%s] %s:%i' % (parse_event_mask(events), element.name, element.index)) + print(' ', element.get_volume_tuple(), element.get_switch_tuple()) class MyElementEvent: def callback(self, element, events): - print 'CALLBACK (CLASS)! [%s] %s:%i' % (parse_event_mask(events), element.name, element.index) - print ' ', element.get_volume_tuple(), element.get_switch_tuple() + print('CALLBACK (CLASS)! [%s] %s:%i' % (parse_event_mask(events), element.name, element.index)) + print(' ', element.get_volume_tuple(), element.get_switch_tuple()) mixer = alsamixer.Mixer() @@ -44,5 +44,5 @@ mixer.register_poll(poller) while True: poller.poll() - print 'Poll OK!' + print('Poll OK!') mixer.handle_events() diff -Nru python-pyalsa-1.1.6/test/seqtest1.py python-pyalsa-1.2.7/test/seqtest1.py --- python-pyalsa-1.1.6/test/seqtest1.py 2018-04-03 16:45:38.000000000 +0000 +++ python-pyalsa-1.2.7/test/seqtest1.py 2022-05-31 14:25:37.000000000 +0000 @@ -8,20 +8,20 @@ # sequencer application. import sys -sys.path.insert(0, '../pyalsa') +sys.path.insert(0, '..') del sys from alsamemdebug import debuginit, debug, debugdone -import alsaseq +from pyalsa import alsaseq def dump_portinfo(dict): def dl(dict, key): - if dict.has_key(key): + if key in dict: return "'" + str(dict[key]) + "'" return "N/A" def da(dict, key, search): tmp = None - if dict.has_key(key): + if key in dict: for k in search: if k & dict[key]: if tmp == None: @@ -39,151 +39,155 @@ def dump_list(connections, simple=True): for clientports in connections: clientname, clientid, portlist = clientports - print " client: %3d %s" % (clientid, clientname), + print(" client: %3d %s" % (clientid, clientname)) if not simple: clientinfo = sequencer.get_client_info(clientid) - print "\t[%s]" % clientinfo + print("\t[%s]" % clientinfo) else: - print + print() for port in portlist: portname, portid, connections = port - print " port: %3d:%-2d +-%s" % (clientid, portid, portname), + print(" port: %3d:%-2d +-%s" % (clientid, portid, portname)) if not simple: portinfo = sequencer.get_port_info(portid, clientid) - print "\t[%s]" % (dump_portinfo(portinfo)) + print("\t[%s]" % (dump_portinfo(portinfo))) else: - print + print() readconn, writeconn = connections for c,p,i in readconn: if not simple: - print " connection to: %d:%d %s" % (c,p, i) + print(" connection to: %d:%d %s" % (c,p, i)) else: - print " connection to: %d:%d" % (c,p) + print(" connection to: %d:%d" % (c,p)) for c,p,i in writeconn: if not simple: - print " connection to: %d:%d %s" % (c,p, i) + print(" connection to: %d:%d %s" % (c,p, i)) else: - print " connection to: %d:%d" % (c,p) + print(" connection to: %d:%d" % (c,p)) debuginit() -print "01:Creating Sequencer ==============================" +print("01:Creating Sequencer ==============================") sequencer = alsaseq.Sequencer() # other examples: # sequencer = alsaseq.Sequencer("hw", "myfancyapplication", alsaseq.SEQ_OPEN_INPUT, alsaseq.SEQ_BLOCK) # sequencer = alsaseq.Sequencer(clientname='python-test', streams=alsaseq.SEQ_OPEN_OUTPUT) -print " sequencer: %s" % sequencer -print " name: %s" % sequencer.name -print " clientname: %s" % sequencer.clientname -print " streams: %d (%s)" % (sequencer.streams, str(sequencer.streams)) -print " mode: %d (%s)" % (sequencer.mode, str(sequencer.mode)) -print " client_id: %s" % sequencer.client_id -print +print(" sequencer: %s" % sequencer) +print(" name: %s" % sequencer.name) +print(" clientname: %s" % sequencer.clientname) +print(" streams: %d (%s)" % (sequencer.streams, str(sequencer.streams))) +print(" mode: %d (%s)" % (sequencer.mode, str(sequencer.mode))) +print(" client_id: %s" % sequencer.client_id) +print() -print "02:Changing some parameters ========================" +print("02:Changing some parameters ========================") sequencer.clientname = 'pepito' sequencer.mode = alsaseq.SEQ_BLOCK -print " clientname: %s" % sequencer.clientname -print " mode: %d (%s)" % (sequencer.mode, str(sequencer.mode)) -print +print(" clientname: %s" % sequencer.clientname) +print(" mode: %d (%s)" % (sequencer.mode, str(sequencer.mode))) +print() -print "03:Creating simple port ============================" +print("03:Creating simple port ============================") port_id = sequencer.create_simple_port("myport", alsaseq.SEQ_PORT_TYPE_APPLICATION,alsaseq.SEQ_PORT_CAP_WRITE | alsaseq.SEQ_PORT_CAP_SUBS_WRITE) -print " port_id: %s" % port_id -print +print(" port_id: %s" % port_id) +print() -print "04:Getting port info ===============================" +print("04:Getting port info ===============================") port_info = sequencer.get_port_info(port_id) -print " --> %s" % dump_portinfo(port_info) -print " --> %s" % port_info -print +print(" --> %s" % dump_portinfo(port_info)) +print(" --> %s" % port_info) +print() -print "05:Retrieving clients and connections (as list) ====" +print("05:Retrieving clients and connections (as list) ====") connections = sequencer.connection_list() -print " %s" % (connections) -print +print(" %s" % (connections)) +print() -print "06:Retrieving clients and connections (detailed) ===" +print("06:Retrieving clients and connections (detailed) ===") connections = sequencer.connection_list() dump_list(connections, False) -print +print() -print "07:Connecting 'arbitrary' ports... =================" +print("07:Connecting 'arbitrary' ports... =================") source = (alsaseq.SEQ_CLIENT_SYSTEM, alsaseq.SEQ_PORT_SYSTEM_ANNOUNCE) dest = (sequencer.client_id, port_id) -print "%s ---> %s" % (str(source), str(dest)) +print("%s ---> %s" % (str(source), str(dest))) sequencer.connect_ports(source, dest) -print +print() -print "08:Retrieving clients and connections (simple) =====" +print("08:Retrieving clients and connections (simple) =====") connections = sequencer.connection_list() dump_list(connections) -print +print() -print "09:Disconnecting previous 'arbitrary' port =========" -print "%s -X-> %s" % (str(source), str(dest)) +print("09:Disconnecting previous 'arbitrary' port =========") +print("%s -X-> %s" % (str(source), str(dest))) sequencer.disconnect_ports(source, dest) -print +print() -print "10:Retrieving clients and connections (simple) =====" +print("10:Retrieving clients and connections (simple) =====") connections = sequencer.connection_list() dump_list(connections) -print +print() -print "11:Listing known streams constants =================" -print "%s" % alsaseq._dstreams.values() -print +print("11:Listing known streams constants =================") +print("%s" % alsaseq._dstreams.values()) +print() -print "12:Listing known mode constants ====================" -print "%s" % alsaseq._dmode.values() -print +print("12:Listing known mode constants ====================") +print("%s" % alsaseq._dmode.values()) +print() -print "13:Listing known queue constants ===================" -print "%s" % alsaseq._dqueue.values() -print +print("13:Listing known queue constants ===================") +print("%s" % alsaseq._dqueue.values()) +print() -print "14:Listing known client type constants =============" -print "%s" % alsaseq._dclienttype.values() -print +print("14:Listing known client type constants =============") +print("%s" % alsaseq._dclienttype.values()) +print() -print "15:Listing known port caps constants ===============" -print "%s" % alsaseq._dportcap.values() -print +print("15:Listing known port caps constants ===============") +print("%s" % alsaseq._dportcap.values()) +print() -print "16:Listing known port types constants ==============" -print "%s" % alsaseq._dporttype.values() -print +print("16:Listing known port types constants ==============") +print("%s" % alsaseq._dporttype.values()) +print() -print "17:Listing known event type constants ==============" -print "%s" % alsaseq._deventtype.values() -print +print("17:Listing known event type constants ==============") +print("%s" % alsaseq._deventtype.values()) +print() -print "18:Listing known event timestamp constants =========" -print "%s" % alsaseq._deventtimestamp.values() -print +print("18:Listing known event timestamp constants =========") +print("%s" % alsaseq._deventtimestamp.values()) +print() -print "19:Listing known event timemode constants ==========" -print "%s" % alsaseq._deventtimemode.values() -print +print("19:Listing known event timemode constants ==========") +print("%s" % alsaseq._deventtimemode.values()) +print() -print "20:Listing known client addresses constants ========" -print "%s" % alsaseq._dclient.values() -print +print("20:Listing known client addresses constants ========") +print("%s" % alsaseq._dclient.values()) +print() -print "21:Listing known port addresses constants ==========" -print "%s" % alsaseq._dport.values() -print +print("21:Listing known port addresses constants ==========") +print("%s" % alsaseq._dport.values()) +print() +print("22:SeqEvent repr ===================================") +print("%s" % alsaseq.SeqEvent(alsaseq.SEQ_EVENT_NOTEON)) +print() -print "98:Removing sequencer ==============================" + +print("98:Removing sequencer ==============================") debug([sequencer]) del sequencer -print +print() -print "99:Listing sequencer (using new one) ===============" +print("99:Listing sequencer (using new one) ===============") dump_list(alsaseq.Sequencer().connection_list()) -print +print() debugdone() -print "seqtest1.py done." +print("seqtest1.py done.") diff -Nru python-pyalsa-1.1.6/test/seqtest2.py python-pyalsa-1.2.7/test/seqtest2.py --- python-pyalsa-1.1.6/test/seqtest2.py 2018-04-03 16:45:38.000000000 +0000 +++ python-pyalsa-1.2.7/test/seqtest2.py 2022-05-31 14:25:37.000000000 +0000 @@ -8,9 +8,9 @@ # sequencer application. import sys -sys.path.insert(0, '../pyalsa') +sys.path.insert(0, '..') -import alsaseq +from pyalsa import alsaseq import time from alsamemdebug import debuginit, debug, debugdone @@ -19,24 +19,24 @@ seq = alsaseq.Sequencer() def dump(event): - print "event: %s" % event - print " ", + print("event: %s" % event) + print(" ") for attr in alsaseq.SeqEvent.__dict__: if attr.startswith('is_'): t = event.__getattribute__(attr) if t: - print "%s" % attr, - print + print("%s" % attr) + print() data = event.get_data() - print " data=%s" % data + print(" data=%s" % data) -print "sequencer: %s" % seq +print("sequencer: %s" % seq) port_id = seq.create_simple_port('hola', alsaseq.SEQ_PORT_TYPE_APPLICATION, alsaseq.SEQ_PORT_CAP_SUBS_READ | alsaseq.SEQ_PORT_CAP_READ | alsaseq.SEQ_PORT_CAP_WRITE | alsaseq.SEQ_PORT_CAP_SUBS_WRITE ) -print "portid: %d" % port_id +print("portid: %d" % port_id) c=-2 wait = 5000 @@ -45,11 +45,11 @@ if c == -1: src = (alsaseq.SEQ_CLIENT_SYSTEM,alsaseq.SEQ_PORT_SYSTEM_ANNOUNCE) dest = (seq.client_id, port_id) - print 'connecting %s -> %s' % (src, dest) + print('connecting %s -> %s' % (src, dest)) seq.connect_ports(src, dest) if c == 5: break - print 'waiting %s...' % wait + print('waiting %s...' % wait) events = seq.receive_events(wait) for event in events: c = 0 diff -Nru python-pyalsa-1.1.6/test/seqtest3.py python-pyalsa-1.2.7/test/seqtest3.py --- python-pyalsa-1.1.6/test/seqtest3.py 2018-04-03 16:45:38.000000000 +0000 +++ python-pyalsa-1.2.7/test/seqtest3.py 2022-05-31 14:25:37.000000000 +0000 @@ -8,9 +8,9 @@ # sequencer application. import sys -sys.path.insert(0, '../pyalsa') +sys.path.insert(0, '..') -from alsaseq import * +from pyalsa.alsaseq import * import time from alsamemdebug import debuginit, debug, debugdone @@ -28,9 +28,9 @@ type = pinfo['type'] caps = pinfo['capability'] if type & SEQ_PORT_TYPE_MIDI_GENERIC and caps & (SEQ_PORT_CAP_WRITE): - print "Using port: %s:%s" % (cname, pname) + print("Using port: %s:%s" % (cname, pname)) return (cid, pid) - print "No midi port found -- install timidity or other software synth for testing!" + print("No midi port found -- install timidity or other software synth for testing!") sys.exit(0) # create sequencer @@ -43,7 +43,7 @@ queue = seq.create_queue() seq.start_queue(queue) tempo, ppq = seq.queue_tempo(queue) -print "tempo: %d ppq: %d" % (tempo, ppq) +print("tempo: %d ppq: %d" % (tempo, ppq)) # play notes: DO RE MI FA SOL LA notes = [0x40, 0x42, 0x44, 0x45, 0x47, 0x49] @@ -53,7 +53,7 @@ event.queue = queue event.time += ppq event.set_data({'note.note' : note, 'note.velocity' : 64, 'note.duration' : ppq , 'note.off_velocity' : 64}) - print 'event: %s %s' % (event, event.get_data()) + print('event: %s %s' % (event, event.get_data())) seq.output_event(event) seq.drain_output() seq.sync_output_queue()