[pytango] 128/483: prepare for v8
Sandor Bodo-Merle
sbodomerle-guest at moszumanska.debian.org
Thu Sep 28 19:14:32 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 69715cea21931155abaf7f0e141bc3b42299e1e9
Author: tiagocoutinho <tiagocoutinho at 4e9c00fd-8f2e-0410-aa12-93ce3db5e235>
Date: Tue Sep 4 09:43:02 2012 +0000
prepare for v8
git-svn-id: http://svn.code.sf.net/p/tango-cs/code/bindings/PyTango/trunk@21073 4e9c00fd-8f2e-0410-aa12-93ce3db5e235
---
Makefile | 60 +++++++----
PyTango/__init__.py | 4 +-
PyTango/device_server.py | 96 +++++++++++++++--
PyTango/ipython/__init__.py | 2 +-
PyTango/log4tango.py | 6 +-
PyTango/pytango_pprint.py | 4 +-
PyTango/release.py | 20 ++--
setup.py | 128 ++++++++---------------
src/api_util.cpp | 3 +-
src/attribute_proxy.cpp | 18 ++--
src/constants.cpp | 7 +-
src/defs.h | 9 ++
src/device_attribute.h | 6 +-
src/device_attribute_numpy.hpp | 2 +-
src/fast_from_py.h | 12 +--
src/from_py.h | 2 +-
src/group_element.cpp | 187 +++++-----------------------------
src/locker_info.cpp | 10 +-
src/pytango.cpp | 2 +-
src/pyutils.h | 2 +
src/server/attr.cpp | 12 +--
src/server/attribute.cpp | 15 ++-
src/server/command.cpp | 35 ++++++-
src/server/tango_util.cpp | 2 +-
src/server/user_default_attr_prop.cpp | 19 ++--
src/server/wattribute.cpp | 3 +-
src/tgutils.h | 2 +-
27 files changed, 330 insertions(+), 338 deletions(-)
diff --git a/Makefile b/Makefile
index 0ec36c9..91dfe4a 100644
--- a/Makefile
+++ b/Makefile
@@ -33,59 +33,78 @@
# if target == install also needs: prefix=<install_dir>
# ex: make install prefix=/home/homer/.local/lib/python2.6/site-packages
#
+# Optional:
+# - OBJS_DIR: directory where files will be build (default: objs)
+# - PY3K: if defined use python 3 boost python
+# - PY_VER: use a specific python version (default is empty) (ex: 3.2)
ifndef TANGO_ROOT
TANGO_ROOT=/usr
endif
+ifdef PY_VER
+PY_EXC=python$(PY_VER)
+PY_MAJOR=$(shell $(PY_EXC) -c "import sys; sys.stdout.write(str(sys.version_info[0]))")
+PY_MINOR=$(shell $(PY_EXC) -c "import sys; sys.stdout.write(str(sys.version_info[1]))")
+else
+PY_EXC=python
+PY_MAJOR=$(shell $(PY_EXC) -c "import sys; sys.stdout.write(str(sys.version_info[0]))")
+PY_MINOR=$(shell $(PY_EXC) -c "import sys; sys.stdout.write(str(sys.version_info[1]))")
+PY_VER=$(PY_MAJOR).$(PY_MINOR)
+endif
+
+PY_VER_S=$(PY_MAJOR)$(PY_MINOR)
+
ifndef NUMPY_ROOT
-NUMPY_ROOT=$(shell python -c "import os; import numpy; print os.path.dirname(numpy.__file__)")/core
+NUMPY_ROOT=$(shell $(PY_EXC) -c "import sys, os, numpy; sys.stdout.write(os.path.dirname(numpy.__file__))")/core
endif
ifndef prefix
ifdef user
-_PY_DIR=$(shell python -c "import os; print os.path.split(os.path.join(os.path.dirname(os.__file__)))[1]")
+_PY_DIR=$(shell $(PY_EXC) -c "import sys, os; sys.stdout.write(os.path.split(os.path.join(os.path.dirname(os.__file__)))[1])")
prefix=$(HOME)/.local/lib/$(_PY_DIR)/site-packages
else
-_PY_DIR=$(shell python -c "import os; print os.path.join(os.path.dirname(os.__file__))")
+_PY_DIR=$(shell $(PY_EXC) -c "import sys, os; sys.stdout.write(os.path.join(os.path.dirname(os.__file__)))")
prefix=$(_PY_DIR)/site-packages
endif
endif
SRC_DIR = src
-PRE_C_H = $(SRC_DIR)/precompiled_header.hpp
-PRE_C_H_O = $(PRE_C_H).gch
-
ifndef OBJS_DIR
-OBJS_DIR = objs
+OBJS_DIR = objs_py$(PY_VER_S)
endif
CC = gcc
-CCFLAGS = -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -fPIC $(INCLUDE_DIRS)
+PY_INC = $(shell python$(PY_VER)-config --includes)
+NUMPY_INC = -I$(NUMPY_ROOT)/include
+TANGO_INC = -I$(TANGO_ROOT)/include
+PRE_C_H = precompiled_header.hpp
+PRE_C_H_O = $(OBJS_DIR)/$(PRE_C_H).gch
+PRE_C = -include$(OBJS_DIR)/$(PRE_C_H)
LN = g++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions
LN_STATIC = g++ -pthread -static -Wl,-O1 -Wl,-Bsymbolic-functions
LN_VER = -Wl,-h -Wl,--strip-all
-LN_LIBS = -ltango -llog4tango -lpthread -lrt -ldl -lomniORB4 -lomniDynamic4 -lomnithread -lCOS4 -lboost_python
+BOOST_LIB = boost_python-py$(PY_VER_S)
+LN_LIBS = -ltango -llog4tango -lpthread -lrt -ldl -lomniORB4 -lomniDynamic4 -lomnithread -lCOS4 -l$(BOOST_LIB) -lzmq
LN_DIRS = -L$(TANGO_ROOT)/lib
-PY_INC = $(shell python-config --includes)
-NUMPY_INC = -I$(NUMPY_ROOT)/include
-TANGO_INC = -I$(TANGO_ROOT)/include
-PRE_C = -include$(PRE_C_H)
-
INCLUDE_DIRS = \
--Isrc \
-$(TANGO_INC) \
-$(TANGO_INC)/tango \
-$(PY_INC) \
-$(NUMPY_INC)
+ -Isrc \
+ $(TANGO_INC) \
+ $(TANGO_INC)/tango \
+ $(PY_INC) \
+ $(NUMPY_INC)
+
+CCFLAGS = -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -fPIC -std=c++0x $(INCLUDE_DIRS)
LIB_NAME = _PyTango.so
LIB_NAME_STATIC = _PyTangoStatic.so
LIB_SYMB_NAME = $(LIB_NAME).dbg
+
+
OBJS = \
$(OBJS_DIR)/api_util.o \
$(OBJS_DIR)/archive_event_info.o \
@@ -119,7 +138,6 @@ $(OBJS_DIR)/event_data.o \
$(OBJS_DIR)/exception.o \
$(OBJS_DIR)/from_py.o \
$(OBJS_DIR)/group.o \
-$(OBJS_DIR)/group_element.o \
$(OBJS_DIR)/group_reply.o \
$(OBJS_DIR)/group_reply_list.o \
$(OBJS_DIR)/locker_info.o \
@@ -173,7 +191,7 @@ build: init $(PRE_C_H_O) $(LIB_NAME)
init:
mkdir -p $(OBJS_DIR)
-$(PRE_C_H_O): $(PRE_C_H)
+$(PRE_C_H_O): $(SRC_DIR)/$(PRE_C_H)
$(CC) $(CCFLAGS) -c $< -o $(PRE_C_H_O)
#
diff --git a/PyTango/__init__.py b/PyTango/__init__.py
index d1d4631..7620c5d 100644
--- a/PyTango/__init__.py
+++ b/PyTango/__init__.py
@@ -60,7 +60,7 @@ __all__ = [ 'AccessControlType', 'ApiUtil', 'ArchiveEventInfo',
'DispLevel', 'EncodedAttribute', 'ErrSeverity', 'ErrorIt',
'EventData', 'EventProperties', 'EventSystemFailed', 'EventType',
'Except', 'ExtractAs', 'FMT_UNKNOWN', 'FatalIt', 'Group', 'GroupAttrReply',
-'GroupAttrReplyList', 'GroupCmdReply', 'GroupCmdReplyList', 'GroupElement',
+'GroupAttrReplyList', 'GroupCmdReply', 'GroupCmdReplyList',
'GroupReply', 'GroupReplyList', 'IMAGE', 'ImageAttr', 'InfoIt',
'KeepAliveCmdCode', 'Level', 'LockCmdCode', 'LockerInfo', 'LockerLanguage',
'LogIt', 'LogLevel', 'LogTarget', 'Logger', 'Logging', 'MessBoxType',
@@ -125,7 +125,7 @@ from ._PyTango import (AccessControlType, ApiUtil, ArchiveEventInfo,
Device_3Impl, Device_4Impl, DispLevel, EncodedAttribute, ErrSeverity,
EventData, EventSystemFailed, EventType,
Except, ExtractAs, FMT_UNKNOWN, GroupAttrReply, GroupAttrReplyList,
- GroupCmdReply, GroupCmdReplyList, GroupElement, GroupReply, GroupReplyList,
+ GroupCmdReply, GroupCmdReplyList, GroupReply, GroupReplyList,
IMAGE, ImageAttr, KeepAliveCmdCode, Level, LockCmdCode, LockerInfo,
LockerLanguage, LogLevel, LogTarget, Logger, Logging, MessBoxType,
MultiAttribute, MultiClassAttribute, NamedDevFailed, NamedDevFailedList,
diff --git a/PyTango/device_server.py b/PyTango/device_server.py
index 22e4d78..fbc3d67 100644
--- a/PyTango/device_server.py
+++ b/PyTango/device_server.py
@@ -2409,63 +2409,147 @@ def __doc_UserDefaultAttrProp():
""" )
document_method("set_abs_change", """
- set_abs_change(self, def_abs_change) -> None
+ set_abs_change(self, def_abs_change) -> None <= DEPRECATED
Set default change event abs_change property.
Parameters :
- def_abs_change : (str) the user default change event abs_change property
Return : None
+
+ Deprecated since PyTango 8.0. Please use set_event_abs_change instead.
+ """ )
+
+ document_method("set_event_abs_change", """
+ set_event_abs_change(self, def_abs_change) -> None
+
+ Set default change event abs_change property.
+
+ Parameters :
+ - def_abs_change : (str) the user default change event abs_change property
+ Return : None
+
+ New in PyTango 8.0
""" )
document_method("set_rel_change", """
- set_rel_change(self, def_rel_change) -> None
+ set_rel_change(self, def_rel_change) -> None <= DEPRECATED
+
+ Set default change event rel_change property.
+
+ Parameters :
+ - def_rel_change : (str) the user default change event rel_change property
+ Return : None
+
+ Deprecated since PyTango 8.0. Please use set_event_rel_change instead.
+ """ )
+
+ document_method("set_event_rel_change", """
+ set_event_rel_change(self, def_rel_change) -> None
Set default change event rel_change property.
Parameters :
- def_rel_change : (str) the user default change event rel_change property
Return : None
+
+ New in PyTango 8.0
""" )
document_method("set_period", """
- set_period(self, def_period) -> None
+ set_period(self, def_period) -> None <= DEPRECATED
Set default periodic event period property.
Parameters :
- def_period : (str) the user default periodic event period property
Return : None
+
+ Deprecated since PyTango 8.0. Please use set_event_period instead.
""" )
+ document_method("set_event_period", """
+ set_event_period(self, def_period) -> None
+
+ Set default periodic event period property.
+
+ Parameters :
+ - def_period : (str) the user default periodic event period property
+ Return : None
+
+ New in PyTango 8.0
+ """ )
+
document_method("set_archive_abs_change", """
- set_archive_abs_change(self, def_archive_abs_change) -> None
+ set_archive_abs_change(self, def_archive_abs_change) -> None <= DEPRECATED
Set default archive event abs_change property.
Parameters :
- def_archive_abs_change : (str) the user default archive event abs_change property
Return : None
+
+ Deprecated since PyTango 8.0. Please use set_archive_event_abs_change instead.
""" )
+ document_method("set_archive_event_abs_change", """
+ set_archive_event_abs_change(self, def_archive_abs_change) -> None
+
+ Set default archive event abs_change property.
+
+ Parameters :
+ - def_archive_abs_change : (str) the user default archive event abs_change property
+ Return : None
+
+ New in PyTango 8.0
+ """ )
+
document_method("set_archive_rel_change", """
- set_archive_rel_change(self, def_archive_rel_change) -> None
+ set_archive_rel_change(self, def_archive_rel_change) -> None <= DEPRECATED
+
+ Set default archive event rel_change property.
+
+ Parameters :
+ - def_archive_rel_change : (str) the user default archive event rel_change property
+ Return : None
+
+ Deprecated since PyTango 8.0. Please use set_archive_event_rel_change instead.
+ """ )
+
+ document_method("set_archive_event_rel_change", """
+ set_archive_event_rel_change(self, def_archive_rel_change) -> None
Set default archive event rel_change property.
Parameters :
- def_archive_rel_change : (str) the user default archive event rel_change property
Return : None
+
+ New in PyTango 8.0
""" )
document_method("set_archive_period", """
- set_archive_period(self, def_archive_period) -> None
+ set_archive_period(self, def_archive_period) -> None <= DEPRECATED
Set default archive event period property.
Parameters :
- def_archive_period : (str) t
Return : None
+
+ Deprecated since PyTango 8.0. Please use set_archive_event_period instead.
+ """ )
+
+ document_method("set_archive_event_period", """
+ set_archive_event_period(self, def_archive_period) -> None
+
+ Set default archive event period property.
+
+ Parameters :
+ - def_archive_period : (str) t
+ Return : None
+
+ New in PyTango 8.0
""" )
def device_server_init(doc=True):
diff --git a/PyTango/ipython/__init__.py b/PyTango/ipython/__init__.py
index 8a4e5b3..6083913 100644
--- a/PyTango/ipython/__init__.py
+++ b/PyTango/ipython/__init__.py
@@ -24,7 +24,7 @@
__all__ = ["init_ipython", "install", "load_ipython_extension",
"unload_ipython_extension", "load_config"]
-from common import get_python_version, get_python_version_number, \
+from .common import get_python_version, get_python_version_number, \
get_ipython_version, get_ipython_version_list, \
get_ipython_version_number, get_pytango_version, get_pytango_version_number
diff --git a/PyTango/log4tango.py b/PyTango/log4tango.py
index 06a5961..a609c88 100644
--- a/PyTango/log4tango.py
+++ b/PyTango/log4tango.py
@@ -43,8 +43,8 @@ __all__ = [ "TangoStream", "LogIt", "DebugIt", "InfoIt", "WarnIt",
__docformat__ = "restructuredtext"
-from utils import wraps
-
+import functools
+
class TangoStream:
def __init__(self, fn):
@@ -122,7 +122,7 @@ class LogIt(object):
return d.debug_stream
def __call__(self, f):
- @wraps(f)
+ @functools.wraps(f)
def log_stream(*args, **kwargs):
d = args[0]
if not self.is_enabled(d):
diff --git a/PyTango/pytango_pprint.py b/PyTango/pytango_pprint.py
index 416c35a..16b3f81 100644
--- a/PyTango/pytango_pprint.py
+++ b/PyTango/pytango_pprint.py
@@ -42,7 +42,7 @@ from ._PyTango import (StdStringVector, StdLongVector, CommandInfoList,
AttributeEventInfo, AttributeInfoEx,
DeviceAttribute, DeviceAttributeHistory, DeviceData, DeviceDataHistory,
DbDatum, DbDevInfo, DbDevImportInfo, DbDevExportInfo, DbServerInfo,
- GroupElement, GroupReply, GroupAttrReply, GroupCmdReply,
+ GroupReply, GroupAttrReply, GroupCmdReply,
DevError, EventData, AttrConfEventData, DataReadyEventData,
TimeVal, DevFailed, CmdArgType)
@@ -132,7 +132,7 @@ def __registerStructStr():
AttributeEventInfo, AttributeInfoEx,
DeviceAttribute, DeviceAttributeHistory, DeviceData, DeviceDataHistory,
DbDatum, DbDevInfo, DbDevImportInfo, DbDevExportInfo, DbServerInfo,
- GroupElement, GroupReply, GroupAttrReply, GroupCmdReply,
+ GroupReply, GroupAttrReply, GroupCmdReply,
DevError, EventData, AttrConfEventData, DataReadyEventData,
AttributeConfig, AttributeConfig_2, AttributeConfig_3,
ChangeEventProp, PeriodicEventProp, ArchiveEventProp,
diff --git a/PyTango/release.py b/PyTango/release.py
index 7b1a42d..4bccdfc 100644
--- a/PyTango/release.py
+++ b/PyTango/release.py
@@ -33,27 +33,33 @@ class Release:
"""
Release information:
- name : (str) package name
- - version_info : (tuple<int,int,int,str,int>) The five components of the version number: major, minor, micro, releaselevel, and serial.
+ - version_info : (tuple<int,int,int,str,int>) The five components
+ of the version number: major, minor, micro, releaselevel, and
+ serial.
- version : (str) package version in format <major>.<minor>.<micro>
- - version_long : (str) package version in format <major>.<minor>.<micro><releaselevel><serial>
- - version_description : (str) short description for the current version
+ - version_long : (str) package version in format
+ <major>.<minor>.<micro><releaselevel><serial>
+ - version_description : (str) short description for the current
+ version
- version_number : (int) <major>*100 + <minor>*10 + <micro>
- description : (str) package description
- long_description : (str) longer package description
- - authors : (dict<str(last name), tuple<str(full name),str(email)>>) package authors
+ - authors : (dict<str(last name), tuple<str(full name),str(email)>>)
+ package authors
- url : (str) package url
- download_url : (str) package download url
- platform : (seq<str>) list of available platforms
- keywords : (seq<str>) list of keywords
- license : (str) the license"""
name = 'PyTango'
- version_info = (7, 2, 3, 'final', 0)
+ version_info = (8, 0, 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 7.2 API.'
+ version_description = 'This version implements the C++ Tango 8.0 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 mapping'
+ long_description = 'This module implements the Python Tango Device API ' \
+ 'mapping.'
license = 'LGPL'
authors = { 'Coutinho' : ('Tiago Coutinho' , 'tcoutinho at cells.es') }
author_lines = "\n".join([ "%s <%s>" % x for x in authors.values()])
diff --git a/setup.py b/setup.py
index 26dfa26..09e0c84 100644
--- a/setup.py
+++ b/setup.py
@@ -28,7 +28,6 @@ import imp
from distutils.core import setup, Extension
from distutils.cmd import Command
-from distutils.errors import DistutilsOptionError
from distutils.command.build import build as dftbuild
from distutils.command.build_ext import build_ext as dftbuild_ext
from distutils.command.install import install as dftinstall
@@ -40,13 +39,13 @@ try:
import sphinx.util.console
sphinx.util.console.color_terminal = lambda : False
from sphinx.setup_command import BuildDoc
-except ImportError:
+except:
sphinx = None
try:
import IPython
_IPY_ROOT = os.path.dirname(os.path.abspath(IPython.__file__))
- _IPY_VER = map(int, IPython.__version__.split(".")[:2])
+ _IPY_VER = list(map(int, IPython.__version__.split(".")[:2]))
if _IPY_VER > [0,10]:
import IPython.utils.path
get_ipython_dir = IPython.utils.path.get_ipython_dir
@@ -59,7 +58,7 @@ except:
try:
import numpy
-except Exception, e:
+except:
numpy = None
@@ -81,38 +80,9 @@ def uniquify(seq):
[ no_dups.append(i) for i in seq if not no_dups.count(i) ]
return no_dups
-def get_numpy_root():
- return os.environ.get('NUMPY_ROOT', '/usr')
-
-def get_numpy_headers():
- if numpy is None:
- return None
-
- # first check location given by environment variable (if defined)
- has_numpy_root = 'NUMPY_ROOT' in os.environ
- if has_numpy_root:
- numpy_path = os.environ.get('NUMPY_ROOT')
- numpy_h = os.path.join(numpy_path, "include", "numpy")
- if os.path.exists(numpy_h):
- return numpy_h
-
- # ... then check inside numpy code
- numpy_paths = numpy.__path__
- for numpy_path in numpy_paths:
- numpy_path = os.path.abspath(numpy_path)
- numpy_h = os.path.join(numpy_path, "core", "include", "numpy")
- if os.path.exists(numpy_h):
- return numpy_h
-
- # fallback to default linux header location
- numpy_h = os.path.join("/usr", "include", "numpy")
- if os.path.exists(numpy_h):
- return numpy_h
-
def has_c_numpy():
- if numpy is None:
- return False
- return get_numpy_headers() is not None
+ NUMPY_ROOT = os.environ.get('NUMPY_ROOT', '/usr')
+ return os.path.isdir(os.path.join(NUMPY_ROOT, 'include','numpy'))
def has_numpy(with_src=True):
ret = numpy is not None
@@ -123,16 +93,14 @@ def has_numpy(with_src=True):
class build(dftbuild):
user_options = dftbuild.user_options + \
- [('with-pytango3', None, "distribute PyTango3 module"),
- ('without-ipython', None, "Tango IPython extension"),
+ [('without-ipython', None, "Tango IPython extension"),
('strip-lib', None, "strips the shared library of debugging symbols (Unix like systems only)"),
('no-doc', None, "do not build documentation") ]
- boolean_options = dftbuild.boolean_options + ['with-pytango3', 'without-ipython', 'strip-lib', 'no-doc']
+ boolean_options = dftbuild.boolean_options + ['without-ipython', 'strip-lib', 'no-doc']
- def initialize_options(self):
+ def initialize_options (self):
dftbuild.initialize_options(self)
- self.with_pytango3 = None
self.without_ipython = None
self.strip_lib = None
self.no_doc = None
@@ -141,8 +109,10 @@ class build(dftbuild):
dftbuild.finalize_options(self)
def run(self):
- if self.with_pytango3:
- self.distribution.packages.append('PyTango3')
+ if numpy is None:
+ self.warn('NOT using numpy: it is not available')
+ elif not has_c_numpy():
+ self.warn("NOT using numpy: numpy available but C source is not")
if IPython and not self.without_ipython:
if _IPY_VER > [0,10]:
@@ -175,11 +145,10 @@ class build(dftbuild):
if self.no_doc:
return False
if sphinx is None:
- self.warn("Documentation will not be generated: sphinx is not available")
return False
- v = map(int, sphinx.__version__.split("."))
+ v = list(map(int, sphinx.__version__.split(".")))
if v <= [0,6,5]:
- self.warn("Documentation will not be generated: sphinx version (%s) too low. Needs 0.6.6" % sphinx.__version__)
+ print("Documentation will not be generated: sphinx version (%s) too low. Needs 0.6.6" % sphinx.__version__)
return False
setup_dir = os.path.dirname(os.path.abspath(__file__))
return os.path.isdir(os.path.join(setup_dir, 'doc'))
@@ -189,36 +158,29 @@ class build(dftbuild):
class build_ext(dftbuild_ext):
- user_options = dftbuild_ext.user_options + \
- [('without-numpy', None, "don't use numpy optimization"),]
-
- boolean_options = dftbuild_ext.boolean_options + ['without-numpy']
-
- def initialize_options(self):
- dftbuild_ext.initialize_options(self)
- self.without_numpy = None
-
def build_extensions(self):
- if self.without_numpy:
- for extension in self.extensions:
- extension.define_macros.append(('DISABLE_PYTANGO_NUMPY', None))
- else:
- if numpy is None:
- raise DistutilsOptionError('Cannot use numpy: it is not '
- 'available. You can still compile without numpy usage '
- 'with --without-numpy')
- elif not has_c_numpy():
- raise DistutilsOptionError('Cannot use numpy: numpy '
- 'available but C source is not. You can still build_ext '
- 'without numpy usage with --without-numpy')
-
+ self.use_cpp_0x = False
if isinstance(self.compiler, UnixCCompiler):
compiler_pars = self.compiler.compiler_so
while '-Wstrict-prototypes' in compiler_pars:
del compiler_pars[compiler_pars.index('-Wstrict-prototypes')]
#self.compiler.compiler_so = " ".join(compiler_pars)
+
+ # mimic tango check to activate C++0x extension
+ import subprocess
+ compiler = self.compiler.compiler
+ gcc_ver = subprocess.check_output(compiler + ["-dumpversion"])
+ gcc_ver = gcc_ver.strip().decode().split(".")
+ gcc_ver = list(map(int, gcc_ver))
+ if gcc_ver >= [4,3,3]:
+ self.use_cpp_0x = True
dftbuild_ext.build_extensions(self)
+ def build_extension(self, ext):
+ if self.use_cpp_0x:
+ ext.extra_compile_args += ['-std=c++0x']
+ dftbuild_ext.build_extension(self, ext)
+
if sphinx:
class build_doc(BuildDoc):
@@ -289,8 +251,6 @@ def main():
BOOST_ROOT = os.environ.get('BOOST_ROOT', BOOST_ROOT)
NUMPY_ROOT = os.environ.get('NUMPY_ROOT', NUMPY_ROOT)
- numpy_h = get_numpy_headers()
-
Release = get_release_info()
author = Release.authors['Coutinho']
@@ -318,7 +278,6 @@ def main():
package_data = {
'PyTango' : [],
- 'PyTango.ipython' : ['resource/*'],
}
data_files = []
@@ -352,19 +311,17 @@ def main():
# #include <tango.h> to:
# #include <tango/tango.h>
# However tango itself complains that it doesn't know his own header files
- # if we don't add the $TANGO_ROOT/include/tango directory to the path.
- # So we do it here
+ # if we don't add the $TANGO_ROOT/include/tango directory to the path. So we do it
+ # here
_tango_root_inc = os.path.join(_tango_root_inc, 'tango')
if os.path.isdir(_tango_root_inc):
include_dirs.append(_tango_root_inc)
- include_dirs.append(os.path.join(OMNI_ROOT, 'include'))
-
- if numpy_h:
- pardir = os.path.pardir
- numpy_h = os.path.join(numpy_h, pardir)
- include_dirs.append(numpy_h)
-
+ include_dirs.extend([
+ os.path.join(OMNI_ROOT, 'include'),
+ os.path.join(NUMPY_ROOT, 'include'),
+ ])
+
#-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
# library directories
#-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
@@ -372,6 +329,7 @@ def main():
libraries = [
'tango',
'log4tango',
+ 'zmq',
]
extra_compile_args = []
@@ -380,8 +338,8 @@ def main():
macros = []
- #if not has_numpy():
- # macros.append( ('DISABLE_PYTANGO_NUMPY', None) )
+ if not has_numpy():
+ macros.append( ('DISABLE_PYTANGO_NUMPY', None) )
library_dirs = [
os.path.join(TANGO_ROOT, 'lib'),
@@ -455,10 +413,7 @@ def main():
# to link against boost_python-py25/-py26 etc...
pyver = "py" + "".join(map(str, platform.python_version_tuple()[:2]))
dist = platform.dist()[0].lower()
- if dist in ['debian']:
- libraries.append('boost_python-' + pyver)
- else:
- libraries.append('boost_python')
+ libraries.append('boost_python-' + pyver)
library_dirs += [ os.path.join(OMNI_ROOT, 'lib') ]
@@ -488,6 +443,7 @@ def main():
client_dir = src_dir
server_dir = os.path.join(src_dir, 'server')
_clientfiles = [ os.path.join(client_dir,fname) for fname in os.listdir(client_dir) if fname.endswith('.cpp') ]
+ _clientfiles.remove(os.path.join(client_dir,"group_element.cpp"))
_clientfiles.sort()
_serverfiles = [ os.path.join(server_dir,fname) for fname in os.listdir(server_dir) if fname.endswith('.cpp') ]
_serverfiles.sort()
@@ -525,7 +481,7 @@ def main():
platforms = Release.platform,
license = Release.license,
packages = packages,
- package_dir = { 'PyTango' : 'PyTango', 'PyTango3' : 'PyTango3' },
+ package_dir = { 'PyTango' : 'PyTango' },
py_modules = py_modules,
classifiers = classifiers,
package_data = package_data,
diff --git a/src/api_util.cpp b/src/api_util.cpp
index 0b82982..d0e4651 100644
--- a/src/api_util.cpp
+++ b/src/api_util.cpp
@@ -65,7 +65,8 @@ void export_api_util()
.def("get_env_var", &PyApiUtil::get_env_var)
.staticmethod("get_env_var")
- .def("is_event_consumer_created", &Tango::ApiUtil::is_event_consumer_created)
+ .def("is_notifd_event_consumer_created", &Tango::ApiUtil::is_notifd_event_consumer_created)
+ .def("is_zmq_event_consumer_created", &Tango::ApiUtil::is_zmq_event_consumer_created)
.def("get_user_connect_timeout", &Tango::ApiUtil::get_user_connect_timeout)
.def("get_ip_from_if", &Tango::ApiUtil::get_ip_from_if)
diff --git a/src/attribute_proxy.cpp b/src/attribute_proxy.cpp
index e708f46..1890076 100644
--- a/src/attribute_proxy.cpp
+++ b/src/attribute_proxy.cpp
@@ -25,7 +25,7 @@
#include "defs.h"
#include "pytgutils.h"
-using namespace boost::python;
+namespace bopy = boost::python;
extern const char *param_must_be_seq;
extern const char *unreachable_code;
@@ -33,15 +33,15 @@ extern const char *non_string_seq;
namespace PyAttributeProxy
{
- struct PickleSuite : pickle_suite
+ struct PickleSuite : bopy::pickle_suite
{
- static tuple getinitargs(Tango::AttributeProxy& self)
+ static bopy::tuple getinitargs(Tango::AttributeProxy& self)
{
Tango::DeviceProxy* dev = self.get_device_proxy();
std::string ret = dev->get_db_host() + ":" + dev->get_db_port() +
"/" + dev->dev_name() + "/" + self.name();
- return make_tuple(ret);
+ return bopy::make_tuple(ret);
}
};
}
@@ -58,14 +58,14 @@ void export_attribute_proxy()
void (Tango::AttributeProxy::*delete_property_)(std::string &) =
&Tango::AttributeProxy::delete_property;
- class_<Tango::AttributeProxy> AttributeProxy(
+ bopy::class_<Tango::AttributeProxy> AttributeProxy(
"__AttributeProxy",
- init<const char *>())
+ bopy::init<const char *>())
;
AttributeProxy
- .def(init<const Tango::DeviceProxy *, const char *>())
- .def(init<const Tango::AttributeProxy &>())
+ .def(bopy::init<const Tango::DeviceProxy *, const char *>())
+ .def(bopy::init<const Tango::AttributeProxy &>())
//
// Pickle
@@ -81,7 +81,7 @@ void export_attribute_proxy()
.def("get_device_proxy", &Tango::AttributeProxy::get_device_proxy,
( arg_("self") ),
- return_internal_reference<1>())
+ bopy::return_internal_reference<1>())
//
// property methods
diff --git a/src/constants.cpp b/src/constants.cpp
index d54044a..99b4524 100644
--- a/src/constants.cpp
+++ b/src/constants.cpp
@@ -65,7 +65,12 @@ void export_constants()
consts_scope.attr("DefaultDocUrl") = DefaultDocUrl;
consts_scope.attr("EnvVariable") = EnvVariable;
consts_scope.attr("DbObjName") = DbObjName;
- consts_scope.attr("DescNotSet") = DescNotSet;
+
+ // Changed in tango 8 from DescNotSet to NotSet. We keep the old constant
+ // to try to maintain backward compatibility
+ consts_scope.attr("DescNotSet") = NotSet;
+ consts_scope.attr("NotSet") = NotSet;
+
consts_scope.attr("ResNotDefined") = ResNotDefined;
consts_scope.attr("MessBoxTitle") = MessBoxTitle;
consts_scope.attr("StatusNotSet") = StatusNotSet;
diff --git a/src/defs.h b/src/defs.h
index f837c78..b6c604f 100644
--- a/src/defs.h
+++ b/src/defs.h
@@ -30,6 +30,15 @@ typedef std::vector<std::string> StdStringVector;
typedef std::vector<long> StdLongVector;
typedef std::vector<double> StdDoubleVector;
+/* HAS_UNIQUE_PTR definition comes from tango. It tells PyTango if Tango itself
+ is using the new C++0x unique_ptr or not. In PyTango we try to use the same
+ as TangoC++ whenever possible. */
+#ifdef HAS_UNIQUE_PTR
+#define unique_pointer std::unique_ptr
+#else
+#define unique_pointer std::auto_ptr
+#endif
+
namespace PyTango
{
enum ExtractAs {
diff --git a/src/device_attribute.h b/src/device_attribute.h
index 1f4ca41..f5757e1 100644
--- a/src/device_attribute.h
+++ b/src/device_attribute.h
@@ -38,7 +38,7 @@ namespace PyDeviceAttribute {
/// @name Types
/// @{
- typedef std::auto_ptr<std::vector<Tango::DeviceAttribute> > AutoDevAttrVector;
+ typedef unique_pointer<std::vector<Tango::DeviceAttribute> > AutoDevAttrVector;
/// @}
template<long tangoTypeConst>
@@ -71,7 +71,7 @@ namespace PyDeviceAttribute {
}
}
if (attr_names.size()) {
- std::auto_ptr<Tango::AttributeInfoListEx> attr_infos;
+ unique_pointer<Tango::AttributeInfoListEx> attr_infos;
{
AutoPythonAllowThreads guard;
p = first;
@@ -132,7 +132,7 @@ namespace PyDeviceAttribute {
/// as we get a reference to auto_ptr -> the caller must use an auto_ptr,
/// so the memory will finally be deleted.
template<typename TDeviceAttribute>
- boost::python::object convert_to_python(const std::auto_ptr<std::vector<TDeviceAttribute> >& dev_attr_vec, Tango::DeviceProxy & dev_proxy, PyTango::ExtractAs extract_as)
+ boost::python::object convert_to_python(const unique_pointer<std::vector<TDeviceAttribute> >& dev_attr_vec, Tango::DeviceProxy & dev_proxy, PyTango::ExtractAs extract_as)
{
update_data_format(dev_proxy, &(*dev_attr_vec)[0], dev_attr_vec->size());
diff --git a/src/device_attribute_numpy.hpp b/src/device_attribute_numpy.hpp
index 069b3f0..211b322 100644
--- a/src/device_attribute_numpy.hpp
+++ b/src/device_attribute_numpy.hpp
@@ -210,7 +210,7 @@ namespace PyDeviceAttribute {
raise_(PyExc_TypeError, isImage? non_valid_image : non_valid_spectrum);
// -- Allocate memory for the new data object
- std::auto_ptr<TangoArrayType> value;
+ unique_pointer<TangoArrayType> value;
TangoScalarType* buffer = TangoArrayType::allocbuf(nelems);
try {
value.reset(new TangoArrayType(nelems, nelems, buffer, true));
diff --git a/src/fast_from_py.h b/src/fast_from_py.h
index d68cf61..3ca7d33 100644
--- a/src/fast_from_py.h
+++ b/src/fast_from_py.h
@@ -698,13 +698,13 @@ inline TANGO_const2type(Tango::DEVVAR_LONGSTRINGARRAY)* fast_convert2array<Tango
&py_lng = py_value[0],
&py_str = py_value[1];
- std::auto_ptr<Tango::DevVarLongArray> a_lng(
+ unique_pointer<Tango::DevVarLongArray> a_lng(
fast_convert2array<Tango::DEVVAR_LONGARRAY>(py_lng));
- std::auto_ptr<Tango::DevVarStringArray> a_str(
+ unique_pointer<Tango::DevVarStringArray> a_str(
fast_convert2array<Tango::DEVVAR_STRINGARRAY>(py_str));
- std::auto_ptr<TangoArrayType> result(new TangoArrayType());
+ unique_pointer<TangoArrayType> result(new TangoArrayType());
result->lvalue = *a_lng;
result->svalue = *a_str;
@@ -733,13 +733,13 @@ inline TANGO_const2type(Tango::DEVVAR_DOUBLESTRINGARRAY)* fast_convert2array<Tan
&py_dbl = py_value[0],
&py_str = py_value[1];
- std::auto_ptr<Tango::DevVarDoubleArray> a_dbl(
+ unique_pointer<Tango::DevVarDoubleArray> a_dbl(
fast_convert2array<Tango::DEVVAR_DOUBLEARRAY>(py_dbl));
- std::auto_ptr<Tango::DevVarStringArray> a_str(
+ unique_pointer<Tango::DevVarStringArray> a_str(
fast_convert2array<Tango::DEVVAR_STRINGARRAY>(py_str));
- std::auto_ptr<TangoArrayType> result(new TangoArrayType());
+ unique_pointer<TangoArrayType> result(new TangoArrayType());
result->dvalue = *a_dbl;
result->svalue = *a_str;
diff --git a/src/from_py.h b/src/from_py.h
index 1b0a19a..4437fa1 100644
--- a/src/from_py.h
+++ b/src/from_py.h
@@ -245,7 +245,7 @@ class CSequenceFromPython
m_own = true;
//m_seq = new SequenceT(PySequence_Length(Py_obj.ptr()));
m_seq = new SequenceT();
- std::auto_ptr<SequenceT> guard(m_seq);
+ unique_pointer<SequenceT> guard(m_seq);
from_sequence<SequenceT>::convert(py_obj, *m_seq);
guard.release();
}
diff --git a/src/group_element.cpp b/src/group_element.cpp
index 10ad5a4..8378762 100644
--- a/src/group_element.cpp
+++ b/src/group_element.cpp
@@ -25,92 +25,12 @@
#include "pytgutils.h"
#include "device_attribute.h"
-namespace PyGroupElement
-{
- using namespace boost::python;
-
-
- Tango::GroupCmdReplyList command_inout_reply(Tango::GroupElement &self, long req_id, long timeout_ms)
- {
- AutoPythonAllowThreads guard;
- return self.command_inout_reply(req_id, timeout_ms);
- }
-
- static void __update_data_format(Tango::GroupElement &self, Tango::GroupAttrReplyList& r)
- {
- // Usually we pass a device_proxy to "convert_to_python" in order to
- // get the data_format of the DeviceAttribute for Tango versions
- // older than 7.0. However, GroupAttrReply has no device_proxy to use!
- // So, we are using update_data_format() in here.
- // The conver_to_python method is called, without the usual
- // device_proxy argument, in PyGroupAttrReply::get_data().
- Tango::GroupAttrReplyList::iterator i, e = r.end();
- for (i=r.begin(); i != e; ++i) {
- Tango::DeviceProxy* dev_proxy = self.get_device(i->dev_name());
- if (!dev_proxy)
- continue;
- PyDeviceAttribute::update_data_format( *dev_proxy, &(i->get_data()), 1 );
- }
- }
-
- Tango::GroupAttrReplyList read_attribute_reply (Tango::GroupElement &self, long req_id, long timeout_ms = 0 )
- {
- Tango::GroupAttrReplyList r;
- {
- AutoPythonAllowThreads guard;
- r = self.read_attribute_reply(req_id, timeout_ms);
- }
- __update_data_format(self, r);
- return r;
- }
-
- Tango::GroupAttrReplyList read_attributes_reply (Tango::GroupElement &self, long req_id, long timeout_ms = 0)
- {
- Tango::GroupAttrReplyList r;
- {
- AutoPythonAllowThreads guard;
- r = self.read_attributes_reply(req_id, timeout_ms);
- }
- __update_data_format(self, r);
- return r;
- }
-
- long read_attributes_asynch (Tango::GroupElement &self, object py_value, bool forward = true, long reserved = -1)
- {
- StdStringVector r;
- convert2array(py_value, r);
- return self.read_attributes_asynch(r, forward, reserved);
- }
-
- long write_attribute_asynch (Tango::GroupElement &self, const std::string &attr_name, object py_value, bool forward = true, long reserved = -1)
- {
- Tango::DeviceAttribute dev_attr;
- Tango::DeviceProxy* dev_proxy = self.get_device(1);
- if (dev_proxy)
- PyDeviceAttribute::reset(dev_attr, attr_name, *dev_proxy, py_value);
- // If !dev_proxy (no device added in self or his children) then we
- // don't initialize dev_attr. As a result, the reply will be empty.
- /// @todo or should we raise an exception instead?
-
- AutoPythonAllowThreads guard;
- return self.write_attribute_asynch(dev_attr, forward, reserved);
- }
-
- Tango::GroupReplyList write_attribute_reply (Tango::GroupElement &self, long req_id, long timeout_ms = 0)
- {
- AutoPythonAllowThreads guard;
- return self.write_attribute_reply(req_id, timeout_ms);
- }
-
-
-}
-
-
void export_group_element()
{
using namespace boost::python;
- class_<Tango::GroupElement, std::auto_ptr<Tango::GroupElement>, boost::noncopyable> GroupElement("GroupElement",
+ class_<Tango::GroupElement, unique_pointer<Tango::GroupElement>,
+ boost::noncopyable> GroupElement("GroupElement",
"The abstract GroupElement class for Group. Not to be initialized\n"
"directly.", no_init)
;
@@ -119,22 +39,22 @@ void export_group_element()
//
// Group management methods
//
- .def("__add",
- (void (Tango::GroupElement::*) (const std::string &, int))
- &Tango::GroupElement::add,
- (arg_("self"), arg_("pattern"), arg_("timeout_ms")=-1) )
- .def("__add",
- (void (Tango::GroupElement::*) (const std::vector<std::string> &, int))
- &Tango::GroupElement::add,
- (arg_("self"), arg_("patterns"), arg_("timeout_ms")=-1))
- .def("__remove",
- (void (Tango::GroupElement::*) (const std::string &, bool))
- &Tango::GroupElement::remove,
- (arg_("self"), arg_("pattern"), arg_("forward")=true))
- .def("__remove",
- (void (Tango::GroupElement::*) (const std::vector<std::string> &, bool))
- &Tango::GroupElement::remove,
- (arg_("self"), arg_("patterns"), arg_("forward")=true))
+// .def("__add",
+// (void (Tango::GroupElement::*) (const std::string &, int))
+// &Tango::GroupElement::add,
+// (arg_("self"), arg_("pattern"), arg_("timeout_ms")=-1) )
+// .def("__add",
+// (void (Tango::GroupElement::*) (const std::vector<std::string> &, int))
+// &Tango::GroupElement::add,
+// (arg_("self"), arg_("patterns"), arg_("timeout_ms")=-1))
+// .def("__remove",
+// (void (Tango::GroupElement::*) (const std::string &, bool))
+// &Tango::GroupElement::remove,
+// (arg_("self"), arg_("pattern"), arg_("forward")=true))
+// .def("__remove",
+// (void (Tango::GroupElement::*) (const std::vector<std::string> &, bool))
+// &Tango::GroupElement::remove,
+// (arg_("self"), arg_("patterns"), arg_("forward")=true))
.def("contains",
&Tango::GroupElement::contains,
(arg_("self"), arg_("pattern"), arg_("forward")=true) )
@@ -148,10 +68,10 @@ void export_group_element()
&Tango::GroupElement::get_device,
(arg_("self"), arg_("idx")),
return_internal_reference<1>() )
- .def("get_group",
- &Tango::GroupElement::get_group,
- (arg_("self"), arg_("group_name")),
- return_internal_reference<1>() )
+// .def("get_group",
+// &Tango::GroupElement::get_group,
+// (arg_("self"), arg_("group_name")),
+// return_internal_reference<1>() )
//
// Tango methods (~ DeviceProxy interface)
@@ -162,62 +82,7 @@ void export_group_element()
.def("set_timeout_millis",
pure_virtual(&Tango::GroupElement::set_timeout_millis),
(arg_("self"), arg_("timeout_ms")) )
- .def("command_inout_asynch",
- pure_virtual((long (Tango::GroupElement::*) (const std::string&, bool, bool, long))
- &Tango::GroupElement::command_inout_asynch),
- ( arg_("self"),
- arg_("cmd_name"),
- arg_("forget")=false,
- arg_("forward")=true,
- arg_("reserved")=-1) )
- .def("command_inout_asynch",
- pure_virtual((long (Tango::GroupElement::*) (const std::string&, const Tango::DeviceData&, bool, bool, long))
- &Tango::GroupElement::command_inout_asynch),
- ( arg_("self"),
- arg_("cmd_name"),
- arg_("param"),
- arg_("forget")=false,
- arg_("forward")=true,
- arg_("reserved")=-1) )
- .def("command_inout_reply",
- PyGroupElement::command_inout_reply,
- ( arg_("self"),
- arg_("req_id"),
- arg_("timeout_ms")=0 ) )
- .def("read_attribute_asynch",
- pure_virtual(&Tango::GroupElement::read_attribute_asynch),
- ( arg_("self"),
- arg_("attr_name"),
- arg_("forward")=true,
- arg_("reserved")=-1) )
- .def("read_attribute_reply",
- &PyGroupElement::read_attribute_reply,
- ( arg_("self"),
- arg_("req_id"),
- arg_("timeout_ms")=0 ) )
- .def("read_attributes_asynch",
- PyGroupElement::read_attributes_asynch,
- ( arg_("self"),
- arg_("attr_names"),
- arg_("forward")=true,
- arg_("reserved")=-1) )
- .def("read_attributes_reply",
- PyGroupElement::read_attributes_reply,
- ( arg_("self"),
- arg_("req_id"),
- arg_("timeout_ms")=0 ) )
- .def("write_attribute_asynch",
- &PyGroupElement::write_attribute_asynch,
- ( arg_("self"),
- arg_("attr_name"),
- arg_("value"),
- arg_("forward")=true,
- arg_("reserved")=-1 ) )
- .def("write_attribute_reply",
- PyGroupElement::write_attribute_reply,
- ( arg_("self"),
- arg_("req_id"),
- arg_("timeout_ms")=0 ) )
+
//
// Misc
@@ -244,9 +109,9 @@ void export_group_element()
.def("name_matches",
&Tango::GroupElement::name_matches,
(arg_("self")) )
- .def("get_size",
- &Tango::GroupElement::get_size,
- (arg_("self"), arg_("forward")=true) )
+// .def("get_size",
+// &Tango::GroupElement::get_size,
+// (arg_("self"), arg_("forward")=true) )
//
// "Should not be used" methods
diff --git a/src/locker_info.cpp b/src/locker_info.cpp
index a2d998c..1315bda 100644
--- a/src/locker_info.cpp
+++ b/src/locker_info.cpp
@@ -24,21 +24,19 @@
#include "precompiled_header.hpp"
#include <tango.h>
-using namespace boost::python;
-
struct PyLockerInfo
{
- static inline object get_locker_id(Tango::LockerInfo &li)
+ static inline boost::python::object get_locker_id(Tango::LockerInfo &li)
{
return (li.ll == Tango::CPP) ?
- object(li.li.LockerPid) :
- tuple(li.li.UUID);
+ boost::python::object(li.li.LockerPid) :
+ boost::python::tuple(li.li.UUID);
}
};
void export_locker_info()
{
- class_<Tango::LockerInfo>("LockerInfo")
+ boost::python::class_<Tango::LockerInfo>("LockerInfo")
.def_readonly("ll", &Tango::LockerInfo::ll)
.add_property("li", &PyLockerInfo::get_locker_id)
.def_readonly("locker_host", &Tango::LockerInfo::locker_host)
diff --git a/src/pytango.cpp b/src/pytango.cpp
index 3d5de12..c330244 100644
--- a/src/pytango.cpp
+++ b/src/pytango.cpp
@@ -35,7 +35,7 @@
#include <tango.h>
using namespace boost::python;
-
+
void export_version();
void export_enums();
void export_constants();
diff --git a/src/pyutils.h b/src/pyutils.h
index 13ed9df..4f7acfc 100644
--- a/src/pyutils.h
+++ b/src/pyutils.h
@@ -25,6 +25,8 @@
#include <boost/python.hpp>
+namespace bopy = boost::python;
+
#define arg_(a) boost::python::arg(a)
#if PY_MAJOR_VERSION >= 3
diff --git a/src/server/attr.cpp b/src/server/attr.cpp
index f1d6055..19eb524 100644
--- a/src/server/attr.cpp
+++ b/src/server/attr.cpp
@@ -73,17 +73,17 @@ void PyAttr::set_user_prop(vector<Tango::AttrProperty> &user_prop,
else if (prop_name == "delta_t")
def_prop.set_delta_t(prop_value);
else if (prop_name == "abs_change")
- def_prop.set_abs_change(prop_value);
+ def_prop.set_event_abs_change(prop_value);
else if (prop_name == "rel_change")
- def_prop.set_rel_change(prop_value);
+ def_prop.set_event_rel_change(prop_value);
else if (prop_name == "period")
- def_prop.set_period(prop_value);
+ def_prop.set_event_period(prop_value);
else if (prop_name == "archive_abs_change")
- def_prop.set_archive_abs_change(prop_value);
+ def_prop.set_archive_event_abs_change(prop_value);
else if (prop_name == "archive_rel_change")
- def_prop.set_archive_rel_change(prop_value);
+ def_prop.set_archive_event_rel_change(prop_value);
else if (prop_name == "archive_period")
- def_prop.set_archive_period(prop_value);
+ def_prop.set_archive_event_period(prop_value);
}
}
diff --git a/src/server/attribute.cpp b/src/server/attribute.cpp
index af0065a..3f7b676 100644
--- a/src/server/attribute.cpp
+++ b/src/server/attribute.cpp
@@ -95,7 +95,7 @@ namespace PyAttribute
I prefer this one since it decouples TangoC++ from PyTango and creating
a scalar is not so expensive after all
*/
- std::auto_ptr<TangoScalarType> cpp_val(new TangoScalarType);
+ unique_pointer<TangoScalarType> cpp_val(new TangoScalarType);
from_py<tangoTypeConst>::convert(value, *cpp_val);
att.set_value(cpp_val.release(), 1, 0, true);
@@ -184,7 +184,7 @@ namespace PyAttribute
I prefer this one since it decouples TangoC++ from PyTango and creating
a scalar is not so expensive after all
*/
- std::auto_ptr<TangoScalarType> cpp_val(new TangoScalarType);
+ unique_pointer<TangoScalarType> cpp_val(new TangoScalarType);
from_py<tangoTypeConst>::convert(value, *cpp_val);
att.set_value_date_quality(cpp_val.release(), tv, quality, 1, 0, true);
@@ -469,6 +469,14 @@ namespace PyAttribute
o.str(),
"fire_change_event()");
}
+
+ // usually not necessary to rewrite but with direct declaration the compiler
+ // gives an error. It seems to be because the tango method definition is not
+ // in the header file.
+ inline bool is_polled(Tango::Attribute &self)
+ {
+ return self.is_polled();
+ }
#if TgLibVersNb >= 80100 // set_min_alarm
@@ -827,8 +835,7 @@ void export_attribute()
.def("is_min_warning", &Tango::Attribute::is_min_warning)
.def("is_max_warning", &Tango::Attribute::is_max_warning)
.def("is_rds_alarm", &Tango::Attribute::is_rds_alarm)
- //TODO .def("is_alarmed", &Tango::Attribute::is_alarmed)
- .def("is_polled", &Tango::Attribute::is_polled)
+ .def("is_polled", &PyAttribute::is_polled)
.def("check_alarm", &Tango::Attribute::check_alarm)
.def("get_writable", &Tango::Attribute::get_writable)
.def("get_name", &Tango::Attribute::get_name,
diff --git a/src/server/command.cpp b/src/server/command.cpp
index b5d88d0..17d4a2f 100644
--- a/src/server/command.cpp
+++ b/src/server/command.cpp
@@ -123,6 +123,24 @@ void insert_scalar<Tango::DEV_BOOLEAN>(boost::python::object &o, CORBA::Any &any
any <<= any_value;
}
+template<>
+void insert_scalar<Tango::DEV_ENCODED>(boost::python::object &o, CORBA::Any &any)
+{
+ bopy::object p0 = o[0];
+ bopy::object p1 = o[1];
+
+ const char* encoded_format = bopy::extract<const char *> (p0.ptr());
+ const char* encoded_data = bopy::extract<const char *> (p1.ptr());
+
+ CORBA::ULong nb = bopy::len(p1);
+ Tango::DevVarCharArray arr(nb, nb, (CORBA::Octet*)encoded_data, false);
+ Tango::DevEncoded *data = new Tango::DevEncoded;
+ data->encoded_format = CORBA::string_dup(encoded_format);
+ data->encoded_data = arr;
+
+ any <<= data;
+}
+
template<long tangoArrayTypeConst>
void insert_array(boost::python::object &o, CORBA::Any &any)
{
@@ -164,6 +182,21 @@ template<>
void extract_scalar<Tango::DEV_VOID>(const CORBA::Any &any, boost::python::object &o)
{}
+template<>
+void extract_scalar<Tango::DEV_ENCODED>(const CORBA::Any &any, boost::python::object &o)
+{
+ Tango::DevEncoded* data;
+
+ if ((any >>= data) == false)
+ throw_bad_type(Tango::CmdArgTypeName[Tango::DEV_ENCODED]);
+
+ bopy::str encoded_format(data[0].encoded_format);
+ bopy::str encoded_data((const char*)data[0].encoded_data.get_buffer(),
+ data[0].encoded_data.length());
+
+ o = boost::python::make_tuple(encoded_format, encoded_data);
+}
+
#ifndef DISABLE_PYTANGO_NUMPY
/// This callback is run to delete Tango::DevVarXArray* objects.
/// It is called by python. The array was associated with an attribute
@@ -262,7 +295,7 @@ CORBA::Any *PyCmd::execute(Tango::DeviceImpl *dev, const CORBA::Any ¶m_any)
CORBA::Any *ret_any;
allocate_any(ret_any);
- std::auto_ptr<CORBA::Any> ret_any_guard(ret_any);
+ unique_pointer<CORBA::Any> ret_any_guard(ret_any);
// It does: ret_any = ret_py_obj
TANGO_DO_ON_DEVICE_DATA_TYPE(out_type,
diff --git a/src/server/tango_util.cpp b/src/server/tango_util.cpp
index ad4f1f9..6639e27 100644
--- a/src/server/tango_util.cpp
+++ b/src/server/tango_util.cpp
@@ -44,7 +44,7 @@ namespace PyUtil
int cl_len = len(cpp_class_list);
for(int i = 0; i < cl_len; ++i)
{
- tuple class_info = extract<tuple>(cpp_class_list[i]);
+ bopy::tuple class_info = extract<bopy::tuple>(cpp_class_list[i]);
char *class_name = extract<char *>(class_info[0]);
char *par_name = extract<char *>(class_info[1]);
dserver->_create_cpp_class(class_name, par_name);
diff --git a/src/server/user_default_attr_prop.cpp b/src/server/user_default_attr_prop.cpp
index 3915b2e..b0b49ef 100644
--- a/src/server/user_default_attr_prop.cpp
+++ b/src/server/user_default_attr_prop.cpp
@@ -43,12 +43,19 @@ void export_user_default_attr_prop()
.def("set_max_warning", &Tango::UserDefaultAttrProp::set_max_warning)
.def("set_delta_t", &Tango::UserDefaultAttrProp::set_delta_t)
.def("set_delta_val", &Tango::UserDefaultAttrProp::set_delta_val)
- .def("set_abs_change", &Tango::UserDefaultAttrProp::set_abs_change)
- .def("set_rel_change", &Tango::UserDefaultAttrProp::set_rel_change)
- .def("set_period", &Tango::UserDefaultAttrProp::set_period)
- .def("set_archive_abs_change", &Tango::UserDefaultAttrProp::set_archive_abs_change)
- .def("set_archive_rel_change", &Tango::UserDefaultAttrProp::set_archive_rel_change)
- .def("set_archive_period", &Tango::UserDefaultAttrProp::set_archive_period)
+ .def("set_abs_change", &Tango::UserDefaultAttrProp::set_event_abs_change)
+ .def("set_rel_change", &Tango::UserDefaultAttrProp::set_event_rel_change)
+ .def("set_period", &Tango::UserDefaultAttrProp::set_event_period)
+ .def("set_archive_abs_change", &Tango::UserDefaultAttrProp::set_archive_event_abs_change)
+ .def("set_archive_rel_change", &Tango::UserDefaultAttrProp::set_archive_event_rel_change)
+ .def("set_archive_period", &Tango::UserDefaultAttrProp::set_archive_event_period)
+
+ .def("set_event_abs_change", &Tango::UserDefaultAttrProp::set_event_abs_change)
+ .def("set_event_rel_change", &Tango::UserDefaultAttrProp::set_event_rel_change)
+ .def("set_event_period", &Tango::UserDefaultAttrProp::set_event_period)
+ .def("set_archive_event_abs_change", &Tango::UserDefaultAttrProp::set_archive_event_abs_change)
+ .def("set_archive_event_rel_change", &Tango::UserDefaultAttrProp::set_archive_event_rel_change)
+ .def("set_archive_event_period", &Tango::UserDefaultAttrProp::set_archive_event_period)
.def_readwrite("label", &Tango::UserDefaultAttrProp::label)
.def_readwrite("description", &Tango::UserDefaultAttrProp::description)
diff --git a/src/server/wattribute.cpp b/src/server/wattribute.cpp
index f5ca5b2..c6a04ca 100644
--- a/src/server/wattribute.cpp
+++ b/src/server/wattribute.cpp
@@ -565,7 +565,8 @@ namespace PyWAttribute
void export_wattribute()
{
- class_<Tango::WAttribute, bases<Tango::Attribute> >("WAttribute", no_init)
+ class_<Tango::WAttribute, bases<Tango::Attribute>, boost::noncopyable>
+ ("WAttribute", no_init)
.def("get_min_value",
(PyObject* (*) (Tango::WAttribute &))
&PyWAttribute::get_min_value)
diff --git a/src/tgutils.h b/src/tgutils.h
index 6bd10f3..ba5b9a2 100644
--- a/src/tgutils.h
+++ b/src/tgutils.h
@@ -223,7 +223,7 @@ DEF_TANGO_SCALAR_ARRAY_NAMES( DEV_ULONG64, DEVVAR_ULONG64ARRAY );
__TANGO_DEPEND_ON_TYPE_AUX(DEVVAR_LONG64ARRAY, DOIT_ARRAY) \
__TANGO_DEPEND_ON_TYPE_AUX(DEVVAR_ULONG64ARRAY, DOIT_ARRAY) \
/* __TANGO_DEPEND_ON_TYPE_AUX(DEV_INT, DOIT_SIMPLE) */\
-/* __TANGO_DEPEND_ON_TYPE_AUX(DEV_ENCODED, DOIT_SIMPLE)*/ \
+ __TANGO_DEPEND_ON_TYPE_AUX(DEV_ENCODED, DOIT_SIMPLE) \
default: \
assert(false); \
} } else (void)0
--
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