Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: python -m pvxslibs.ioc #49

Open
coretl opened this issue Jun 26, 2023 · 2 comments
Open

Feature request: python -m pvxslibs.ioc #49

coretl opened this issue Jun 26, 2023 · 2 comments

Comments

@coretl
Copy link

coretl commented Jun 26, 2023

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
Copy link
Author

coretl commented Mar 12, 2024

I find myself needing this again, would a PR with the above be helpful?

@mdavidsaver
Copy link
Owner

Yes, a PR would be helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants