pyDevSup working as a module in require system
This commit is contained in:
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=koennecke
|
||||
BUILDCLASSES=Linux
|
||||
|
||||
# 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
|
||||
#SOURCES += devsupApp/src/pyDevSupCommon_registerRecordDeviceDriver.cpp
|
||||
|
||||
|
||||
USR_CFLAGS += -I/usr/include/python3.6m -DHAVE_NUMPY
|
||||
USR_CFLAGS += -DXEPICS_ARCH=\"RHEL7-x86_64\" -DXEPICS_BASE=\"/usr/local/epics\"
|
||||
USR_CFLAGS += -DXPYDEV_BASE=\"$(INSTALL_LOCATION)\" -DPYDIR=\"python3.6\"
|
||||
USR_LDFLAGS += -L/usr/local/epics/base-3.14.12/lib/RHEL7-x86_64
|
||||
LIB_SYS_LIBS += python3.6m
|
||||
#LIB_SYS_LIBS += python3.6m recIoc softDevIoc miscIoc rsrvIoc dbtoolsIoc asIoc dbIoc registryIoc dbStaticIoc
|
||||
# MISCS would be the place to keep the stream device template files
|
30
README.module
Normal file
30
README.module
Normal file
@ -0,0 +1,30 @@
|
||||
# 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,
|
||||
reuire 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.
|
||||
|
||||
2) This generates a pythonXX/$(EPICS_ARCH)/devsup directory. Copy this directory to
|
||||
a safe place.
|
||||
|
||||
3) 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/koennecke/R3.14.12/lib/devsup
|
||||
|
||||
5) 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/koennecke/R3.14.12/lib/
|
||||
|
||||
With this, one can at least run the testmodule.cmd script and it workd at least
|
||||
for me.
|
||||
|
||||
Please use the module branch, I had to hack the initialisation of pyDevSup to make
|
||||
it work as a module.
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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"),
|
||||
|
@ -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, koennecke
|
||||
|
||||
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