Skip to contentSkip to conversation

Test series signed by patatt-0.1.0

PATCH New Konstantin Ryabitsev 1 participant 4 messages May 7, 2021

lore
Share & tools
lore
#0 lore raw

cover Test series signed by patatt-0.1.0

This is a PGP signing test with patatt-0.1.0.

Konstantin Ryabitsev (3):
Nicer crash for when PyNaCl isn't available
Throw a KeyError, not RuntimeError
Add manpages and prepare for 0.1.0 release

 MANIFEST.in        |   2 +
 man/patatt.5       | 112 +++++++++++++++++++++++++++++++++++++++++++++
 man/patatt.5.rst   |  61 ++++++++++++++++++++++++
 patatt/__init__.py |  18 +++++---
 setup.py           |   3 +-
 5 files changed, 189 insertions(+), 7 deletions(-)
 create mode 100644 man/patatt.5
 create mode 100644 man/patatt.5.rst
Signature · 1 line
2.31.1
#1 lore raw

PATCH 1/3 Nicer crash for when PyNaCl isn't available

Don't backtrace all over the screen -- give a nice error message.

---
 patatt/__init__.py | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)
patatt/__init__.py +11 -5
index a3870b8..e54bb10 100644
@@ -222,8 +222,11 @@ class DevsigHeader:
     @staticmethod
     def _sign_ed25519(payload: bytes, privkey: bytes) -> Tuple[bytes, bytes]:
         global KEYCACHE
-        from nacl.signing import SigningKey
-        from nacl.encoding import Base64Encoder
+        try:
+            from nacl.signing import SigningKey
+            from nacl.encoding import Base64Encoder
+        except ModuleNotFoundError:
+            raise RuntimeError('This operation requires PyNaCl libraries')
 
         if privkey not in KEYCACHE:
             sk = SigningKey(privkey, encoder=Base64Encoder)
@@ -238,9 +241,12 @@ class DevsigHeader:
 
     @staticmethod
     def _validate_ed25519(sigdata: bytes, pubkey: bytes) -> bytes:
-        from nacl.signing import VerifyKey
-        from nacl.encoding import Base64Encoder
-        from nacl.exceptions import BadSignatureError
+        try:
+            from nacl.signing import VerifyKey
+            from nacl.encoding import Base64Encoder
+            from nacl.exceptions import BadSignatureError
+        except ModuleNotFoundError:
+            raise RuntimeError('This operation requires PyNaCl libraries')
 
         vk = VerifyKey(pubkey, encoder=Base64Encoder)
         try:
Signature · 1 line
2.31.1
#2 lore raw

PATCH 2/3 Throw a KeyError, not RuntimeError

In reply to Konstantin Ryabitsev

Don't die when running outside of a git checkout, just ignore ref:
keyring locations.

---
 patatt/__init__.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
patatt/__init__.py +1 -1
index e54bb10..2f380e0 100644
@@ -684,7 +684,7 @@ def get_public_key(source: str, keytype: str, identity: str, selector: str) -> T
     if source.find('ref:') == 0:
         gittop = get_git_toplevel()
         if not gittop:
-            raise RuntimeError('Not in a git tree, so cannot use a ref: source')
+            raise KeyError('Not in a git tree, so cannot use a ref: source')
         # format is: ref:refspec:path
         # or it could omit the refspec, meaning "whatever the current ref"
         # but it should always have at least two ":"
Signature · 1 line
2.31.1
#3 lore raw

PATCH 3/3 Add manpages and prepare for 0.1.0 release

In reply to Konstantin Ryabitsev

It's time to cut the first release, I think.

---
 MANIFEST.in      |   2 +
 man/patatt.5     | 112 +++++++++++++++++++++++++++++++++++++++++++++++
 man/patatt.5.rst |  61 ++++++++++++++++++++++++++
 setup.py         |   3 +-
 4 files changed, 177 insertions(+), 1 deletion(-)
 create mode 100644 man/patatt.5
 create mode 100644 man/patatt.5.rst
MANIFEST.in +2 -0
index e72662c..b62d6b7 100644
@@ -1,2 +1,4 @@
 include COPYING
+include DCO
 include README.rst
+include man/*.rst
man/patatt.5 new file +112 -0

112 lines not on this page · raw message

man/patatt.5.rst new file +61 -0

61 lines not on this page · raw message

setup.py +2 -1
index 3eb5a8f..7fa6809 100644
@@ -33,8 +33,9 @@ setup(
     author_email='[email protected]',
     packages=['patatt'],
     license='MIT-0',
-    long_description=read('README'),
+    long_description=read('README.rst'),
     long_description_content_type='text/x-rst',
+    data_files = [('share/man/man5', ['man/patatt.5'])],
     keywords=['git', 'patches', 'attestation'],
     install_requires=[
         'pynacl',
Signature · 1 line
2.31.1