[pytango] 16/21: add a run_server class method to Device
Sandor Bodo-Merle
sbodomerle-guest at moszumanska.debian.org
Thu Sep 28 19:16:34 UTC 2017
This is an automated email from the git hooks/post-receive script.
sbodomerle-guest pushed a commit to annotated tag v9.2.0a
in repository pytango.
commit befdf477cbd954e2f011d15fcee81163b22ad8b2
Author: Vincent Michel <vincent.michel at maxlab.lu.se>
Date: Tue Oct 6 17:13:21 2015 +0200
add a run_server class method to Device
---
src/boost/python/server.py | 24 ++++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
diff --git a/src/boost/python/server.py b/src/boost/python/server.py
index f0dfddf..8356fc6 100644
--- a/src/boost/python/server.py
+++ b/src/boost/python/server.py
@@ -585,7 +585,7 @@ class Device(LatestDeviceImpl):
def get_device_properties(self, ds_class = None):
if ds_class is None:
try:
- # Call this method in a try/except in case this is called during
+ # Call this method in a try/except in case this is called during
# the DS shutdown sequence
ds_class = self.get_device_class()
except:
@@ -599,7 +599,7 @@ class Device(LatestDeviceImpl):
value = pu.get_property_values(prop_name, class_prop)
self._tango_properties[prop_name] = value
for prop_name in self.device_property_list:
- value = self.prop_util.get_property_values(prop_name,
+ value = self.prop_util.get_property_values(prop_name,
self.device_property_list)
self._tango_properties[prop_name] = value
except DevFailed as df:
@@ -622,6 +622,26 @@ class Device(LatestDeviceImpl):
"""
pass
+ @classmethod
+ def run_server(cls, args=None, **kwargs):
+ """Run the class as a device server.
+ It is based on the PyTango.server.run method.
+
+ The difference is that the device class
+ and server name are automatically given.
+
+ Args:
+ args (iterable): args as given in the PyTango.server.run method
+ without the server name. If None, the sys.argv
+ list is used
+ kwargs: the other keywords argument are as given
+ in the PyTango.server.run method.
+ """
+ if args is None:
+ args = sys.argv[1:]
+ args = [cls.__name__] + list(args)
+ return run((cls,), args, **kwargs)
+
class attribute(AttrData):
'''
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/pytango.git
More information about the debian-science-commits
mailing list