Avoid modifying embedded gnupg.py
Hello,
While working on the Debian package of Gajim, I have noticed that it embeds the third-party library gnupg.py, with very few modifications. For several reasons, it is usually better to use a system-wide libraries rather than embedded ones whenever possible. I understand that embedding it makes Gajim easier to install on systems where there is no system-wide gnupg.py, so what I would like to do is to render it optional, that is, make it easy to use a system-wide one when available.
Now, the local modifications to gnupg.py prevent me from doing that. At least not with some patching I would rather avoid. I have checked, and found the following modifications:
- removing a useless
import locale
; - replacing
logging.getLogger(__name__)
bylogging.getLogger('gajim.c.gnupg')
; - adding a missing mention of “ssb” in class ListKeys docstring;
- emptying
self.status
inSign.handle_status()
; - adding the status
KEY_CONSIDERED
to the list of ignored statuses in Sign.handle_status(); - decoding some output as UTF-8 rather than the default encoding.
I would like to reduce these differences if possible, which would also make it easier to import new version of gnupg.py. Some of these appear to be fixes, that I would like to report to the gnupg.py project:
- the useless
import locale
; - the missing “ssb” in ListKeys docstring;
- emptying
Sign.status instead
of leaving the possible previous one; - decoding some output as UTF-8 rather than the default encoding.
I think one of them is useless, though harmless:
- ignoring
KEY_CONSIDERED
inSign.handle_status()
: I do not think this is a possible status after signing.
That leaves two modifications which I think are useful for Gajim only:
- replacing the logger: I think it could be replaced from outside, in gpg.py, after importing gnupg:
gnupg.logger = logging.getLogger('gajim.c.gnupg')
.
What do you think? Could you confirm that modifications 1, 3, 4, 6 and perhaps 5 are fixes for issues in gnupg.py, that I could report to that project so it can be fixed there? What do you think of my proposal for 5. the logger name?
Librement,
-- Tanguy