summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorJoshua Lock <josh@linux.intel.com>2011-03-05 17:01:14 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-03-14 20:48:37 +0000
commit7da9f27c376bbe54baef564b32c165a2a6e860f9 (patch)
treef65f5f80b9a7b46dcb716d0ffa46af44543e5bb3 /bitbake
parente58b3a480411515e9cb1d15adf4b7fa471ed4374 (diff)
downloadpoky-7da9f27c376bbe54baef564b32c165a2a6e860f9.tar.gz
bitbake/xmlrpc: only use BBTransport for affected Python versions
Upstream have fixed the xmlrpclip.Transport() bug from Python #8194 for the Python 2.7.2 release, therefore as we know which versions of the standard library are affected we can only use our copy/paste class when it's needed. Signed-off-by: Joshua Lock <josh@linux.intel.com>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/server/xmlrpc.py21
1 files changed, 17 insertions, 4 deletions
diff --git a/bitbake/lib/bb/server/xmlrpc.py b/bitbake/lib/bb/server/xmlrpc.py
index 0d03e308d0..e7b6010874 100644
--- a/bitbake/lib/bb/server/xmlrpc.py
+++ b/bitbake/lib/bb/server/xmlrpc.py
@@ -52,6 +52,8 @@ if sys.hexversion < 0x020600F0:
52# implementations from Python 2.6.6's xmlrpclib. 52# implementations from Python 2.6.6's xmlrpclib.
53# 53#
54# Upstream Python bug is #8194 (http://bugs.python.org/issue8194) 54# Upstream Python bug is #8194 (http://bugs.python.org/issue8194)
55# This bug is relevant for Python 2.7.0 and 2.7.1 but was fixed for
56# Python > 2.7.2
55## 57##
56 58
57class BBTransport(xmlrpclib.Transport): 59class BBTransport(xmlrpclib.Transport):
@@ -107,6 +109,18 @@ class BBTransport(xmlrpclib.Transport):
107 109
108 return u.close() 110 return u.close()
109 111
112def _create_server(host, port):
113 # Python 2.7.0 and 2.7.1 have a buggy Transport implementation
114 # For those versions of Python, and only those versions, use our
115 # own copy/paste BBTransport class.
116 if (2, 7, 0) <= sys.version_info < (2, 7, 2):
117 t = BBTransport()
118 s = xmlrpclib.Server("http://%s:%d/" % (host, port), transport=t, allow_none=True)
119 else:
120 s = xmlrpclib.Server("http://%s:%d/" % (host, port), allow_none=True)
121
122 return s
123
110class BitBakeServerCommands(): 124class BitBakeServerCommands():
111 def __init__(self, server, cooker): 125 def __init__(self, server, cooker):
112 self.cooker = cooker 126 self.cooker = cooker
@@ -116,8 +130,8 @@ class BitBakeServerCommands():
116 """ 130 """
117 Register a remote UI Event Handler 131 Register a remote UI Event Handler
118 """ 132 """
119 t = BBTransport() 133 s = _create_server(host, port)
120 s = xmlrpclib.Server("http://%s:%d/" % (host, port), transport=t, allow_none=True) 134
121 return bb.event.register_UIHhandler(s) 135 return bb.event.register_UIHhandler(s)
122 136
123 def unregisterEventHandler(self, handlerNum): 137 def unregisterEventHandler(self, handlerNum):
@@ -240,8 +254,7 @@ class BitbakeUILauch():
240 254
241class BitBakeServerConnection(): 255class BitBakeServerConnection():
242 def __init__(self, serverinfo): 256 def __init__(self, serverinfo):
243 t = BBTransport() 257 self.connection = _create_server(serverinfo.host, serverinfo.port)
244 self.connection = xmlrpclib.Server("http://%s:%s" % (serverinfo.host, serverinfo.port), transport=t, allow_none=True)
245 self.events = uievent.BBUIEventQueue(self.connection) 258 self.events = uievent.BBUIEventQueue(self.connection)
246 for event in bb.event.ui_queue: 259 for event in bb.event.ui_queue:
247 self.events.queue_event(event) 260 self.events.queue_event(event)