[pytango] 05/37: add a run_server class method to Device

Sandor Bodo-Merle sbodomerle-guest at moszumanska.debian.org
Thu Sep 28 19:16:54 UTC 2017


This is an automated email from the git hooks/post-receive script.

sbodomerle-guest pushed a commit to annotated tag v9.2.0b
in repository pytango.

commit 721ddbd0c6483ec3995af64f57d894cf009323f2
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 | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/src/boost/python/server.py b/src/boost/python/server.py
index 18c096c..9653438 100644
--- a/src/boost/python/server.py
+++ b/src/boost/python/server.py
@@ -535,6 +535,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