DiamondLightSource/pythonSoftIOC

Feature request: `python -m pvxslibs.ioc`

Closed this issue · 1 comments

coretl commented

I have monkeypatched this like so:

import ctypes
import os

import pvxslibs.path
from epicscorelibs import ioc
from setuptools_dso.runtime import find_dso

pvxsIoc = ctypes.CDLL(find_dso("pvxslibs.lib.pvxsIoc"), ctypes.RTLD_GLOBAL)
os.environ.setdefault("PVXS_QSRV_ENABLE", "YES")

orig_dbld = ioc.dbLoadDatabase

def dbLoadDatabase(dbd, dbdpath, substitutions):
    if dbd == b"qsrv.dbd":
        orig_dbld(b"pvxsIoc.dbd", pvxslibs.path.dbd_path.encode(), None)
    elif dbd == b"PVAServerRegister.dbd":
        pass
    else:
        orig_dbld(dbd, dbdpath, substitutions)

ioc.dbLoadDatabase = dbLoadDatabase

if __name__ == "__main__":
    ioc.main()

But obviously this is a hack.

Maybe the best way to support this is to pass in a list of tuples of (dbd, dbdpath) to epicscorelibs.ioc.main, defaulting to the existing qsrv.dbd and PVAServerRegister.dbd, and then call it with a different set in pvxslibs.ioc?

Shall I make a PR for this? Or is there a better way?

coretl commented

Oops, wrong repo