[pytango] 262/483: preparing for 8.1.0

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


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

sbodomerle-guest pushed a commit to annotated tag bliss_8.10
in repository pytango.

commit 73d6affb4e17726f4eb17d022ae18da340de89ae
Author: tiagocoutinho <tiagocoutinho at 4e9c00fd-8f2e-0410-aa12-93ce3db5e235>
Date:   Mon May 27 20:58:58 2013 +0000

    preparing for 8.1.0
    
    git-svn-id: http://svn.code.sf.net/p/tango-cs/code/bindings/PyTango/trunk@22709 4e9c00fd-8f2e-0410-aa12-93ce3db5e235
---
 doc/revision.rst                     |   5 ++
 src/boost/cpp/constants.cpp          |   2 +-
 src/boost/cpp/database.cpp           |  59 ++++++++++++-
 src/boost/cpp/db.cpp                 |  40 +++++++--
 src/boost/cpp/device_proxy.cpp       |   3 +
 src/boost/cpp/precompiled_header.hpp |   1 +
 src/boost/python/__init__.py         |   8 +-
 src/boost/python/db.py               | 166 ++++++++++++++++++++++++++++++++++-
 src/boost/python/device_proxy.py     |  14 +++
 src/boost/python/release.py          |   6 +-
 10 files changed, 287 insertions(+), 17 deletions(-)

diff --git a/doc/revision.rst b/doc/revision.rst
index 939582e..967dd64 100644
--- a/doc/revision.rst
+++ b/doc/revision.rst
@@ -71,6 +71,8 @@ History of modifications:
 +----------+----------------------------------------------------------------------------------+-----------------------------------------------------+-----------------------+
 | 20/05/13 | `8.16 <http://www.tango-controls.org/static/PyTango/v803/doc/html/index.html>`_  | Update to PyTango 8.0.3                             | T\. Coutinho          |
 +----------+----------------------------------------------------------------------------------+-----------------------------------------------------+-----------------------+
+|   /07/13 | `8.17 <http://www.tango-controls.org/static/PyTango/v810/doc/html/index.html>`_  | Update to PyTango 8.1.0                             | T\. Coutinho          |
++----------+----------------------------------------------------------------------------------+-----------------------------------------------------+-----------------------+
 
 .. _version-history:
 
@@ -80,6 +82,9 @@ Version history
 +------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
 | version    | Changes                                                                                                                                                                      |
 +============+==============================================================================================================================================================================+
+| 8.1.0      | Features:                                                                                                                                                                    |
+|            |     - Implemented tango C++ 8.1 API                                                                                                                                          |
++------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
 | 8.0.3      | Features:                                                                                                                                                                    |
 |            |     - from sourceforge:                                                                                                                                                      |
 |            |         - `88: Implement Util::server_set_event_loop method in python <https://sourceforge.net/p/tango-cs/feature-requests/88>`_                                             |
diff --git a/src/boost/cpp/constants.cpp b/src/boost/cpp/constants.cpp
index e771477..974f5d7 100644
--- a/src/boost/cpp/constants.cpp
+++ b/src/boost/cpp/constants.cpp
@@ -188,7 +188,7 @@ void export_constants()
     consts_scope.attr("UnitNotSpec") = UnitNotSpec;
     consts_scope.attr("StdUnitNotSpec") = StdUnitNotSpec;
     consts_scope.attr("DispUnitNotSpec") = DispUnitNotSpec;
-    consts_scope.attr("FormatNotSpec") = FormatNotSpec;
+    //consts_scope.attr("FormatNotSpec") = FormatNotSpec;
     consts_scope.attr("NotANumber") = NotANumber;
     consts_scope.attr("MemNotUsed") = MemNotUsed;
     consts_scope.attr("MemAttrPropName") = MemAttrPropName;
diff --git a/src/boost/cpp/database.cpp b/src/boost/cpp/database.cpp
index c7b1910..f9a9c44 100644
--- a/src/boost/cpp/database.cpp
+++ b/src/boost/cpp/database.cpp
@@ -125,6 +125,38 @@ struct PyDatabase
     //{
     //    return boost::python::str(self.get_file_name());
     //}
+
+    static inline boost::python::str
+    get_device_from_alias(Tango::Database& self, const std::string &input)
+    {
+        std::string output;
+        self.get_device_from_alias(input, output);
+        return boost::python::str(output);
+    }
+    
+    static inline boost::python::str
+    get_alias_from_device(Tango::Database& self, const std::string &input)
+    {
+        std::string output;
+        self.get_alias_from_device(input, output);
+        return boost::python::str(output);
+    }
+    
+    static inline boost::python::str
+    get_attribute_from_alias(Tango::Database& self, const std::string &input)
+    {
+        std::string output;
+        self.get_attribute_from_alias(input, output);
+        return boost::python::str(output);
+    }
+    
+    static inline boost::python::str
+    get_alias_from_attribute(Tango::Database& self, const std::string &input)
+    {
+        std::string output;
+        self.get_alias_from_attribute(input, output);
+        return boost::python::str(output);
+    }
 };
 
 void export_database()
@@ -137,6 +169,8 @@ void export_database()
         &Tango::Database::get_host_list;
     Tango::DbDatum (Tango::Database::*get_services_)(std::string &, std::string &) =
         &Tango::Database::get_services;
+    Tango::DbDatum (Tango::Database::*get_device_service_list_)(std::string &) =
+        &Tango::Database::get_device_service_list;
     void (Tango::Database::*register_service_)(std::string &, std::string &, std::string &) =
         &Tango::Database::register_service;
     void (Tango::Database::*unregister_service_)(std::string &, std::string &) =
@@ -208,6 +242,8 @@ void export_database()
 
     Tango::DbDevImportInfo (Tango::Database::*import_device_)(std::string &) =
         &Tango::Database::import_device;
+    Tango::DbDevFullInfo (Tango::Database::*get_device_info_)(std::string &) =
+        &Tango::Database::get_device_info;
     
     Tango::DbDatum (Tango::Database::*get_attribute_alias_list_)(std::string &) =
         &Tango::Database::get_attribute_alias_list;
@@ -264,6 +300,9 @@ void export_database()
         .def("get_services",
             (Tango::DbDatum (Tango::Database::*) (const std::string &, const std::string &))
             get_services_)
+        .def("get_device_service_list",
+            (Tango::DbDatum (Tango::Database::*) (const std::string &))
+            get_device_service_list_)
         .def("register_service",
             (void (Tango::Database::*) (const std::string &, const std::string &, const std::string &))
             register_service_)
@@ -277,10 +316,14 @@ void export_database()
 
         .def("add_device", &Tango::Database::add_device)
         .def("delete_device", &Tango::Database::delete_device)
-        .def("import_device", (Tango::DbDevImportInfo (Tango::Database::*) (const std::string &))
-        import_device_)
+        .def("import_device", 
+            (Tango::DbDevImportInfo (Tango::Database::*) (const std::string &))
+            import_device_)
         .def("export_device", &Tango::Database::export_device)
         .def("unexport_device", &Tango::Database::unexport_device)
+        .def("get_device_info", 
+            (Tango::DbDevFullInfo (Tango::Database::*) (const std::string &))
+            get_device_info_)
         .def("get_device_name",
             (Tango::DbDatum (Tango::Database::*) (const string &, const string &))
             get_device_name_)
@@ -316,7 +359,7 @@ void export_database()
         .def("delete_device_alias",
             (void (Tango::Database::*) (const std::string &))
             delete_device_alias_)
-
+        
         //
         // server methods
         //
@@ -331,6 +374,8 @@ void export_database()
         .def("unexport_server",
             (void (Tango::Database::*) (const std::string &))
             unexport_server_)
+        .def("rename_server", &Tango::Database::rename_server,
+            ( arg_("self"), arg_("old_ds_name"), arg_("new_ds_name") ))
         .def("get_server_info",
             (Tango::DbServerInfo (Tango::Database::*) (const std::string &))
             get_server_info_)
@@ -453,6 +498,14 @@ void export_database()
         .def("unexport_event",
             (void (Tango::Database::*) (const std::string &))
             &Tango::Database::unexport_event)
+
+// alias methods
+
+        .def("get_device_from_alias", &PyDatabase::get_device_from_alias)
+        .def("get_alias_from_device", &PyDatabase::get_alias_from_device)
+        .def("get_attribute_from_alias", &PyDatabase::get_attribute_from_alias)
+        .def("get_alias_from_attribute", &PyDatabase::get_alias_from_attribute)
+
         ;
 }
 
diff --git a/src/boost/cpp/db.cpp b/src/boost/cpp/db.cpp
index fcf2b44..136649a 100644
--- a/src/boost/cpp/db.cpp
+++ b/src/boost/cpp/db.cpp
@@ -29,6 +29,15 @@ using namespace boost::python;
 
 void export_database();
 
+namespace PyDbServerData {
+
+    static inline boost::python::str get_name(Tango::DbServerData &self)
+    {
+        return boost::python::str(self.get_name());
+    }
+
+};
+
 void export_db()
 {
     // Note: DbDatum in python is extended to support the python sequence API
@@ -59,8 +68,16 @@ void export_db()
         .def_readonly("ior", &Tango::DbDevImportInfo::ior)
         .def_readonly("version", &Tango::DbDevImportInfo::version)
     ;
+    
+    class_<Tango::DbDevFullInfo, bases<Tango::DbDevImportInfo> >("DbDevFullInfo")
+        .def_readonly("class_name", &Tango::DbDevFullInfo::class_name)
+        .def_readonly("ds_full_name", &Tango::DbDevFullInfo::ds_full_name)
+        .def_readonly("started_date", &Tango::DbDevFullInfo::started_date)
+        .def_readonly("stopped_date", &Tango::DbDevFullInfo::stopped_date)
+        .def_readonly("pid", &Tango::DbDevFullInfo::pid)
+    ;
 
-     class_<Tango::DbDevInfo>("DbDevInfo")
+    class_<Tango::DbDevInfo>("DbDevInfo")
         .def_readwrite("name", &Tango::DbDevInfo::name)
         .def_readwrite("_class", &Tango::DbDevInfo::_class)
         .def_readwrite("klass", &Tango::DbDevInfo::_class)
@@ -78,10 +95,23 @@ void export_db()
     ;
 
     class_<Tango::DbServerInfo>("DbServerInfo")
-         .def_readwrite("name", &Tango::DbServerInfo::name)
-         .def_readwrite("host", &Tango::DbServerInfo::host)
-         .def_readwrite("mode", &Tango::DbServerInfo::mode)
-         .def_readwrite("level", &Tango::DbServerInfo::level)
+        .def_readwrite("name", &Tango::DbServerInfo::name)
+        .def_readwrite("host", &Tango::DbServerInfo::host)
+        .def_readwrite("mode", &Tango::DbServerInfo::mode)
+        .def_readwrite("level", &Tango::DbServerInfo::level)
+    ;
+    
+    class_<Tango::DbServerData>("DbServerData",
+        init<const std::string, const std::string>())
+        .def("get_name", &PyDbServerData::get_name)
+        .def("put_in_database", &Tango::DbServerData::put_in_database)
+        .def("already_exist", &Tango::DbServerData::already_exist)
+        .def("remove", 
+             (void (Tango::DbServerData::*) ())
+             &Tango::DbServerData::remove)
+        .def("remove", 
+             (void (Tango::DbServerData::*) (const std::string &))
+             &Tango::DbServerData::remove)
     ;
 
     export_database();
diff --git a/src/boost/cpp/device_proxy.cpp b/src/boost/cpp/device_proxy.cpp
index ab94662..bc5c099 100644
--- a/src/boost/cpp/device_proxy.cpp
+++ b/src/boost/cpp/device_proxy.cpp
@@ -442,6 +442,9 @@ void export_device_proxy()
         .def("alias", &Tango::DeviceProxy::alias,
             ( arg_("self") ) )
 
+        .def("get_tango_lib_version", &Tango::DeviceProxy::get_tango_lib_version,
+            ( arg_("self") ) )        
+
         .def("ping", &PyDeviceProxy::ping,
             ( arg_("self") ) )
             
diff --git a/src/boost/cpp/precompiled_header.hpp b/src/boost/cpp/precompiled_header.hpp
index 854742f..9814d4f 100644
--- a/src/boost/cpp/precompiled_header.hpp
+++ b/src/boost/cpp/precompiled_header.hpp
@@ -26,6 +26,7 @@
 // We don't want to waste those seconds for each cpp file, so we
 // use this precompiled header.
 
+//#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
 
 #include <boost/python.hpp>
 #include <boost/version.hpp>
diff --git a/src/boost/python/__init__.py b/src/boost/python/__init__.py
index 4dfcee8..64e8aee 100644
--- a/src/boost/python/__init__.py
+++ b/src/boost/python/__init__.py
@@ -43,8 +43,8 @@ __all__ = [ 'AccessControlType', 'ApiUtil', 'ArchiveEventInfo',
 'CommunicationFailed', 'Connection', 'ConnectionFailed',
 'ConstDevString', 'DServer', 'DataReadyEventData', 'Database', 'DbData',
 'DbDatum', 'DbDevExportInfo', 'DbDevExportInfos', 'DbDevImportInfo',
-'DbDevImportInfos', 'DbDevInfo', 'DbDevInfos', 'DbHistory',
-'DbHistoryList', 'DbServerInfo', 'DebugIt', 'DevBoolean', 'DevCommandInfo',
+'DbDevImportInfos', 'DbDevFullInfo', 'DbDevInfo', 'DbDevInfos', 'DbHistory',
+'DbHistoryList', 'DbServerInfo', 'DbServerData', 'DebugIt', 'DevBoolean', 'DevCommandInfo',
 'DevDouble', 'DevEncoded', 'DevError', 'DevFailed', 'DevFloat', 'DevInt',
 'DevLong', 'DevLong64', 'DevShort', 'DevSource', 'DevState', 'DevString',
 'DevUChar', 'DevULong', 'DevULong64', 'DevUShort', 'DevVarBooleanArray',
@@ -130,8 +130,8 @@ from ._PyTango import (AccessControlType, ApiUtil, ArchiveEventInfo,
     CmdDoneEvent, CommandInfo, CommandInfoList, CommunicationFailed,
     Connection, ConnectionFailed, ConstDevString, DServer, DataReadyEventData,
     Database, DbData, DbDatum, DbDevExportInfo, DbDevExportInfos,
-    DbDevImportInfo, DbDevImportInfos, DbDevInfo, DbDevInfos, DbHistory,
-    DbHistoryList, DbServerInfo, DevBoolean, DevCommandInfo, DevDouble,
+    DbDevImportInfo, DbDevImportInfos, DbDevFullInfo, DbDevInfo, DbDevInfos, DbHistory,
+    DbHistoryList, DbServerInfo, DbServerData, DevBoolean, DevCommandInfo, DevDouble,
     DevEncoded, DevError, DevFailed, DevFloat, DevInt, DevLong, DevLong64,
     DevShort, DevSource, DevState, DevString, DevUChar, DevULong, DevULong64,
     DevUShort, DevVarBooleanArray, DevVarCharArray, DevVarDoubleArray,
diff --git a/src/boost/python/db.py b/src/boost/python/db.py
index dad4d9a..d1d823a 100644
--- a/src/boost/python/db.py
+++ b/src/boost/python/db.py
@@ -33,7 +33,7 @@ import collections
 
 from ._PyTango import StdStringVector, Database, DbDatum, DbData, \
     DbDevInfo, DbDevInfos, DbDevImportInfo, DbDevExportInfo, DbDevExportInfos, \
-    DbHistory, DbServerInfo
+    DbHistory, DbServerInfo, DbServerData
 
 from .utils import is_pure_str, is_non_str_seq, seq_2_StdStringVector, \
     seq_2_DbDevInfos, seq_2_DbDevExportInfos, seq_2_DbData, DbData_2_dict
@@ -1008,6 +1008,18 @@ def __doc_Database():
         New in PyTango 3.0.4
     """ )
 
+    document_method("get_device_service_list", """
+    get_device_service_list(self, dev_name) -> DbDatum
+
+            Query database for the list of services provided by the given device.
+
+        Parameters :
+            - dev_name : (str) device name
+        Return     : DbDatum with the list of services
+
+        New in PyTango 8.1.0
+    """ )
+    
     document_method("register_service", """
     register_service(self, serv_name, inst_name, dev_name) -> None
 
@@ -1080,6 +1092,30 @@ def __doc_Database():
         Return     : DbDevImportInfo
     """ )
 
+    document_method("get_device_info", """
+    get_device_info(self, dev_name) -> DbDevFullInfo
+
+            Query the databse for the full info of the specified device.
+
+            Example :
+                dev_info = db.get_device_info('my/own/device')
+                print(dev_info.name)
+                print(dev_info.class_name)
+                print(dev_info.ds_full_name)
+                print(dev_info.exported)
+                print(dev_info.ior)
+                print(dev_info.version)
+                print(dev_info.pid)
+                print(dev_info.started_date)
+                print(dev_info.stopped_date)
+
+        Parameters :
+            - dev_name : (str) device name
+        Return     : DbDevFullInfo
+        
+        New in PyTango 8.1.0
+    """ )
+
     document_method("export_device", """
     export_device(self, dev_export) -> None
 
@@ -1179,6 +1215,9 @@ def __doc_Database():
         Parameters :
             - alias : (str) alias
         Return     : device name
+
+        .. deprecated:: 8.1.0
+            Use :meth:`~PyTango.Database.get_device_from_alias` instead
     """ )
 
     document_method("get_alias", """
@@ -1191,6 +1230,33 @@ def __doc_Database():
         Return     : alias
 
         New in PyTango 3.0.4
+        
+        .. deprecated:: 8.1.0
+            Use :meth:`~PyTango.Database.get_alias_from_device` instead
+    """ )
+
+    document_method("get_device_from_alias", """
+    get_device_from_alias(self, alias) -> str
+
+            Get the device name from an alias.
+
+        Parameters :
+            - alias : (str) alias
+        Return     : device name
+        
+        New in PyTango 8.1.0
+    """ )
+
+    document_method("get_alias_from_device", """
+    get_alias_from_device(self, alias) -> str
+
+            Get the device alias name from its name.
+
+        Parameters :
+            - alias : (str) device name
+        Return     : alias
+
+        New in PyTango 8.1.0
     """ )
 
     document_method("get_device_alias_list", """
@@ -1320,6 +1386,21 @@ def __doc_Database():
         Throws     : ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError)
     """ )
 
+    document_method("rename_server", """
+    rename_server(self, old_ds_name, new_ds_name) -> None
+
+            Rename a device server process.
+
+        Parameters :
+            - old_ds_name : (str) old name
+            - new_ds_name : (str) new name
+        Return     : None
+
+        Throws     : ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError)
+        
+        New in PyTango 8.1.0
+    """ )
+
     document_method("get_server_info", """
     get_server_info(self, server) -> DbServerInfo
 
@@ -1874,8 +1955,39 @@ def __doc_Database():
         Return     :  full attribute name
 
         Throws     : ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError)
+        
+        .. deprecated:: 8.1.0
+            Use :meth:`~PyTango.Database.get_attribute_from_alias` instead
+    """ )
+
+    document_method("get_attribute_from_alias", """
+    get_attribute_from_alias(self, alias) -> str
+
+            Get the full attribute name from an alias.
+
+        Parameters :
+            - alias : (str) attribute alias
+        Return     :  full attribute name
+
+        Throws     : ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError)
+        
+        New in PyTango 8.1.0
     """ )
 
+    document_method("get_alias_from_attribute", """
+    get_alias_from_attribute(self, attr_name) -> str
+
+            Get the attribute alias from the full attribute name.
+
+        Parameters :
+            - attr_name : (str) full attribute name
+        Return     :  attribute alias
+
+        Throws     : ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError)
+        
+        New in PyTango 8.1.0
+    """ )
+    
     document_method("get_attribute_alias_list", """
     get_attribute_alias_list(self, filter) -> DbDatum
 
@@ -2084,6 +2196,57 @@ def __doc_DbServerInfo():
         - mode : (str) mode
         - level : (str) level"""
 
+def __doc_DbServerData():
+    def document_method(method_name, desc, append=True):
+        return __document_method(DbServerData, method_name, desc, append)
+        
+    DbServerData.__doc__ = """\
+    A structure used for moving DS from one tango host to another.
+    Create a new instance by: DbServerData(<server name>, <server instance>)"""
+
+    document_method("get_name", """
+    get_name(self) -> str
+
+            Returns the full server name
+
+        Parameters : None
+        Return     : (str) the full server name
+    """ )
+
+    document_method("put_in_database", """
+    put_in_database(self, tg_host) -> None
+
+            Store all the data related to the device server process in the 
+            database specified by the input arg.
+
+        Parameters :
+            - tg_host : (str) The tango host for the new database
+        Return     : None
+    """ )
+    
+    document_method("already_exist", """
+    already_exist(self, tg_host) -> bool
+
+            Check if any of the device server process device(s) is already
+            defined in the database specified by the tango host given as input arg
+
+        Parameters :
+            - tg_host : (str) The tango host for the new database
+        Return     : (str) True in case any of the device is already known. False otherwise
+    """ )
+
+    document_method("remove", """
+    remove(self) -> None
+    remove(self, tg_host) -> None
+
+            Remove device server process from a database.
+
+        Parameters :
+            - tg_host : (str) The tango host for the new database
+        Return     : None
+    """ )  
+    
+       
 def db_init(doc=True):
     __init_DbDatum()
     if doc:
@@ -2097,4 +2260,5 @@ def db_init(doc=True):
         __doc_DbDevInfo()
         __doc_DbHistory()
         __doc_DbServerInfo()
+        __doc_DbServerData()
 
diff --git a/src/boost/python/device_proxy.py b/src/boost/python/device_proxy.py
index 47e431c..677a821 100644
--- a/src/boost/python/device_proxy.py
+++ b/src/boost/python/device_proxy.py
@@ -1001,8 +1001,22 @@ def __doc_DeviceProxy():
 
             Return the device alias if one is defined.
             Otherwise, throws exception.
+
+        Return     : (str) device alias
     """ )
 
+    document_method("get_tango_lib_version", """
+    get_tango_lib_version(self) -> int
+
+            Returns the Tango lib version number used by the remote device
+            Otherwise, throws exception.
+
+        Return     : (int) The device Tango lib version as a 3 or 4 digits number.
+                     Possible return value are: 100,200,500,520,700,800,810,...
+        
+        New in PyTango 8.1.0
+    """ )
+    
     document_method("ping", """
     ping(self) -> int
 
diff --git a/src/boost/python/release.py b/src/boost/python/release.py
index 40e8af4..4e72786 100644
--- a/src/boost/python/release.py
+++ b/src/boost/python/release.py
@@ -52,10 +52,10 @@ class Release:
             - keywords : (seq<str>) list of keywords
             - license : (str) the license"""
     name = 'PyTango'
-    version_info = (8, 0, 3, 'final', 0)
+    version_info = (8, 1, 0, 'dev', 0)
     version = '.'.join(map(str, version_info[:3]))
     version_long = version + ''.join(map(str, version_info[3:]))
-    version_description = 'This version implements the C++ Tango 8.0 API.'
+    version_description = 'This version implements the C++ Tango 8.1 API.'
     version_number = int(version.replace('.',''))
     description = 'A python binding for the Tango control system'
     long_description = 'This module implements the Python Tango Device API ' \
@@ -65,6 +65,6 @@ class Release:
     author_lines = "\n".join([ "%s <%s>" % x for x in authors.values()])
     url = 'http://www.tango-controls.org/static/PyTango/'
     download_url = 'http://pypi.python.org/packages/source/P/PyTango'
-    platform = ['Linux', 'Windows XP/Vista/7']
+    platform = ['Linux', 'Windows XP/Vista/7/8']
     keywords = ['Tango', 'CORBA', 'binding']
     

-- 
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