diff options
author | Colin Watson <cjwatson@debian.org> | 2017-11-02 14:35:17 +0000 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2017-11-02 14:35:17 +0000 |
commit | f67cdf1c1e5cf5578a2ee79e2a34943b23d842e7 (patch) | |
tree | 8280feba22d85ebb00edac47c825723a803195bc | |
parent | efdccf6c55014d3f7be27d9d718ea70e8e60f869 (diff) | |
parent | 1c453126cefd68073c089b7b334b8c793b38c152 (diff) |
Initial release (closes: #866779).
-rw-r--r-- | debian/.git-dpm | 7 | ||||
-rw-r--r-- | debian/changelog | 5 | ||||
-rw-r--r-- | debian/compat | 1 | ||||
-rw-r--r-- | debian/control | 41 | ||||
-rw-r--r-- | debian/copyright | 10 | ||||
-rw-r--r-- | debian/patches/avoid-relative-imports.patch | 83 | ||||
-rw-r--r-- | debian/patches/series | 1 | ||||
-rwxr-xr-x | debian/rules | 7 | ||||
-rw-r--r-- | debian/watch | 4 | ||||
-rw-r--r-- | macaroonbakery/codec.py | 11 | ||||
-rw-r--r-- | macaroonbakery/macaroon.py | 6 |
11 files changed, 168 insertions, 8 deletions
diff --git a/debian/.git-dpm b/debian/.git-dpm index c43337b..f0f64ed 100644 --- a/debian/.git-dpm +++ b/debian/.git-dpm @@ -1,8 +1,11 @@ # see git-dpm(1) from git-dpm package -79ff2842fa477ee0693ea167c0a74cd7cf080d27 -79ff2842fa477ee0693ea167c0a74cd7cf080d27 +1c453126cefd68073c089b7b334b8c793b38c152 +1c453126cefd68073c089b7b334b8c793b38c152 79ff2842fa477ee0693ea167c0a74cd7cf080d27 79ff2842fa477ee0693ea167c0a74cd7cf080d27 py-macaroon-bakery_0.0.3.orig.tar.gz 5a749b8bfce5cdc00084ced3301a356681c08647 29083 +debianTag="debian/%e%v" +patchedTag="patched/%e%v" +upstreamTag="upstream/%e%u" diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..97f6414 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +py-macaroon-bakery (0.0.3-1) UNRELEASED; urgency=medium + + * Initial release (closes: #866779). + + -- Colin Watson <cjwatson@debian.org> Tue, 31 Oct 2017 10:39:18 +0000 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..ec63514 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +9 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..a641fd2 --- /dev/null +++ b/debian/control @@ -0,0 +1,41 @@ +Source: py-macaroon-bakery +Section: python +Priority: optional +Maintainer: Debian Python Modules Team <python-modules-team@lists.alioth.debian.org> +Uploaders: Colin Watson <cjwatson@debian.org> +Build-Depends: debhelper (>= 9~), + dh-python, + python3-all, + python3-httmock, + python3-mock, + python3-nacl (>= 1.1.1), + python3-nose, + python3-pymacaroons (>= 0.10.0), + python3-requests (>= 2.16.5), + python3-setuptools, + python3-six (>= 1.10.0) +Standards-Version: 4.1.1 +X-Python3-Version: >= 3.5 +Vcs-Git: https://anonscm.debian.org/git/python-modules/packages/py-macaroon-bakery.git +Vcs-Browser: https://anonscm.debian.org/cgit/python-modules/packages/py-macaroon-bakery.git +Homepage: https://github.com/go-macaroon-bakery/py-macaroon-bakery + +Package: python3-macaroonbakery +Architecture: all +Multi-Arch: foreign +Depends: ${misc:Depends}, + ${python3:Depends} +Description: Higher-level macaroon operations for Python 3 + Macaroons, like cookies, are a form of bearer credential. Unlike opaque + tokens, macaroons embed caveats that define specific authorization + requirements for the target service, the service that issued the root + macaroon and which is capable of verifying the integrity of macaroons it + receives. + . + Macaroons allow for delegation and attenuation of authorization. They are + simple and fast to verify, and decouple authorization policy from the + enforcement of that policy. + . + The macaroonbakery library builds on pymacaroons to allow working with + macaroons at a higher level, such as by automatically gathering discharge + macaroons for third-party caveats from their corresponding services. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..ed4a695 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,10 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: py-macaroon-bakery +Upstream-Contact: Juju UI Team <juju-gui@lists.ubuntu.com> +Source: https://github.com/go-macaroon-bakery/py-macaroon-bakery + +Files: * +Copyright: 2017 Canonical Ltd. +License: LGPL-3 + On Debian and Debian-based systems, a copy of the GNU Lesser General Public + License version 3 is available in /usr/share/common-licenses/LGPL-3. diff --git a/debian/patches/avoid-relative-imports.patch b/debian/patches/avoid-relative-imports.patch new file mode 100644 index 0000000..4b02a1e --- /dev/null +++ b/debian/patches/avoid-relative-imports.patch @@ -0,0 +1,83 @@ +From 1c453126cefd68073c089b7b334b8c793b38c152 Mon Sep 17 00:00:00 2001 +From: Colin Watson <cjwatson@debian.org> +Date: Thu, 2 Nov 2017 14:16:23 +0000 +Subject: 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 + diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 0000000..5b8cfe5 --- /dev/null +++ b/debian/patches/series @@ -0,0 +1 @@ +avoid-relative-imports.patch diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..d01c6c6 --- /dev/null +++ b/debian/rules @@ -0,0 +1,7 @@ +#! /usr/bin/make -f + +export PYBUILD_NAME := macaroonbakery +export PYBUILD_TEST_NOSE := 1 + +%: + dh $@ --with python3 --buildsystem=pybuild diff --git a/debian/watch b/debian/watch new file mode 100644 index 0000000..3b4de03 --- /dev/null +++ b/debian/watch @@ -0,0 +1,4 @@ +version=4 +opts="filenamemangle=s%(?:.*?)?v?(\d[\d.]*)\.tar\.gz%py-macaroon-bakery-$1.tar.gz%" \ + https://github.com/go-macaroon-bakery/py-macaroon-bakery/releases \ + (?:.*?/)?v?(\d[\d.]*)\.tar\.gz 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 |