DUNE-DAQ
DUNE Trigger and Data Acquisition software
Toggle main menu visibility
Loading...
Searching...
No Matches
dunedaq
sourcecode
daqconf
python
daqconf
createOKSdb.py
Go to the documentation of this file.
1
import
conffwk
2
import
os
3
import
glob
4
5
6
def
generate_file
(oksfile, include):
7
"""Simple script to create an 'empty' OKS file.
8
The file will automatically include the confmodel schema
9
and any other OKS files you specify"""
10
11
includefiles = [
"schema/confmodel/dunedaq.schema.xml"
]
12
13
searchdirs = [path
for
path
in
os.environ[
"DUNEDAQ_DB_PATH"
].split(
":"
)]
14
searchdirs.append(os.path.dirname(oksfile))
15
for
inc
in
include:
16
# print (f"Searching for {inc}")
17
match =
False
18
inc = inc.removesuffix(
".xml"
)
19
if
inc.endswith(
".data"
):
20
ftype =
"data"
21
elif
inc.endswith(
".schema"
):
22
ftype =
"schema"
23
else
:
24
ftype =
"*"
25
inc = inc +
"*"
26
for
path
in
searchdirs:
27
matches = glob.glob(f
"{inc}.xml"
, root_dir=path)
28
if
len(matches) == 0:
29
matches = glob.glob(f
"{ftype}/{inc}.xml"
, root_dir=path)
30
for
filename
in
matches:
31
print(f
"Adding {filename} to include list"
)
32
includefiles.append(filename)
33
match =
True
34
if
match:
35
break
36
if
not
match:
37
print(f
"Error could not find include file for {inc}"
)
38
return
39
db =
conffwk.Configuration
(
"oksconflibs"
)
40
if
not
oksfile.endswith(
".data.xml"
):
41
oksfile = oksfile +
".data.xml"
42
print(f
"Creating OKS database file {oksfile}"
)
43
db.create_db(oksfile, includefiles)
44
db.commit()
conffwk.Configuration.Configuration
Definition
Configuration.py:29
createOKSdb.generate_file
generate_file(oksfile, include)
Definition
createOKSdb.py:6
Generated on
for DUNE-DAQ by
1.17.0