[Python-modules-commits] [py-macaroon-bakery] 03/04: Avoid relative imports to fix Python 3 tests

Colin Watson cjwatson at moszumanska.debian.org
Thu Nov 2 14:35:38 UTC 2017


This is an automated email from the git hooks/post-receive script.

cjwatson pushed a commit to branch master
in repository py-macaroon-bakery.

commit 1c453126cefd68073c089b7b334b8c793b38c152
Author: Colin Watson <cjwatson at debian.org>
Date:   Thu Nov 2 14:16:23 2017 +0000

    Avoid relative imports to fix Python 3 tests
    
    This is fixed in a different way in 0.0.4.
    
    Forwarded: not-needed
    Last-Update: 2017-11-02
    
    Patch-Name: avoid-relative-imports.patch
---
 macaroonbakery/codec.py    | 11 ++++++++---
 macaroonbakery/macaroon.py |  6 +++---
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/macaroonbakery/codec.py b/macaroonbakery/codec.py
index 4015bbb..f5cc493 100644
--- a/macaroonbakery/codec.py
+++ b/macaroonbakery/codec.py
@@ -3,14 +3,13 @@
 
 import base64
 import json
-import namespace
+from macaroonbakery import namespace
 
 from nacl.public import Box, PublicKey
 from nacl.encoding import Base64Encoder
 import six
 
-import bakery
-import macaroon
+from macaroonbakery import bakery
 
 _PUBLIC_KEY_PREFIX_LEN = 4
 _KEY_LEN = 32
@@ -178,6 +177,8 @@ def _decode_caveat_v1(key, caveat):
     @param caveat a base64 encoded JSON string.
     '''
 
+    from macaroonbakery import macaroon
+
     data = base64.b64decode(caveat).decode('utf-8')
     wrapper = json.loads(data)
     tp_public_key = PublicKey(base64.b64decode(wrapper['ThirdPartyPublicKey']))
@@ -212,6 +213,8 @@ def _decode_caveat_v1(key, caveat):
 def _decode_caveat_v2_v3(version, key, caveat):
     '''Decodes a version 2 or version 3 caveat.
     '''
+    from macaroonbakery import macaroon
+
     if (len(caveat) < 1 + _PUBLIC_KEY_PREFIX_LEN +
             _KEY_LEN + Box.NONCE_SIZE + 16):
         raise ValueError('caveat id too short')
@@ -243,6 +246,8 @@ def _decode_caveat_v2_v3(version, key, caveat):
 
 
 def _decode_secret_part_v2_v3(version, data):
+    from macaroonbakery import macaroon
+
     if len(data) < 1:
         raise ValueError('secret part too short')
     got_version = six.byte2int(data[:1])
diff --git a/macaroonbakery/macaroon.py b/macaroonbakery/macaroon.py
index b0a89bb..954161c 100644
--- a/macaroonbakery/macaroon.py
+++ b/macaroonbakery/macaroon.py
@@ -6,11 +6,11 @@ import copy
 import logging
 import os
 
-import bakery
-import codec
+from macaroonbakery import bakery
+from macaroonbakery import codec
 import pymacaroons
 
-import namespace
+from macaroonbakery import namespace
 
 MACAROON_V1, MACAROON_V2 = 1, 2
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/py-macaroon-bakery.git



More information about the Python-modules-commits mailing list