diff options
| author | Alex Grönholm <alex.gronholm@nextday.fi> | 2017-08-06 14:34:01 +0300 |
|---|---|---|
| committer | Alex Grönholm <alex.gronholm@nextday.fi> | 2017-08-06 14:34:01 +0300 |
| commit | 7e6a210be87d0948863829cbdfaa49240d402982 (patch) | |
| tree | 6b9fee17ae091c68c8fc1ff9f2a1caf595af4721 | |
| parent | 3f20ea903b93c1688d69406ba44705bc0afcc0fa (diff) | |
| download | wheel-git-7e6a210be87d0948863829cbdfaa49240d402982.tar.gz | |
Improved error message when trying to verify unsigned wheels
Fixes #94.
Signed-off-by: Alex Grönholm <alex.gronholm@nextday.fi>
| -rw-r--r-- | CHANGES.txt | 1 | ||||
| -rw-r--r-- | wheel/tool/__init__.py | 8 |
2 files changed, 7 insertions, 2 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index 78e0312..61e5e92 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -11,6 +11,7 @@ - Made the order of files in generated ZIP files deterministic. Thanks Matthias Bach. - Made the order of requirements in metadata deterministic. Thanks Chris Lamb. +- Improved the error message when trying to verify an unsigned wheel file - Remove support for Python 2.6, 3.2 and 3.3. 0.29.0 diff --git a/wheel/tool/__init__.py b/wheel/tool/__init__.py index a55752d..d6b9893 100644 --- a/wheel/tool/__init__.py +++ b/wheel/tool/__init__.py @@ -106,7 +106,7 @@ def unsign(wheelfile): vzf = VerifyingZipFile(wheelfile, "a") info = vzf.infolist() if not (len(info) and info[-1].filename.endswith('/RECORD.jws')): - raise WheelError("RECORD.jws not found at end of archive.") + raise WheelError('The wheel is not signed (RECORD.jws not found at end of the archive).') vzf.pop() vzf.close() @@ -120,7 +120,11 @@ def verify(wheelfile): """ wf = WheelFile(wheelfile) sig_name = wf.distinfo_name + '/RECORD.jws' - sig = json.loads(native(wf.zipfile.open(sig_name).read())) + try: + sig = json.loads(native(wf.zipfile.open(sig_name).read())) + except KeyError: + raise WheelError('The wheel is not signed (RECORD.jws not found at end of the archive).') + verified = signatures.verify(sig) sys.stderr.write("Signatures are internally consistent.\n") sys.stdout.write(json.dumps(verified, indent=2)) |
