Merge lp:~jelmer/brz/gpg-warning into lp:brz

Proposed by Jelmer Vernooij
Status: Merged
Approved by: Jelmer Vernooij
Approved revision: 7197
Merge reported by: The Breezy Bot
Merged at revision: not available
Proposed branch: lp:~jelmer/brz/gpg-warning
Merge into: lp:brz
Diff against target: 37 lines (+10/-3)
1 file modified
breezy/gpg.py (+10/-3)
To merge this branch: bzr merge lp:~jelmer/brz/gpg-warning
Reviewer Review Type Date Requested Status
Martin Packman Approve
Review via email: mp+358971@code.launchpad.net

Commit message

Give a clearer warning when the gpg module is not available.

Description of the change

Give a clearer warning when the gpg module is not available.

To post a comment you must log in.
Revision history for this message
Martin Packman (gz) wrote :

Looks good, thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'breezy/gpg.py'
2--- breezy/gpg.py 2018-11-12 01:41:38 +0000
3+++ breezy/gpg.py 2018-11-19 01:49:29 +0000
4@@ -55,7 +55,8 @@
5
6 class GpgNotInstalled(errors.DependencyNotPresent):
7
8- _fmt = 'python-gpg is not installed, it is needed to verify signatures'
9+ _fmt = ('python-gpg is not installed, it is needed to create or '
10+ 'verify signatures. %(error)s')
11
12 def __init__(self, error):
13 errors.DependencyNotPresent.__init__(self, 'gpg', error)
14@@ -230,7 +231,12 @@
15 return False
16
17 def sign(self, content, mode):
18- import gpg
19+ try:
20+ import gpg
21+ except ImportError as error:
22+ raise GpgNotInstalled(
23+ 'Set create_signatures=no to disable creating signatures.')
24+
25 if isinstance(content, text_type):
26 raise errors.BzrBadParameterUnicode('content')
27
28@@ -258,7 +264,8 @@
29 try:
30 import gpg
31 except ImportError as error:
32- raise errors.GpgNotInstalled(error)
33+ raise GpgNotInstalled(
34+ 'Set check_signatures=ignore to disable verifying signatures.')
35
36 signed_data = gpg.Data(signed_data)
37 if signature:

Subscribers

People subscribed via source and target branches