18 def __init__(self):
19 import shelve
20 from pathlib import Path
21
22 from GaudiPluginService.cpluginsvc import GAUDI_DEFAULT_PLUGIN_PATH
23
24 self._dbs = {}
25 ignored_files = set(os.environ.get("CONFIGURABLE_DB_IGNORE", "").split(","))
26 loaded = set()
27 for path in GAUDI_DEFAULT_PLUGIN_PATH:
28 if not path or not os.path.isdir(path):
29 continue
30 dbfiles = [
31 fabs
32 for f in Path(path).glob("*.confdb2")
33 if (fabs := f.absolute().as_posix()) not in ignored_files
34 and fabs not in loaded
35 ]
36 dbfiles.sort()
37
38 loaded.update(dbfiles)
39 for db in [shelve.open(f, "r") for f in dbfiles]:
40 for key in db:
41 self._dbs.setdefault(key, db)
42