Ubuntu Pastebin

Paste from sergiusens at Wed, 3 Feb 2016 19:57:56 +0000

Download as text
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
diff -Nru python-pylxd-0.19.0/debian/changelog python-pylxd-0.19.0/debian/changelog
--- python-pylxd-0.19.0/debian/changelog	2015-12-11 13:43:51.000000000 -0300
+++ python-pylxd-0.19.0/debian/changelog	2016-02-03 16:51:53.000000000 -0300
@@ -1,3 +1,9 @@
+python-pylxd (0.19.0-0ubuntu2) xenial; urgency=medium
+
+  * Patch from upstream to support python >= 3.4.
+
+ -- Sergio Schvezov <sergio.schvezov@canonical.com>  Wed, 03 Feb 2016 16:51:04 -0300
+
 python-pylxd (0.19.0-0ubuntu1) xenial; urgency=medium
 
   * New upstream release.
diff -Nru python-pylxd-0.19.0/debian/patches/01-support-newer-python.patch python-pylxd-0.19.0/debian/patches/01-support-newer-python.patch
--- python-pylxd-0.19.0/debian/patches/01-support-newer-python.patch	1969-12-31 21:00:00.000000000 -0300
+++ python-pylxd-0.19.0/debian/patches/01-support-newer-python.patch	2016-02-03 16:50:55.000000000 -0300
@@ -0,0 +1,99 @@
+Description: Update to work with python 3.4+
+Author: "Sergio Schvezov <sergio.schvezov@canonical.com>"
+Applied-Upstream: https://github.com/lxc/pylxd/commit/7283c168236e583750c111aa3486571e18377289
+
+--- a/pylxd/connection.py
++++ b/pylxd/connection.py
+@@ -17,6 +17,7 @@
+ import copy
+ import json
+ import os
++import six
+ import socket
+ import ssl
+ import threading
+@@ -49,9 +50,13 @@
+ 
+     def __init__(self, path, host='localhost', port=None, strict=None,
+                  timeout=None):
+-        http_client.HTTPConnection.__init__(self, host, port=port,
+-                                            strict=strict,
+-                                            timeout=timeout)
++        if six.PY34:
++            http_client.HTTPConnection.__init__(self, host, port=port,
++                                                timeout=timeout)
++        else:
++            http_client.HTTPConnection.__init__(self, host, port=port,
++                                                strict=strict,
++                                                timeout=timeout)
+ 
+         self.path = path
+ 
+@@ -157,7 +162,10 @@
+         status = response.status
+         raw_body = response.read()
+         try:
+-            body = json.loads(raw_body)
++            if six.PY34:
++                body = json.loads(raw_body.decode())
++            else:
++                body = json.loads(raw_body)
+         except ValueError:
+             body = None
+ 
+--- a/pylxd/tests/test_connection.py
++++ b/pylxd/tests/test_connection.py
+@@ -15,6 +15,7 @@
+ from ddt import ddt
+ import inspect
+ import mock
++import six
+ from six.moves import cStringIO
+ from six.moves import http_client
+ import socket
+@@ -24,6 +25,9 @@
+ from pylxd import exceptions
+ from pylxd.tests import annotated_data
+ 
++if six.PY34:
++    from io import BytesIO
++
+ 
+ @ddt
+ class LXDInitConnectionTest(unittest.TestCase):
+@@ -32,8 +36,12 @@
+     @mock.patch.object(http_client.HTTPConnection, '__init__')
+     def test_http_connection(self, mc, ms):
+         conn = connection.UnixHTTPConnection('/', 'host', 1234)
+-        mc.assert_called_once_with(
+-            conn, 'host', port=1234, strict=None, timeout=None)
++        if six.PY34:
++            mc.assert_called_once_with(
++                conn, 'host', port=1234, timeout=None)
++        else:
++            mc.assert_called_once_with(
++                conn, 'host', port=1234, strict=None, timeout=None)
+         conn.connect()
+         ms.assert_called_once_with(socket.AF_UNIX, socket.SOCK_STREAM)
+         ms.return_value.connect.assert_called_once_with('/')
+@@ -97,7 +105,10 @@
+ 
+     def __init__(self, status, data):
+         self.status = status
+-        self.read = cStringIO(data).read
++        if six.PY34:
++            self.read = BytesIO(six.b(data)).read
++        else:
++            self.read = cStringIO(data).read
+ 
+ 
+ @ddt
+@@ -137,7 +148,7 @@
+ 
+     @annotated_data(
+         ('null', (200, ''), exceptions.PyLXDException),
+-        ('200', (200, '{"foo": "bar"}'), '{"foo": "bar"}'),
++        ('200', (200, '{"foo": "bar"}'), six.b('{"foo": "bar"}')),
+         ('500', (500, '{"foo": "bar"}'),
+          exceptions.PyLXDException),
+     )
diff -Nru python-pylxd-0.19.0/debian/patches/series python-pylxd-0.19.0/debian/patches/series
--- python-pylxd-0.19.0/debian/patches/series	1969-12-31 21:00:00.000000000 -0300
+++ python-pylxd-0.19.0/debian/patches/series	2016-02-03 16:37:28.000000000 -0300
@@ -0,0 +1 @@
+01-support-newer-python.patch
Download as text