diff options
Diffstat (limited to '')
| -rw-r--r-- | lang/python/gpgme.i | 22 | ||||
| -rw-r--r-- | lang/python/pyme/core.py | 38 | ||||
| -rw-r--r-- | lang/python/pyme/results.py | 3 | 
3 files changed, 54 insertions, 9 deletions
| diff --git a/lang/python/gpgme.i b/lang/python/gpgme.i index 2b186c4f..a372edd4 100644 --- a/lang/python/gpgme.i +++ b/lang/python/gpgme.i @@ -324,7 +324,7 @@  // Make types containing 'next' field to be lists  %ignore next; -%typemap(out) gpgme_sig_notation_t, gpgme_engine_info_t, gpgme_subkey_t, +%typemap(out) gpgme_sig_notation_t, gpgme_subkey_t,     gpgme_key_sig_t, gpgme_user_id_t, gpgme_invalid_key_t,     gpgme_recipient_t, gpgme_new_signature_t, gpgme_signature_t,     gpgme_import_status_t, gpgme_conf_arg_t, gpgme_conf_opt_t, @@ -409,6 +409,26 @@    Py_DECREF(fragile);  } +%typemap(out) gpgme_engine_info_t { +  int i; +  int size = 0; +  $1_ltype curr; +  for (curr = $1; curr != NULL; curr = curr->next) { +    size++; +  } +  $result = PyList_New(size); +  for (i=0,curr=$1; i<size; i++,curr=curr->next) { +    PyObject *fragile, *o; +    fragile = SWIG_NewPointerObj(SWIG_as_voidptr(curr), $1_descriptor, +                                 %newpointer_flags); +    o = pygpgme_wrap_fragile_result(fragile, "EngineInfo"); +    if (o == NULL) +      return NULL;	/* raise */ +    Py_DECREF(fragile); +    PyList_SetItem($result, i, o); +  } +} +  // Include mapper for edit callbacks diff --git a/lang/python/pyme/core.py b/lang/python/pyme/core.py index 3ca47473..216e26fd 100644 --- a/lang/python/pyme/core.py +++ b/lang/python/pyme/core.py @@ -666,17 +666,39 @@ class Context(GpgmeWrapper):          if pygpgme.pygpgme_set_status_cb:              self.set_status_cb(None) +    @property +    def engine_info(self): +        """Configuration of the engine currently in use""" +        p = self.protocol +        infos = [i for i in self.get_engine_info() if i.protocol == p] +        assert len(infos) == 1 +        return infos[0] +      def get_engine_info(self): -        """Returns this context specific engine info""" +        """Get engine configuration + +        Returns information about all configured and installed +        engines. + +        Returns: +        infos		-- a list of engine infos + +        """          return pygpgme.gpgme_ctx_get_engine_info(self.wrapped) -    def set_engine_info(self, proto, file_name, home_dir=None): -        """Changes the configuration of the crypto engine implementing the -    protocol 'proto' for the context. 'file_name' is the file name of -    the executable program implementing this protocol. 'home_dir' is the -    directory name of the configuration directory (engine's default is -    used if omitted).""" -        errorcheck(pygpgme.gpgme_ctx_set_engine_info(self.wrapped, proto, file_name, home_dir)) +    def set_engine_info(self, proto, file_name=None, home_dir=None): +        """Change engine configuration + +        Changes the configuration of the crypto engine implementing +        the protocol 'proto' for the context. + +        Keyword arguments: +        file_name	-- engine program file name (unchanged if None) +        home_dir	-- configuration directory (unchanged if None) + +        """ +        errorcheck(pygpgme.gpgme_ctx_set_engine_info( +            self.wrapped, proto, file_name, home_dir))      def wait(self, hang):          """Wait for asynchronous call to finish. Wait forever if hang is True. diff --git a/lang/python/pyme/results.py b/lang/python/pyme/results.py index aa9b38e6..374d982a 100644 --- a/lang/python/pyme/results.py +++ b/lang/python/pyme/results.py @@ -113,3 +113,6 @@ class KeylistResult(Result):  class VFSMountResult(Result):      pass + +class EngineInfo(Result): +    pass | 
