Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
bcce0bbab2 | |||
87d1a3999c | |||
e7ba24f4e2 | |||
618b183844 | |||
65519f950a |
27
GNUMakefile
Normal file
27
GNUMakefile
Normal file
@ -0,0 +1,27 @@
|
||||
# This build the sinq extensions for the PSI EPICS setup
|
||||
include /ioc/tools/driver.makefile
|
||||
|
||||
MODULE=pyDevSup
|
||||
LIBVERSION=1.2.sinq
|
||||
BUILDCLASSES=Linux
|
||||
ARCH_FILTER=RHEL8-x86_64
|
||||
|
||||
#----------- Define python version
|
||||
PY=python3.6m
|
||||
|
||||
# See README.module for more instructions
|
||||
|
||||
DBDS += pyIocApp/pyDevSup.dbd
|
||||
|
||||
SOURCES += pyIocApp/setup.c
|
||||
SOURCES += devsupApp/src/dbapi.c
|
||||
SOURCES += devsupApp/src/dbdset.c
|
||||
SOURCES += devsupApp/src/dbfield.c
|
||||
SOURCES += devsupApp/src/dbrec.c
|
||||
SOURCES += devsupApp/src/utest.c
|
||||
|
||||
USR_CFLAGS += -I/usr/include/$(PY) -DHAVE_NUMPY
|
||||
USR_CFLAGS += -DXEPICS_ARCH=\"$(T_A)\" -DXEPICS_BASE=\"$(EPICS_BASE)\"
|
||||
USR_CFLAGS += -DXPYDEV_BASE=\"$(INSTALL_LOCATION)\" -DPYDIR=\"$(PY)\"
|
||||
LIB_SYS_LIBS += $(PY)
|
||||
# MISCS would be the place to keep the stream device template files
|
35
README.module
Normal file
35
README.module
Normal file
@ -0,0 +1,35 @@
|
||||
# pyDevSup as a module loadable via require
|
||||
|
||||
pyDevSup is not you standard EPICS extension in that it tightly interacts with the
|
||||
python interpreter. This causes some issues with Dirk Zimochs module system which
|
||||
allows to load support modules through the require command. Most importantly,
|
||||
require does not know about python and its modules at all.
|
||||
|
||||
|
||||
The good news is that it can be made to work but requires a few manual steps.
|
||||
|
||||
1) Build the pyDevSup extension in the normal EPICS way in the master branch.
|
||||
|
||||
2) This generates a pythonXX/$(EPICS_ARCH)/devsup directory. Copy this directory to
|
||||
a safe place.
|
||||
|
||||
3) Switch to the module branch and Build the module using the GNUMakefile as
|
||||
normal and install it
|
||||
|
||||
4) Copy the saved devsup directory in some place into pyDevSup's module hierarchy.
|
||||
For example: /ioc/modules/pyDevSup/1.2.sinq/R7.0.7/lib/RHEL8-x86_64/devsup
|
||||
|
||||
6) In order to successfuly load pyDevSup with require the directory underneath where ypu placed
|
||||
pydevsup needs to be on the python path. For example:
|
||||
/ioc/modules/pyDevSup/1.2.sinq/R7.0.7/lib/RHEL8-x86_64
|
||||
|
||||
Please use the module branch, I had to hack the initialisation of pyDevSup to make
|
||||
it work as a module.
|
||||
|
||||
For RHEL8, I had to remove a few static statements in dbdSet.c in order to solve a missing
|
||||
symbols problem. I also had to modify the files in configure somewhat in order to point to
|
||||
the proper python version and to suppress the many cross compilations attempted by the default
|
||||
build.
|
||||
|
||||
|
||||
|
@ -23,11 +23,11 @@ PROD_DEPLIB_DIRS += $(PY_LIBDIRS)
|
||||
|
||||
INCLUDES += $(PY_INCDIRS:%=-I%)
|
||||
|
||||
ifeq ($(HAVE_NUMPY),YES)
|
||||
#ifeq ($(HAVE_NUMPY),YES)
|
||||
TARGET_CPPFLAGS += -DHAVE_NUMPY
|
||||
else
|
||||
$(error numpy required)
|
||||
endif
|
||||
#else
|
||||
#$(error numpy required)
|
||||
#endif
|
||||
|
||||
#LIB_SYS_LIBS += python$(PY_LD_VER)
|
||||
#PROD_SYS_LIBS += python$(PY_LD_VER)
|
||||
|
@ -19,7 +19,7 @@ CHECK_RELEASE = YES
|
||||
# Set this when you only want to compile this application
|
||||
# for a subset of the cross-compiled target architectures
|
||||
# that Base is built for.
|
||||
#CROSS_COMPILER_TARGET_ARCHS = vxWorks-68040
|
||||
CROSS_COMPILER_TARGET_ARCHS = RHEL8-x86_64
|
||||
|
||||
# To install files into a location other than $(TOP) define
|
||||
# INSTALL_LOCATION here.
|
||||
@ -33,7 +33,7 @@ CHECK_RELEASE = YES
|
||||
#IOCS_APPL_TOP = </IOC/path/to/application/top>
|
||||
|
||||
# Default python version.
|
||||
PY_VER=2.7
|
||||
PY_VER=3.6.8
|
||||
|
||||
# Module will be build against this version of the
|
||||
# Python interpreter
|
||||
|
@ -36,7 +36,7 @@ TEMPLATE_TOP=$(EPICS_BASE)/templates/makeBaseApp/top
|
||||
## Required Modules ##
|
||||
|
||||
# EPICS_BASE usually appears last so other apps can override stuff:
|
||||
#EPICS_BASE=/usr/lib/epics
|
||||
EPICS_BASE=/usr/local/epics/base-7.0.7
|
||||
|
||||
-include $(TOP)/configure/RELEASE.local
|
||||
-include $(TOP)/../RELEASE.local
|
||||
|
22
dbd/pyDevSup.dbd
Normal file
22
dbd/pyDevSup.dbd
Normal file
@ -0,0 +1,22 @@
|
||||
registrar(pySetupReg)
|
||||
device(longin, INST_IO, pydevsupComIn, "Python Device")
|
||||
device(longout, INST_IO, pydevsupComOut, "Python Device")
|
||||
|
||||
device(ai, INST_IO, pydevsupComIn, "Python Device")
|
||||
device(ao, INST_IO, pydevsupComOut, "Python Device")
|
||||
|
||||
device(stringin, INST_IO, pydevsupComIn, "Python Device")
|
||||
device(stringout, INST_IO, pydevsupComOut, "Python Device")
|
||||
|
||||
device(bi, INST_IO, pydevsupComIn, "Python Device")
|
||||
device(bo, INST_IO, pydevsupComOut, "Python Device")
|
||||
|
||||
device(mbbi, INST_IO, pydevsupComIn, "Python Device")
|
||||
device(mbbo, INST_IO, pydevsupComOut, "Python Device")
|
||||
|
||||
device(mbbiDirect, INST_IO, pydevsupComIn, "Python Device")
|
||||
device(mbboDirect, INST_IO, pydevsupComOut, "Python Device")
|
||||
|
||||
device(waveform, INST_IO, pydevsupComIn, "Python Device")
|
||||
device(aai, INST_IO, pydevsupComIn, "Python Device")
|
||||
device(aao, INST_IO, pydevsupComOut, "Python Device")
|
@ -27,7 +27,7 @@
|
||||
|
||||
initHookState pyInitLastState;
|
||||
|
||||
extern int pyDevSupCommon_registerRecordDeviceDriver(DBBASE *pbase);
|
||||
/* extern int pyDevSupCommon_registerRecordDeviceDriver(DBBASE *pbase); */
|
||||
|
||||
typedef struct {
|
||||
const initHookState state;
|
||||
@ -264,9 +264,11 @@ PyObject *py_iocInit(PyObject *unused, PyObject *args, PyObject *kws)
|
||||
static
|
||||
PyObject *py_pyDevSupCommon(PyObject *unused)
|
||||
{
|
||||
/*
|
||||
Py_BEGIN_ALLOW_THREADS {
|
||||
pyDevSupCommon_registerRecordDeviceDriver(pdbbase);
|
||||
} Py_END_ALLOW_THREADS
|
||||
*/
|
||||
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
@ -373,15 +373,15 @@ typedef struct {
|
||||
DEVSUPFUN linconv;
|
||||
} dset6;
|
||||
|
||||
static dset6 pydevsupComSpec = {{6, (DEVSUPFUN)&report, (DEVSUPFUN)&init,
|
||||
dset6 pydevsupComSpec = {{6, (DEVSUPFUN)&report, (DEVSUPFUN)&init,
|
||||
(DEVSUPFUN)&init_record,
|
||||
(DEVSUPFUN)&get_iointr_info},
|
||||
(DEVSUPFUN)&process_record};
|
||||
static dset6 pydevsupComOut = {{6, (DEVSUPFUN)&report, (DEVSUPFUN)&init,
|
||||
dset6 pydevsupComOut = {{6, (DEVSUPFUN)&report, (DEVSUPFUN)&init,
|
||||
(DEVSUPFUN)&init_record2,
|
||||
(DEVSUPFUN)&get_iointr_info},
|
||||
(DEVSUPFUN)&process_record};
|
||||
static dset6 pydevsupComIn = {{6, (DEVSUPFUN)&report, (DEVSUPFUN)&init,
|
||||
dset6 pydevsupComIn = {{6, (DEVSUPFUN)&report, (DEVSUPFUN)&init,
|
||||
(DEVSUPFUN)&init_record,
|
||||
(DEVSUPFUN)&get_iointr_info},
|
||||
(DEVSUPFUN)&process_record2};
|
||||
|
@ -46,6 +46,10 @@ from ._dbapi import (EPICS_VERSION_STRING,
|
||||
__all__ = []
|
||||
|
||||
def _init(iocMain=False):
|
||||
_dbapi._dbd_setup()
|
||||
return
|
||||
|
||||
def _initOld(iocMain=False):
|
||||
if not iocMain:
|
||||
# we haven't read/register base.dbd
|
||||
_dbapi.dbReadDatabase(os.path.join(XEPICS_BASE, "dbd", "base.dbd"),
|
||||
|
@ -1 +1,22 @@
|
||||
registrar(pySetupReg)
|
||||
device(longin, INST_IO, pydevsupComIn, "Python Device")
|
||||
device(longout, INST_IO, pydevsupComOut, "Python Device")
|
||||
|
||||
device(ai, INST_IO, pydevsupComIn, "Python Device")
|
||||
device(ao, INST_IO, pydevsupComOut, "Python Device")
|
||||
|
||||
device(stringin, INST_IO, pydevsupComIn, "Python Device")
|
||||
device(stringout, INST_IO, pydevsupComOut, "Python Device")
|
||||
|
||||
device(bi, INST_IO, pydevsupComIn, "Python Device")
|
||||
device(bo, INST_IO, pydevsupComOut, "Python Device")
|
||||
|
||||
device(mbbi, INST_IO, pydevsupComIn, "Python Device")
|
||||
device(mbbo, INST_IO, pydevsupComOut, "Python Device")
|
||||
|
||||
device(mbbiDirect, INST_IO, pydevsupComIn, "Python Device")
|
||||
device(mbboDirect, INST_IO, pydevsupComOut, "Python Device")
|
||||
|
||||
device(waveform, INST_IO, pydevsupComIn, "Python Device")
|
||||
device(aai, INST_IO, pydevsupComIn, "Python Device")
|
||||
device(aao, INST_IO, pydevsupComOut, "Python Device")
|
||||
|
@ -19,7 +19,7 @@ class SumTable(PT.TableBase):
|
||||
|
||||
@inputs.anynotvalid
|
||||
def inval(self):
|
||||
print self.A.isvalid, self.B.isvalid
|
||||
print(self.A.isvalid, self.B.isvalid)
|
||||
LOG.debug("%s.update inputs not valid", self.name)
|
||||
self.S.value = None
|
||||
self.S.notify()
|
||||
|
27
testmodule.cmd
Executable file
27
testmodule.cmd
Executable file
@ -0,0 +1,27 @@
|
||||
#! /usr/local/bin/iocsh
|
||||
|
||||
require pyDevSup, 1.2.sinq
|
||||
|
||||
py "import logging"
|
||||
py "logging.basicConfig(level=logging.DEBUG)"
|
||||
|
||||
py "import sys; sys.path.insert(0,'${PWD}/testApp')"
|
||||
py "print(sys.path)"
|
||||
|
||||
#py "import devsup.hooks"
|
||||
#py "devsup.hooks.debugHooks()"
|
||||
|
||||
py "import test2"
|
||||
py "test2.addDrv('AAAA')"
|
||||
py "test2.addDrv('BBBB')"
|
||||
|
||||
py "import test6"
|
||||
py "test6.SumTable(name='tsum')"
|
||||
|
||||
dbLoadRecords("db/test.db","P=md:")
|
||||
dbLoadRecords("db/test6.db","P=tst:,TNAME=tsum")
|
||||
|
||||
iocInit()
|
||||
|
||||
# Start Reference tracker
|
||||
#py "from devsup import disect; disect.periodic(10)"
|
Reference in New Issue
Block a user