Skip to content
Snippets Groups Projects
Commit d24de40d authored by Jeremy Bícha's avatar Jeremy Bícha
Browse files

New upstream version 1.2.12

parent 124e8148
No related branches found
No related tags found
No related merge requests found
Metadata-Version: 1.1
Name: pyalsa
Version: 1.2.7
Version: 1.2.12
Summary: Python binding for the ALSA library.
Home-page: http://www.alsa-project.org
Author: The ALSA Team
......
Metadata-Version: 1.1
Name: pyalsa
Version: 1.2.7
Version: 1.2.12
Summary: Python binding for the ALSA library.
Home-page: http://www.alsa-project.org
Author: The ALSA Team
......
......@@ -1520,10 +1520,10 @@ MOD_INIT(alsahcontrol)
static int element_callback(snd_hctl_elem_t *elem, unsigned int mask)
{
PyThreadState *tstate, *origstate;
struct pyalsahcontrolelement *pyhelem;
PyObject *o, *t, *r;
int res = 0, inside = 1;
CALLBACK_VARIABLES;
if (elem == NULL)
return -EINVAL;
......@@ -1531,8 +1531,7 @@ static int element_callback(snd_hctl_elem_t *elem, unsigned int mask)
if (pyhelem == NULL || pyhelem->callback == NULL)
return -EINVAL;
tstate = PyThreadState_New(main_interpreter);
origstate = PyThreadState_Swap(tstate);
CALLBACK_INIT;
o = PyObject_GetAttr(pyhelem->callback, InternFromString("callback"));
if (!o) {
......@@ -1570,8 +1569,7 @@ static int element_callback(snd_hctl_elem_t *elem, unsigned int mask)
Py_DECREF(o);
}
PyThreadState_Swap(origstate);
PyThreadState_Delete(tstate);
CALLBACK_DONE;
return res;
}
......@@ -1325,10 +1325,10 @@ MOD_INIT(alsamixer)
static int element_callback(snd_mixer_elem_t *elem, unsigned int mask)
{
PyThreadState *tstate, *origstate;
struct pyalsamixerelement *pyelem;
PyObject *o, *t, *r;
int res = 0, inside = 1;
CALLBACK_VARIABLES;
if (elem == NULL)
return -EINVAL;
......@@ -1336,8 +1336,7 @@ static int element_callback(snd_mixer_elem_t *elem, unsigned int mask)
if (pyelem == NULL || pyelem->callback == NULL)
return -EINVAL;
tstate = PyThreadState_New(main_interpreter);
origstate = PyThreadState_Swap(tstate);
CALLBACK_INIT;
o = PyObject_GetAttr(pyelem->callback, InternFromString("callback"));
if (!o) {
......@@ -1377,8 +1376,7 @@ static int element_callback(snd_mixer_elem_t *elem, unsigned int mask)
Py_DECREF(o);
}
PyThreadState_Swap(origstate);
PyThreadState_Delete(tstate);
CALLBACK_DONE;
return res;
}
......@@ -353,18 +353,11 @@ typedef struct {
} 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
# define CONST_EXTRA(x) (&(x->extra))
/** alsaseq.Constant type (initialized later...) */
static PyTypeObject ConstantType;
......
......@@ -65,6 +65,31 @@
ob = Py_InitModule3(name, methods, doc);
#endif
/*
*
*/
#if PY_MAJOR_VERSION >= 3
#define CALLBACK_VARIABLES \
PyGILState_STATE __gstate
#define CALLBACK_INIT \
__gstate = PyGILState_Ensure()
#define CALLBACK_DONE \
PyGILState_Release(__gstate)
#else
#define CALLBACK_VARIABLES \
PyThreadState *__tstate, *__origstate
#define CALLBACK_INIT \
do { \
__tstate = PyThreadState_New(main_interpreter); \
__origstate = PyThreadState_Swap(__tstate); \
} while (0)
#define CALLBACK_DONE \
do { \
PyThreadState_Swap(origstate); \
PyThreadState_Delete(tstate); \
} while (0)
#endif
/*
*
*/
......
......@@ -9,7 +9,7 @@ try:
except ImportError:
from distutils.core import setup, Extension
VERSION='1.2.7'
VERSION='1.2.12'
if os.path.exists("version"):
fp = open("version", "r")
......@@ -29,7 +29,7 @@ setup(
description="Python binding for the ALSA library.",
url="http://www.alsa-project.org",
download_url="ftp://ftp.alsa-project.org/pub/pyalsa/",
licence="LGPLv2+",
license="LGPLv2+",
author="The ALSA Team",
author_email='alsa-devel@alsa-project.org',
ext_modules=[
......@@ -71,8 +71,13 @@ SOFILES = [
'alsaseq'
]
if sys.argv[1] != 'build':
sys.exit(0)
uname = os.uname()
if sys.version_info < (3, 0):
dir = 'build/lib.%s-%s-%s/pyalsa' % (uname[0].lower(), uname[4], sys.version[:3])
else:
dir = 'build/lib.%s-%s-cpython-%s%s/pyalsa' % (uname[0].lower(), uname[4], sys.version_info.major, sys.version_info.minor)
files = os.path.exists(dir) and os.listdir(dir) or []
for f in SOFILES:
path = ''
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment