diff --git a/devices/clients/__init__.py b/devices/clients/__init__.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/devices/clients/attribute_wrapper.py b/devices/clients/attribute_wrapper.py index 5953a1c8cb4e62d34df0be81e6cc4ae5cf29eca9..73b8d203913362d3d6b4b079aaaaa285e15da23a 100644 --- a/devices/clients/attribute_wrapper.py +++ b/devices/clients/attribute_wrapper.py @@ -3,7 +3,7 @@ from tango import AttrWriteType import numpy -from util.wrappers import only_when_on, fault_on_error +from devices.device_decorators import only_when_on, fault_on_error import logging logger = logging.getLogger() diff --git a/devices/clients/opcua_client.py b/devices/clients/opcua_client.py index 0f7ca6dc4066806f02b56e2668110bd14d85c51f..de237d919e3ebe885f9a6fa41d9570758b885150 100644 --- a/devices/clients/opcua_client.py +++ b/devices/clients/opcua_client.py @@ -1,10 +1,11 @@ from threading import Thread import socket -from util.comms_client import CommClient import numpy import opcua from opcua import Client +from clients.comms_client import CommClient + __all__ = ["OPCUAConnection"] numpy_to_OPCua_dict = { diff --git a/devices/clients/sst_client.py b/devices/clients/sst_client.py index ab79fe125f66d0d0cf14bc0add00df8f515b9e32..ff2e28bc9377a88fc385e1c7716c7191e8bb8740 100644 --- a/devices/clients/sst_client.py +++ b/devices/clients/sst_client.py @@ -1,20 +1,18 @@ -import queue -from threading import Thread -import socket -from util.comms_client import CommClient - +from datetime import datetime +from multiprocessing import Value, Array from queue import Queue - -import numpy +from threading import Thread import logging +import numpy +import queue import socket -from datetime import datetime -from multiprocessing import Value, Array import time +from clients.comms_client import CommClient __all__ = ["sst_client"] + class sst_client(CommClient): """ Connects to OPC-UA in the foreground or background, and sends HELLO diff --git a/devices/common/__init__.py b/devices/common/__init__.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/devices/devices/__init__.py b/devices/devices/__init__.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/devices/devices/apsctl.py b/devices/devices/apsctl.py index 5187aa8eb9f2a5231ec404636ccc5aae3ace15ce..25d8e1080e5ce71a05634fee392aa9eff57ef711 100644 --- a/devices/devices/apsctl.py +++ b/devices/devices/apsctl.py @@ -11,6 +11,12 @@ """ +# TODO(Corne): Remove sys.path.append hack once packaging is in place! +import os, sys +currentdir = os.path.dirname(os.path.realpath(__file__)) +parentdir = os.path.dirname(currentdir) +sys.path.append(parentdir) + # PyTango imports from tango.server import run from tango.server import device_property, attribute @@ -18,11 +24,11 @@ from tango import AttrWriteType # Additional import from clients.opcua_client import OPCUAConnection -from devices.clients.attribute_wrapper import attribute_wrapper -from devices.devices.hardware_device import hardware_device +from clients.attribute_wrapper import attribute_wrapper +from devices.hardware_device import hardware_device -from devices.common.lofar_logging import device_logging_to_python, log_exceptions -from devices.common.lofar_git import get_version +from common.lofar_logging import device_logging_to_python, log_exceptions +from common.lofar_git import get_version import numpy diff --git a/devices/devices/hardware_device.py b/devices/devices/hardware_device.py index e0c9154c703a7cb82c42e9cdd7db76d68a011e05..d244e79df8d7c90bd93307f826bba39a8f9c15c5 100644 --- a/devices/devices/hardware_device.py +++ b/devices/devices/hardware_device.py @@ -16,12 +16,12 @@ from tango.server import Device, command from tango import DevState, DebugIt # Additional import -from util.attribute_wrapper import attribute_wrapper -from util.lofar_logging import log_exceptions +from clients.attribute_wrapper import attribute_wrapper +from common.lofar_logging import log_exceptions __all__ = ["hardware_device"] -from util.wrappers import only_in_states, fault_on_error +from devices.device_decorators import only_in_states, fault_on_error #@log_exceptions() class hardware_device(Device): diff --git a/devices/devices/pcc.py b/devices/devices/pcc.py index fe2a1841d33fec9d6157a581c75dda3a01f2971f..f21bd39a26405e323a7842718f571626f498cd5e 100644 --- a/devices/devices/pcc.py +++ b/devices/devices/pcc.py @@ -11,6 +11,12 @@ """ +# TODO(Corne): Remove sys.path.append hack once packaging is in place! +import os, sys +currentdir = os.path.dirname(os.path.realpath(__file__)) +parentdir = os.path.dirname(currentdir) +sys.path.append(parentdir) + # PyTango imports from tango import DebugIt from tango.server import run, command @@ -19,13 +25,13 @@ from tango import AttrWriteType import numpy # Additional import -from devices.devices.device_decorators import * +from device_decorators import * from clients.opcua_client import OPCUAConnection -from devices.clients.attribute_wrapper import attribute_wrapper -from devices.devices.hardware_device import hardware_device -from devices.common.lofar_logging import device_logging_to_python, log_exceptions -from devices.common.lofar_git import get_version +from clients.attribute_wrapper import attribute_wrapper +from devices.hardware_device import hardware_device +from common.lofar_logging import device_logging_to_python, log_exceptions +from common.lofar_git import get_version __all__ = ["PCC", "main"] @@ -244,7 +250,7 @@ class PCC(hardware_device): def main(args=None, **kwargs): """Main function of the PCC module.""" - from devices.common.lofar_logging import configure_logger + from common.lofar_logging import configure_logger import logging configure_logger(logging.getLogger()) diff --git a/devices/devices/sdp/__init__.py b/devices/devices/sdp/__init__.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/devices/devices/sdp.py b/devices/devices/sdp/sdp.py similarity index 94% rename from devices/devices/sdp.py rename to devices/devices/sdp/sdp.py index f6eb07f271425e8883312ef1f326bcf71ed0e67e..ad19ab28b3c0d24236d4547239b08c09a3d99720 100644 --- a/devices/devices/sdp.py +++ b/devices/devices/sdp/sdp.py @@ -11,6 +11,13 @@ """ +# TODO(Corne): Remove sys.path.append hack once packaging is in place! +import os, sys +currentdir = os.path.dirname(os.path.realpath(__file__)) +parentdir = os.path.dirname(currentdir) +parentdir = os.path.dirname(parentdir) +sys.path.append(parentdir) + # PyTango imports from tango.server import run from tango.server import device_property, attribute @@ -18,11 +25,11 @@ from tango import AttrWriteType # Additional import from clients.opcua_client import OPCUAConnection -from devices.clients.attribute_wrapper import attribute_wrapper -from devices.devices.hardware_device import hardware_device +from clients.attribute_wrapper import attribute_wrapper +from devices.hardware_device import hardware_device -from devices.common.lofar_logging import device_logging_to_python, log_exceptions -from devices.common.lofar_git import get_version +from common.lofar_logging import device_logging_to_python, log_exceptions +from common.lofar_git import get_version import numpy @@ -168,7 +175,7 @@ class SDP(hardware_device): def main(args=None, **kwargs): """Main function of the SDP module.""" - from devices.common.lofar_logging import configure_logger + from common.lofar_logging import configure_logger import logging configure_logger(logging.getLogger()) diff --git a/devices/devices/sdp_statistics/__init__.py b/devices/devices/sdp_statistics/__init__.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/devices/devices/sdp_statistics/sst.py b/devices/devices/sdp_statistics/sst.py index 28874a3d0556539f38d323d3a5b5dac1d0dd30fc..5ea315fd9808fe1fd7dcc456b64d17e858977a1c 100644 --- a/devices/devices/sdp_statistics/sst.py +++ b/devices/devices/sdp_statistics/sst.py @@ -11,6 +11,13 @@ """ +# TODO(Corne): Remove sys.path.append hack once packaging is in place! +import os, sys +currentdir = os.path.dirname(os.path.realpath(__file__)) +parentdir = os.path.dirname(currentdir) +parentdir = os.path.dirname(parentdir) +sys.path.append(parentdir) + # PyTango imports from tango.server import run from tango.server import device_property @@ -18,10 +25,10 @@ from tango.server import device_property from clients.sst_client import sst_client -from devices.clients.attribute_wrapper import attribute_wrapper -from devices.devices.hardware_device import hardware_device +from clients.attribute_wrapper import attribute_wrapper +from devices.hardware_device import hardware_device -from devices.common.lofar_logging import device_logging_to_python, log_exceptions +from common.lofar_logging import device_logging_to_python, log_exceptions import numpy @@ -90,11 +97,11 @@ class SST(hardware_device): def main(args=None, **kwargs): """Main function of the Statistics Device module.""" - from devices.common.lofar_logging import configure_logger + from common.lofar_logging import configure_logger import logging configure_logger(logging.getLogger()) - return run((Statistics,), args=args, **kwargs) + return run((SST,), args=args, **kwargs) if __name__ == '__main__': diff --git a/devices/examples/HW_device_template.py b/devices/examples/HW_device_template.py index 66b6bdb19c0b00703805dc2f76cce0d8208a36b2..6059733023c5ee8448369a706ea2be5c8fa6b840 100644 --- a/devices/examples/HW_device_template.py +++ b/devices/examples/HW_device_template.py @@ -9,13 +9,19 @@ """ +# TODO(Corne): Remove sys.path.append hack once packaging is in place! +import os, sys +currentdir = os.path.dirname(os.path.realpath(__file__)) +parentdir = os.path.dirname(currentdir) +sys.path.append(parentdir) + # PyTango imports from tango.server import run from tango import AttrWriteType # Additional import -from util.attribute_wrapper import attribute_wrapper -from util.hardware_device import hardware_device +from clients.attribute_wrapper import attribute_wrapper +from devices.hardware_device import hardware_device __all__ = ["HW_dev"] diff --git a/devices/examples/load_from_disk/__init__.py b/devices/examples/load_from_disk/__init__.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/devices/examples/load_from_disk/ini_client.py b/devices/examples/load_from_disk/ini_client.py index 2f4d714b57dd57d327795fe59fd6edf43eb4c9fa..dcc66a85ac7fae4cbe3d00a47fe46a809618938b 100644 --- a/devices/examples/load_from_disk/ini_client.py +++ b/devices/examples/load_from_disk/ini_client.py @@ -1,4 +1,4 @@ -from util.comms_client import CommClient +from clients.comms_client import CommClient import configparser import numpy diff --git a/devices/examples/load_from_disk/ini_device.py b/devices/examples/load_from_disk/ini_device.py index c1c273171d268eb1ca6da587f7c616081e30dd0e..e4aaef9063b16d94b63822d742bcd10bbef8d35f 100644 --- a/devices/examples/load_from_disk/ini_device.py +++ b/devices/examples/load_from_disk/ini_device.py @@ -9,18 +9,25 @@ """ +# TODO(Corne): Remove sys.path.append hack once packaging is in place! +import os, sys +currentdir = os.path.dirname(os.path.realpath(__file__)) +parentdir = os.path.dirname(currentdir) +parentdir = os.path.dirname(parentdir) +sys.path.append(parentdir) + # PyTango imports from tango.server import run from tango import AttrWriteType # Additional import -from devices.clients.attribute_wrapper import attribute_wrapper -from devices.devices.hardware_device import hardware_device +from clients.attribute_wrapper import attribute_wrapper +from devices.hardware_device import hardware_device import configparser import numpy -from clients.ini_client import * +from ini_client import * __all__ = ["ini_device"] diff --git a/devices/examples/snmp/__init__.py b/devices/examples/snmp/__init__.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/devices/examples/snmp/snmp.py b/devices/examples/snmp/snmp.py index 7962d2fd738898fa084c6530336ab61f65f604cf..b54c4fe9033d7ec52236f3df74b57874bac1204f 100644 --- a/devices/examples/snmp/snmp.py +++ b/devices/examples/snmp/snmp.py @@ -11,15 +11,22 @@ """ +# TODO(Corne): Remove sys.path.append hack once packaging is in place! +import os, sys +currentdir = os.path.dirname(os.path.realpath(__file__)) +parentdir = os.path.dirname(currentdir) +parentdir = os.path.dirname(parentdir) +sys.path.append(parentdir) + # PyTango imports from tango.server import run from tango.server import device_property from tango import AttrWriteType # Additional import -from devices.examples.snmp.snmp_client import SNMP_client -from devices.clients.attribute_wrapper import attribute_wrapper -from devices.devices.hardware_device import hardware_device +from examples.snmp.snmp_client import SNMP_client +from clients.attribute_wrapper import attribute_wrapper +from devices.hardware_device import hardware_device import numpy @@ -111,7 +118,7 @@ class SNMP(hardware_device): def main(args=None, **kwargs): """Main function of the PCC module.""" - from devices.common.lofar_logging import configure_logger + from common.lofar_logging import configure_logger import logging configure_logger(logging.getLogger()) diff --git a/devices/examples/snmp/snmp_client.py b/devices/examples/snmp/snmp_client.py index 6230386aa300efbf9bf23ac1491b6a10354cba2f..2c162abef0f924c3d67d9d248253c2a9df533a3f 100644 --- a/devices/examples/snmp/snmp_client.py +++ b/devices/examples/snmp/snmp_client.py @@ -1,5 +1,7 @@ -from util.comms_client import CommClient +from clients.comms_client import CommClient + import snmp + import numpy import traceback @@ -156,5 +158,3 @@ class SNMP_client(CommClient): # return the read/write functions return _read_function, _write_function - - diff --git a/devices/test/__init__.py b/devices/test/__init__.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/devices/test/clients/__init__.py b/devices/test/clients/__init__.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/devices/test/clients/test_client.py b/devices/test/clients/test_client.py index 7465a6afca5f189b205748b01480f57a17ede63c..355b4f72ad8d6c61c6655b45b75a9f597ac6b72c 100644 --- a/devices/test/clients/test_client.py +++ b/devices/test/clients/test_client.py @@ -1,4 +1,4 @@ -from util.comms_client import CommClient +from clients.comms_client import CommClient import numpy import os diff --git a/devices/test/devices/__init__.py b/devices/test/devices/__init__.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/devices/test/devices/random_data.py b/devices/test/devices/random_data.py index 86836b73ce9a5a154d33a8ac891a8517678b08f7..3ebff8615da1d11ffbf404fd7de2e96263b7b38a 100644 --- a/devices/test/devices/random_data.py +++ b/devices/test/devices/random_data.py @@ -7,6 +7,13 @@ # Distributed under the terms of the APACHE license. # See LICENSE.txt for more info. +# TODO(Corne): Remove sys.path.append hack once packaging is in place! +import os, sys +currentdir = os.path.dirname(os.path.realpath(__file__)) +parentdir = os.path.dirname(currentdir) +parentdir = os.path.dirname(parentdir) +sys.path.append(parentdir) + # PyTango imports from tango import DevState from tango.server import run, Device, attribute, command diff --git a/devices/test/devices/test_device.py b/devices/test/devices/test_device.py index 22fe3c2bb7e6e52e887e029e8d189f41e3bad2c4..f9a72ec88d006450403b6cfc6a0396b842bb36a1 100644 --- a/devices/test/devices/test_device.py +++ b/devices/test/devices/test_device.py @@ -10,15 +10,22 @@ """ test Device Server """ +# TODO(Corne): Remove sys.path.append hack once packaging is in place! +import os, sys +currentdir = os.path.dirname(os.path.realpath(__file__)) +parentdir = os.path.dirname(currentdir) +parentdir = os.path.dirname(parentdir) +sys.path.append(parentdir) + # PyTango imports from tango.server import run from tango.server import device_property from tango import DevState # Additional import -from clients.test_client import test_client -from devices.clients.attribute_wrapper import * -from devices.devices.hardware_device import * +from test.clients.test_client import test_client +from clients.attribute_wrapper import * +from devices.hardware_device import * __all__ = ["test_device", "main"] diff --git a/devices/toolkit/__init__.py b/devices/toolkit/__init__.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/devices/toolkit/lts_cold_start.py b/devices/toolkit/lts_cold_start.py index baaadade255a55a3e730336786cca8ca03e73eef..fb558ff2ce849ab9f844331c117aee122af014fe 100644 --- a/devices/toolkit/lts_cold_start.py +++ b/devices/toolkit/lts_cold_start.py @@ -1,8 +1,15 @@ #! /usr/bin/env python3 import logging from time import sleep -from devices.toolkit.startup import startup -from devices.toolkit.lofar2_config import configure_logging + +# TODO(Corne): Remove sys.path.append hack once packaging is in place! +import os, sys +currentdir = os.path.dirname(os.path.realpath(__file__)) +parentdir = os.path.dirname(currentdir) +sys.path.append(parentdir) + +from toolkit.startup import startup +from toolkit.lofar2_config import configure_logging def start_device(device: str):