[lxc-devel] [pylxd/master] Fix six.PY34 into six.PY3

thomasgoirand on Github lxc-bot at linuxcontainers.org
Tue Mar 8 10:05:38 UTC 2016


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 389 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20160308/8e3e418e/attachment.bin>
-------------- next part --------------
From a654bdc5378e0f0ce0f22ad0ef1550dc7876c9e8 Mon Sep 17 00:00:00 2001
From: Thomas Goirand <zigo at debian.org>
Date: Tue, 8 Mar 2016 10:55:48 +0100
Subject: [PATCH] Fix six.PY34 into six.PY3

This otherwise fail to build in Jessie.
---
 pylxd/deprecated/connection.py            | 4 ++--
 pylxd/deprecated/tests/test_connection.py | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/pylxd/deprecated/connection.py b/pylxd/deprecated/connection.py
index 5ef884e..544c8fd 100644
--- a/pylxd/deprecated/connection.py
+++ b/pylxd/deprecated/connection.py
@@ -50,7 +50,7 @@ class UnixHTTPConnection(http_client.HTTPConnection):
 
     def __init__(self, path, host='localhost', port=None, strict=None,
                  timeout=None):
-        if six.PY34:
+        if six.PY3:
             http_client.HTTPConnection.__init__(self, host, port=port,
                                                 timeout=timeout)
         else:
@@ -157,7 +157,7 @@ def _request(self, *args, **kwargs):
         status = response.status
         raw_body = response.read()
         try:
-            if six.PY34:
+            if six.PY3:
                 body = json.loads(raw_body.decode())
             else:
                 body = json.loads(raw_body)
diff --git a/pylxd/deprecated/tests/test_connection.py b/pylxd/deprecated/tests/test_connection.py
index 33c4ce9..30f8d2e 100644
--- a/pylxd/deprecated/tests/test_connection.py
+++ b/pylxd/deprecated/tests/test_connection.py
@@ -25,7 +25,7 @@
 from pylxd.deprecated import exceptions
 from pylxd.deprecated.tests import annotated_data
 
-if six.PY34:
+if six.PY3:
     from io import BytesIO
 
 
@@ -36,7 +36,7 @@ class LXDInitConnectionTest(unittest.TestCase):
     @mock.patch.object(http_client.HTTPConnection, '__init__')
     def test_http_connection(self, mc, ms):
         conn = connection.UnixHTTPConnection('/', 'host', 1234)
-        if six.PY34:
+        if six.PY3:
             mc.assert_called_once_with(
                 conn, 'host', port=1234, timeout=None)
         else:
@@ -105,7 +105,7 @@ class FakeResponse(object):
 
     def __init__(self, status, data):
         self.status = status
-        if six.PY34:
+        if six.PY3:
             self.read = BytesIO(six.b(data)).read
         else:
             self.read = cStringIO(data).read


More information about the lxc-devel mailing list