summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2017-08-23 12:56:31 +0300
committerPanu Matilainen <pmatilai@redhat.com>2017-08-23 13:02:24 +0300
commiteadee821b3ac97dfaa26e03e9f5cca904bddf00d (patch)
treecb250766295ca9cb6c44f376a201744c3ffd4a6a /python
parentee33773218d5bda08a32c3775101b8aa211f2b13 (diff)
downloadrpm-eadee821b3ac97dfaa26e03e9f5cca904bddf00d.tar.gz
Export rpmsqBlock() to python bindings as blockSignals()
Diffstat (limited to 'python')
-rw-r--r--python/rpmmodule.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/python/rpmmodule.c b/python/rpmmodule.c
index 471769330..93a15a49b 100644
--- a/python/rpmmodule.c
+++ b/python/rpmmodule.c
@@ -52,6 +52,15 @@ static PyObject * checkSignals(PyObject * self)
return Py_BuildValue("i", rpmsqPoll());
}
+static PyObject * blockSignals(PyObject * self, PyObject *arg)
+{
+ int block;
+ if (!PyArg_Parse(arg, "p", &block)) return NULL;
+
+ return Py_BuildValue("i", rpmsqBlock(block ? SIG_BLOCK : SIG_UNBLOCK));
+}
+
+
static PyObject * setLogFile (PyObject * self, PyObject *arg)
{
FILE *fp;
@@ -166,6 +175,8 @@ static PyMethodDef rpmModuleMethods[] = {
"signalCaught(signo) -- Returns True if signal was caught." },
{ "checkSignals", (PyCFunction) checkSignals, METH_NOARGS,
"checkSignals() -- Check for and exit on termination signals."},
+ { "blockSignals", (PyCFunction) blockSignals, METH_O,
+ "blocksignals(True/False) -- Block/unblock signals, refcounted."},
{ "mergeHeaderListFromFD", (PyCFunction) rpmMergeHeadersFromFD, METH_VARARGS|METH_KEYWORDS,
NULL },