diff options
Diffstat (limited to 'bitbake/lib/bb')
-rw-r--r-- | bitbake/lib/bb/server/xmlrpc.py | 21 |
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 | ||
57 | class BBTransport(xmlrpclib.Transport): | 59 | class BBTransport(xmlrpclib.Transport): |
@@ -107,6 +109,18 @@ class BBTransport(xmlrpclib.Transport): | |||
107 | 109 | ||
108 | return u.close() | 110 | return u.close() |
109 | 111 | ||
112 | def _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 | |||
110 | class BitBakeServerCommands(): | 124 | class 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 | ||
241 | class BitBakeServerConnection(): | 255 | class 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) |