python: Rename exported functions.

Avoid the name pygpgme, as this is the name of another popular Python
binding for GPGME.

This commit renames all functions that are exported to the Python
world.

* lang/python/helpers.c: Rename all exported functions.
* lang/python/helpers.h: Likewise.
* lang/python/pyme/core.py: Likewise.

Signed-off-by: Justus Winter <justus@g10code.com>
This commit is contained in:
Justus Winter 2016-07-28 15:24:05 +02:00
parent 1d2f22aae6
commit b5aa05c3b2
3 changed files with 28 additions and 28 deletions

View File

@ -123,7 +123,7 @@ static void _pyme_stash_callback_exception(PyObject *weak_self)
Py_DECREF(excinfo);
}
PyObject *pygpgme_raise_callback_exception(PyObject *self)
PyObject *pyme_raise_callback_exception(PyObject *self)
{
PyObject *ptype, *pvalue, *ptraceback, *excinfo;
@ -413,7 +413,7 @@ static gpgme_error_t pyPassphraseCb(void *hook,
}
PyObject *
pygpgme_set_passphrase_cb(PyObject *self, PyObject *cb) {
pyme_set_passphrase_cb(PyObject *self, PyObject *cb) {
PyObject *wrapped;
gpgme_ctx_t ctx;
@ -495,7 +495,7 @@ static void pyProgressCb(void *hook, const char *what, int type, int current,
}
PyObject *
pygpgme_set_progress_cb(PyObject *self, PyObject *cb) {
pyme_set_progress_cb(PyObject *self, PyObject *cb) {
PyObject *wrapped;
gpgme_ctx_t ctx;
@ -592,7 +592,7 @@ static gpgme_error_t pyStatusCb(void *hook, const char *keyword,
}
PyObject *
pygpgme_set_status_cb(PyObject *self, PyObject *cb) {
pyme_set_status_cb(PyObject *self, PyObject *cb) {
PyObject *wrapped;
gpgme_ctx_t ctx;
@ -910,9 +910,9 @@ static void pyDataReleaseCb(void *hook)
}
PyObject *
pygpgme_data_new_from_cbs(PyObject *self,
PyObject *pycbs,
gpgme_data_t *r_data)
pyme_data_new_from_cbs(PyObject *self,
PyObject *pycbs,
gpgme_data_t *r_data)
{
static struct gpgme_data_cbs cbs = {
pyDataReadCb,

View File

@ -26,11 +26,11 @@
#define write(fd, str, sz) {DWORD written; WriteFile((HANDLE) fd, str, sz, &written, 0);}
#endif
PyObject *pygpgme_raise_callback_exception(PyObject *self);
PyObject *pyme_raise_callback_exception(PyObject *self);
PyObject *pygpgme_set_passphrase_cb(PyObject *self, PyObject *cb);
PyObject *pygpgme_set_progress_cb(PyObject *self, PyObject *cb);
PyObject *pygpgme_set_status_cb(PyObject *self, PyObject *cb);
PyObject *pyme_set_passphrase_cb(PyObject *self, PyObject *cb);
PyObject *pyme_set_progress_cb(PyObject *self, PyObject *cb);
PyObject *pyme_set_status_cb(PyObject *self, PyObject *cb);
PyObject *pygpgme_data_new_from_cbs(PyObject *self, PyObject *pycbs,
gpgme_data_t *r_data);
PyObject *pyme_data_new_from_cbs(PyObject *self, PyObject *pycbs,
gpgme_data_t *r_data);

View File

@ -126,13 +126,13 @@ class GpgmeWrapper(object):
def _funcwrap(slf, *args):
result = func(slf.wrapped, *args)
if slf._callback_excinfo:
pygpgme.pygpgme_raise_callback_exception(slf)
pygpgme.pyme_raise_callback_exception(slf)
return errorcheck(result, "Invocation of " + name)
else:
def _funcwrap(slf, *args):
result = func(slf.wrapped, *args)
if slf._callback_excinfo:
pygpgme.pygpgme_raise_callback_exception(slf)
pygpgme.pyme_raise_callback_exception(slf)
return result
doc = self._munge_docstring.sub(r'\2.\1(\3', getattr(func, "__doc__"))
@ -508,7 +508,7 @@ class Context(GpgmeWrapper):
errptr)
if self._callback_excinfo:
pygpgme.pygpgme_raise_callback_exception(self)
pygpgme.pyme_raise_callback_exception(self)
errorcheck(err)
@ -661,10 +661,10 @@ class Context(GpgmeWrapper):
hookdata = (weakref.ref(self), func)
else:
hookdata = (weakref.ref(self), func, hook)
pygpgme.pygpgme_set_passphrase_cb(self, hookdata)
pygpgme.pyme_set_passphrase_cb(self, hookdata)
def _free_passcb(self):
if pygpgme.pygpgme_set_passphrase_cb:
if pygpgme.pyme_set_passphrase_cb:
self.set_passphrase_cb(None)
def set_progress_cb(self, func, hook=None):
@ -686,10 +686,10 @@ class Context(GpgmeWrapper):
hookdata = (weakref.ref(self), func)
else:
hookdata = (weakref.ref(self), func, hook)
pygpgme.pygpgme_set_progress_cb(self, hookdata)
pygpgme.pyme_set_progress_cb(self, hookdata)
def _free_progresscb(self):
if pygpgme.pygpgme_set_progress_cb:
if pygpgme.pyme_set_progress_cb:
self.set_progress_cb(None)
def set_status_cb(self, func, hook=None):
@ -710,10 +710,10 @@ class Context(GpgmeWrapper):
hookdata = (weakref.ref(self), func)
else:
hookdata = (weakref.ref(self), func, hook)
pygpgme.pygpgme_set_status_cb(self, hookdata)
pygpgme.pyme_set_status_cb(self, hookdata)
def _free_statuscb(self):
if pygpgme.pygpgme_set_status_cb:
if pygpgme.pyme_set_status_cb:
self.set_status_cb(None)
@property
@ -774,7 +774,7 @@ class Context(GpgmeWrapper):
result = pygpgme.gpgme_op_edit(self.wrapped, key, opaquedata, out)
if self._callback_excinfo:
pygpgme.pygpgme_raise_callback_exception(self)
pygpgme.pyme_raise_callback_exception(self)
errorcheck(result)
class Data(GpgmeWrapper):
@ -873,7 +873,7 @@ class Data(GpgmeWrapper):
if self.wrapped != None and pygpgme.gpgme_data_release:
pygpgme.gpgme_data_release(self.wrapped)
if self._callback_excinfo:
pygpgme.pygpgme_raise_callback_exception(self)
pygpgme.pyme_raise_callback_exception(self)
self.wrapped = None
self._free_datacbs()
@ -918,7 +918,7 @@ class Data(GpgmeWrapper):
else:
hookdata = (weakref.ref(self),
read_cb, write_cb, seek_cb, release_cb)
pygpgme.pygpgme_data_new_from_cbs(self, hookdata, tmp)
pygpgme.pyme_data_new_from_cbs(self, hookdata, tmp)
self.wrapped = pygpgme.gpgme_data_t_p_value(tmp)
pygpgme.delete_gpgme_data_t_p(tmp)
@ -972,7 +972,7 @@ class Data(GpgmeWrapper):
written = pygpgme.gpgme_data_write(self.wrapped, buffer)
if written < 0:
if self._callback_excinfo:
pygpgme.pygpgme_raise_callback_exception(self)
pygpgme.pyme_raise_callback_exception(self)
else:
raise GPGMEError.fromSyserror()
return written
@ -993,7 +993,7 @@ class Data(GpgmeWrapper):
result = pygpgme.gpgme_data_read(self.wrapped, size)
except:
if self._callback_excinfo:
pygpgme.pygpgme_raise_callback_exception(self)
pygpgme.pyme_raise_callback_exception(self)
else:
raise
return result
@ -1004,7 +1004,7 @@ class Data(GpgmeWrapper):
result = pygpgme.gpgme_data_read(self.wrapped, 4096)
except:
if self._callback_excinfo:
pygpgme.pygpgme_raise_callback_exception(self)
pygpgme.pyme_raise_callback_exception(self)
else:
raise
if len(result) == 0: