summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--PKG-INFO2
-rw-r--r--debian/changelog6
-rw-r--r--debian/control1
-rw-r--r--debian/patches/avoid-deprecated-platform-dist.patch43
-rw-r--r--debian/patches/improve-unknown-interaction-mock.patch56
-rw-r--r--debian/patches/isolate-from-proxy.patch66
-rw-r--r--debian/patches/series3
-rw-r--r--macaroonbakery.egg-info/PKG-INFO2
-rw-r--r--macaroonbakery.egg-info/requires.txt14
-rw-r--r--macaroonbakery/checkers/_auth_context.py7
-rw-r--r--macaroonbakery/tests/test_bakery.py6
-rw-r--r--macaroonbakery/tests/test_client.py11
-rwxr-xr-xsetup.py24
13 files changed, 40 insertions, 201 deletions
diff --git a/PKG-INFO b/PKG-INFO
index c0150fc..7e4987e 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: macaroonbakery
-Version: 1.2.3
+Version: 1.3.0
Summary: A Python library port for bakery, higher level operation to work with macaroons
Home-page: https://github.com/go-macaroon-bakery/py-macaroon-bakery
Author: Juju UI Team
diff --git a/debian/changelog b/debian/changelog
index 8e5b09f..2a6b577 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+py-macaroon-bakery (1.3.0-1) unstable; urgency=medium
+
+ * New upstream release.
+
+ -- Colin Watson <cjwatson@debian.org> Wed, 29 Jan 2020 17:25:18 +0000
+
py-macaroon-bakery (1.2.3-3) unstable; urgency=medium
* Cherry-pick from upstream:
diff --git a/debian/control b/debian/control
index 12c23f1..d104c15 100644
--- a/debian/control
+++ b/debian/control
@@ -6,6 +6,7 @@ Uploaders: Colin Watson <cjwatson@debian.org>
Build-Depends: debhelper-compat (= 9),
dh-python,
python3-all,
+ python3-fixtures,
python3-httmock,
python3-mock,
python3-nacl (>= 1.1.2),
diff --git a/debian/patches/avoid-deprecated-platform-dist.patch b/debian/patches/avoid-deprecated-platform-dist.patch
deleted file mode 100644
index 0bb3bd2..0000000
--- a/debian/patches/avoid-deprecated-platform-dist.patch
+++ /dev/null
@@ -1,43 +0,0 @@
-From: Francesco Banconi <francesco.banconi@canonical.com>
-Date: Mon, 13 May 2019 11:27:48 +0200
-Subject: Avoid using deprecated platform.dist() in setup.py
-
-Bug: https://github.com/go-macaroon-bakery/py-macaroon-bakery/issues/74
-Origin: upstream, https://github.com/go-macaroon-bakery/py-macaroon-bakery/commit/3721180c4a3765e8807392fca2b7e7c2d7ffae45
-Last-Update: 2019-12-26
----
- setup.py | 9 +++------
- 1 file changed, 3 insertions(+), 6 deletions(-)
-
-diff --git a/setup.py b/setup.py
-index f098e76..83aec8c 100755
---- a/setup.py
-+++ b/setup.py
-@@ -3,7 +3,6 @@
- # Copyright 2017 Canonical Ltd.
- # Licensed under the LGPLv3, see LICENCE file for details.
- import sys
--import platform
-
- from setuptools import (
- find_packages,
-@@ -39,16 +38,14 @@ test_requirements = [
- 'httmock==1.2.5',
- ]
-
--distribution = platform.dist()
--if len(distribution) == 3 and distribution[2] == 'trusty':
-+if sys.version_info < (2, 7, 9):
- # Injected into urllib3 to fix insecure Python 2.
- requirements.extend([
- 'cryptography==1.3.2',
-- 'pyOpenSSL==16.0.0',
-- 'pyasn1==0.1.9',
- 'ndg_httpsclient==0.3.3',
-+ 'pyasn1==0.1.9',
-+ 'pyOpenSSL==16.0.0',
- ])
--
- if sys.version_info.major == 2:
- requirements.append('ipaddress')
-
diff --git a/debian/patches/improve-unknown-interaction-mock.patch b/debian/patches/improve-unknown-interaction-mock.patch
deleted file mode 100644
index b09b3a2..0000000
--- a/debian/patches/improve-unknown-interaction-mock.patch
+++ /dev/null
@@ -1,56 +0,0 @@
-From: Colin Watson <cjwatson@debian.org>
-Date: Fri, 9 Feb 2018 21:54:21 +0000
-Subject: Improve mock setup for 407-then-unknown test
-
-`test_407_then_unknown_interaction_methods` causes the client to fetch
-the possible methods supported by the discharger (because it's told that
-it only supports a non-window method). This is currently unmocked,
-which causes the client to actually contact `http://example.com/visit`.
-This fails in Launchpad builds because they run with a restrictive
-network setup that doesn't even expose DNS lookups for non-permitted
-hosts.
-
-There isn't really a good way to simulate this without setting up a
-similar stunt DNS server (though perhaps installing an
-`httmock.all_requests` fallback mock that raises an exception would be a
-good idea?), but this seems to be the only failure at the moment.
-
-Forwarded: https://github.com/go-macaroon-bakery/py-macaroon-bakery/pull/45
-Last-Update: 2018-02-09
-
-Patch-Name: improve-unknown-interaction-mock.patch
----
- macaroonbakery/tests/test_bakery.py | 13 ++++++++++++-
- 1 file changed, 12 insertions(+), 1 deletion(-)
-
-diff --git a/macaroonbakery/tests/test_bakery.py b/macaroonbakery/tests/test_bakery.py
-index 72a6928..1883987 100644
---- a/macaroonbakery/tests/test_bakery.py
-+++ b/macaroonbakery/tests/test_bakery.py
-@@ -146,6 +146,16 @@ def discharge_401(url, request):
- }
-
-
-+@urlmatch(path='.*/visit')
-+def visit_200(url, request):
-+ return {
-+ 'status_code': 200,
-+ 'content': {
-+ 'interactive': '/visit'
-+ }
-+ }
-+
-+
- @urlmatch(path='.*/wait')
- def wait_after_401(url, request):
- if request.url != 'http://example.com/wait':
-@@ -245,7 +255,8 @@ class TestBakery(TestCase):
- def kind(self):
- return 'unknown'
- client = httpbakery.Client(interaction_methods=[UnknownInteractor()])
-- with HTTMock(first_407_then_200), HTTMock(discharge_401):
-+ with HTTMock(first_407_then_200), HTTMock(discharge_401),\
-+ HTTMock(visit_200):
- with self.assertRaises(httpbakery.InteractionError) as exc:
- requests.get(
- ID_PATH,
diff --git a/debian/patches/isolate-from-proxy.patch b/debian/patches/isolate-from-proxy.patch
deleted file mode 100644
index 06cc402..0000000
--- a/debian/patches/isolate-from-proxy.patch
+++ /dev/null
@@ -1,66 +0,0 @@
-From: Colin Watson <cjwatson@debian.org>
-Date: Mon, 6 Nov 2017 10:27:10 +0000
-Subject: Isolate client tests from any HTTP proxy
-
-Debian's Python packaging tools set http_proxy to a non-existent proxy
-to help flush out packages that try to talk to the network during build,
-but these tests could previously fail in more normal development
-environments too.
-
-Forwarded: https://github.com/go-macaroon-bakery/py-macaroon-bakery/pull/28
-Last-Update: 2018-02-05
-
-Patch-Name: isolate-from-proxy.patch
----
- macaroonbakery/tests/test_bakery.py | 6 ++++++
- macaroonbakery/tests/test_client.py | 7 +++++++
- 2 files changed, 13 insertions(+)
-
-diff --git a/macaroonbakery/tests/test_bakery.py b/macaroonbakery/tests/test_bakery.py
-index a6c3e58..72a6928 100644
---- a/macaroonbakery/tests/test_bakery.py
-+++ b/macaroonbakery/tests/test_bakery.py
-@@ -1,5 +1,6 @@
- # Copyright 2017 Canonical Ltd.
- # Licensed under the LGPLv3, see LICENCE file for details.
-+import os
- from unittest import TestCase
-
- import macaroonbakery.httpbakery as httpbakery
-@@ -171,6 +172,11 @@ def wait_on_error(url, request):
-
-
- class TestBakery(TestCase):
-+ def setUp(self):
-+ super(TestBakery, self).setUp()
-+ # http_proxy would cause requests to talk to the proxy, which is
-+ # unlikely to know how to talk to the test server.
-+ os.environ.pop('http_proxy', None)
-
- def assert_cookie_security(self, cookies, name, secure):
- for cookie in cookies:
-diff --git a/macaroonbakery/tests/test_client.py b/macaroonbakery/tests/test_client.py
-index b03bafa..2ae08d3 100644
---- a/macaroonbakery/tests/test_client.py
-+++ b/macaroonbakery/tests/test_client.py
-@@ -3,6 +3,7 @@
- import base64
- import datetime
- import json
-+import os
- import threading
- from unittest import TestCase
-
-@@ -27,6 +28,12 @@ TEST_OP = bakery.Op(entity='test', action='test')
-
-
- class TestClient(TestCase):
-+ def setUp(self):
-+ super(TestClient, self).setUp()
-+ # http_proxy would cause requests to talk to the proxy, which is
-+ # unlikely to know how to talk to the test server.
-+ os.environ.pop('http_proxy', None)
-+
- def test_single_service_first_party(self):
- b = new_bakery('loc', None, None)
-
diff --git a/debian/patches/series b/debian/patches/series
deleted file mode 100644
index fc4bd34..0000000
--- a/debian/patches/series
+++ /dev/null
@@ -1,3 +0,0 @@
-isolate-from-proxy.patch
-improve-unknown-interaction-mock.patch
-avoid-deprecated-platform-dist.patch
diff --git a/macaroonbakery.egg-info/PKG-INFO b/macaroonbakery.egg-info/PKG-INFO
index c0150fc..7e4987e 100644
--- a/macaroonbakery.egg-info/PKG-INFO
+++ b/macaroonbakery.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: macaroonbakery
-Version: 1.2.3
+Version: 1.3.0
Summary: A Python library port for bakery, higher level operation to work with macaroons
Home-page: https://github.com/go-macaroon-bakery/py-macaroon-bakery
Author: Juju UI Team
diff --git a/macaroonbakery.egg-info/requires.txt b/macaroonbakery.egg-info/requires.txt
index e715881..52b6944 100644
--- a/macaroonbakery.egg-info/requires.txt
+++ b/macaroonbakery.egg-info/requires.txt
@@ -1,7 +1,15 @@
-requests<3.0,>=2.18.1
PyNaCl<2.0,>=1.1.2
-pymacaroons<1.0,>=0.12.0
-six<2.0,>=1.11.0
protobuf<4.0,>=3.0.0
pyRFC3339<2.0,>=1.0
+pymacaroons<1.0,>=0.12.0
+requests<3.0,>=2.18.1
+six<2.0,>=1.11.0
+
+[:python_full_version < "2.7.9"]
+cryptography==1.3.2
+ndg_httpsclient==0.3.3
+pyOpenSSL==16.0.0
+pyasn1==0.1.9
+
+[:python_version < "3"]
ipaddress
diff --git a/macaroonbakery/checkers/_auth_context.py b/macaroonbakery/checkers/_auth_context.py
index dceb015..2ca5168 100644
--- a/macaroonbakery/checkers/_auth_context.py
+++ b/macaroonbakery/checkers/_auth_context.py
@@ -1,9 +1,12 @@
# Copyright 2017 Canonical Ltd.
# Licensed under the LGPLv3, see LICENCE file for details.
-import collections
+try:
+ from collections.abc import Mapping
+except ImportError:
+ from collections import Mapping
-class AuthContext(collections.Mapping):
+class AuthContext(Mapping):
''' Holds a set of keys and values relevant to authorization.
It is passed as an argument to authorization checkers, so that the checkers
diff --git a/macaroonbakery/tests/test_bakery.py b/macaroonbakery/tests/test_bakery.py
index 1883987..d242b2a 100644
--- a/macaroonbakery/tests/test_bakery.py
+++ b/macaroonbakery/tests/test_bakery.py
@@ -1,6 +1,5 @@
# Copyright 2017 Canonical Ltd.
# Licensed under the LGPLv3, see LICENCE file for details.
-import os
from unittest import TestCase
import macaroonbakery.httpbakery as httpbakery
@@ -182,11 +181,6 @@ def wait_on_error(url, request):
class TestBakery(TestCase):
- def setUp(self):
- super(TestBakery, self).setUp()
- # http_proxy would cause requests to talk to the proxy, which is
- # unlikely to know how to talk to the test server.
- os.environ.pop('http_proxy', None)
def assert_cookie_security(self, cookies, name, secure):
for cookie in cookies:
diff --git a/macaroonbakery/tests/test_client.py b/macaroonbakery/tests/test_client.py
index 2ae08d3..6437a54 100644
--- a/macaroonbakery/tests/test_client.py
+++ b/macaroonbakery/tests/test_client.py
@@ -3,9 +3,7 @@
import base64
import datetime
import json
-import os
import threading
-from unittest import TestCase
import macaroonbakery.bakery as bakery
import macaroonbakery.checkers as checkers
@@ -14,6 +12,10 @@ import pymacaroons
import requests
import macaroonbakery._utils as utils
+from fixtures import (
+ EnvironmentVariable,
+ TestWithFixtures,
+)
from httmock import HTTMock, urlmatch
from six.moves.urllib.parse import parse_qs
from six.moves.urllib.request import Request
@@ -27,12 +29,13 @@ AGES = datetime.datetime.utcnow() + datetime.timedelta(days=1)
TEST_OP = bakery.Op(entity='test', action='test')
-class TestClient(TestCase):
+class TestClient(TestWithFixtures):
def setUp(self):
super(TestClient, self).setUp()
# http_proxy would cause requests to talk to the proxy, which is
# unlikely to know how to talk to the test server.
- os.environ.pop('http_proxy', None)
+ self.useFixture(EnvironmentVariable('http_proxy'))
+ self.useFixture(EnvironmentVariable('HTTP_PROXY'))
def test_single_service_first_party(self):
b = new_bakery('loc', None, None)
diff --git a/setup.py b/setup.py
index 83aec8c..d549aa5 100755
--- a/setup.py
+++ b/setup.py
@@ -2,8 +2,6 @@
# Copyright 2017 Canonical Ltd.
# Licensed under the LGPLv3, see LICENCE file for details.
-import sys
-
from setuptools import (
find_packages,
setup,
@@ -12,8 +10,8 @@ from setuptools import (
PROJECT_NAME = 'macaroonbakery'
-# version 1.2.3
-VERSION = (1, 2, 3)
+# version 1.3.0
+VERSION = (1, 3, 0)
def get_version():
@@ -31,25 +29,19 @@ requirements = [
'six>=1.11.0,<2.0',
'protobuf>=3.0.0,<4.0',
'pyRFC3339>=1.0,<2.0',
+ 'ipaddress;python_version<"3"',
+ 'cryptography==1.3.2;python_full_version<"2.7.9"',
+ 'ndg_httpsclient==0.3.3;python_full_version<"2.7.9"',
+ 'pyasn1==0.1.9;python_full_version<"2.7.9"',
+ 'pyOpenSSL==16.0.0;python_full_version<"2.7.9"',
]
test_requirements = [
'tox',
+ 'fixtures',
'httmock==1.2.5',
]
-if sys.version_info < (2, 7, 9):
- # Injected into urllib3 to fix insecure Python 2.
- requirements.extend([
- 'cryptography==1.3.2',
- 'ndg_httpsclient==0.3.3',
- 'pyasn1==0.1.9',
- 'pyOpenSSL==16.0.0',
- ])
-if sys.version_info.major == 2:
- requirements.append('ipaddress')
-
-
setup(
name=PROJECT_NAME,
version=get_version(),