Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrederic Leger2013-01-16 03:34:18 -0500
committerAnton Leherbauer2013-01-16 03:34:18 -0500
commit7997d52dc1d0e5a24de734a80016c65329cc9149 (patch)
treefe155ca75d2b22b3789737c82e696f45d61807fd /python/src/tcf/__init__.py
parent61435e0455753f81c20f42b9eef51f925da293ba (diff)
downloadorg.eclipse.tcf-7997d52dc1d0e5a24de734a80016c65329cc9149.tar.gz
org.eclipse.tcf-7997d52dc1d0e5a24de734a80016c65329cc9149.tar.xz
org.eclipse.tcf-7997d52dc1d0e5a24de734a80016c65329cc9149.zip
TCF Python: Bug 397827 - Use relative imports inside tcf package modules
Diffstat (limited to 'python/src/tcf/__init__.py')
-rw-r--r--python/src/tcf/__init__.py25
1 files changed, 17 insertions, 8 deletions
diff --git a/python/src/tcf/__init__.py b/python/src/tcf/__init__.py
index 9978c6234..ec5e6b937 100644
--- a/python/src/tcf/__init__.py
+++ b/python/src/tcf/__init__.py
@@ -1,5 +1,5 @@
-# *******************************************************************************
-# * Copyright (c) 2011 Wind River Systems, Inc. and others.
+# *****************************************************************************
+# * Copyright (c) 2011, 2013 Wind River Systems, Inc. and others.
# * All rights reserved. This program and the accompanying materials
# * are made available under the terms of the Eclipse Public License v1.0
# * which accompanies this distribution, and is available at
@@ -7,21 +7,24 @@
# *
# * Contributors:
# * Wind River Systems - initial API and implementation
-# *******************************************************************************
+# *****************************************************************************
"""
TCF - Target Communication Framework
"""
import types
-import protocol, peer, channel
-from util import task
+
+from . import protocol, peer, channel
+from .util import task
__all__ = ('connect')
+
def connect(params, wait=True):
- """Connect to peer. Argument is a string of the form <transport>:<host>:<port>,
- e.g. "TCP:127.0.0.1:1534" """
+ """Connect to peer. Argument is a string of the form
+ <transport>:<host>:<port>, e.g. "TCP:127.0.0.1:1534".
+ """
if type(params) is types.StringType:
params = _parse_params(params)
elif type(params) is not types.DictType:
@@ -33,24 +36,30 @@ def connect(params, wait=True):
c = protocol.invokeAndWait(p.openChannel)
return c
+
def peers():
"Return list of discovered remote peers"
locator = protocol.getLocator()
if locator:
return protocol.invokeAndWait(locator.getPeers)
+
def _openChannel(p, done=None):
assert protocol.isDispatchThread()
c = p.openChannel()
- if done is None: return
+ if done is None:
+ return
+
class ChannelListener(channel.ChannelListener):
def onChannelOpened(self):
c.removeChannelListener(self)
done(None, c)
+
def onChannelClosed(self, error):
done(error, None)
c.addChannelListener(ChannelListener())
+
def _parse_params(paramStr):
args = paramStr.split(":")
if len(args) != 3:

Back to the top