Skip to content

Commit 4aaa476

Browse files
authored
. bug fix for VERSIONED tables (#8790)
. improved recognition of header files
1 parent 4315865 commit 4aaa476

File tree

1 file changed

+80
-80
lines changed

1 file changed

+80
-80
lines changed

scripts/datamodel-doc/ALICEO2includeFile.py

Lines changed: 80 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -166,12 +166,13 @@ def where(self, columns):
166166
return -1
167167

168168
def print(self):
169-
print(" ns: "+self.nslevel)
170-
print(" column: "+self.cname)
171-
print(" kind: ", self.kind)
172-
print(" access: "+self.gname)
173-
print(" type: "+self.type)
174-
print(" comment: "+self.comment)
169+
print(" ns: "+self.nslevel)
170+
print(" column: "+self.cname)
171+
print(" kind: ", self.kind)
172+
print(" access: "+self.gname)
173+
print(" type: "+self.type)
174+
print("header file: "+self.hfile)
175+
print(" comment: "+self.comment)
175176

176177
def printHTML(self):
177178
cn2u = fullDataModelName(self.nslevel, self.cname)
@@ -221,6 +222,7 @@ def synchronize(self, dm):
221222

222223
def print(self):
223224
print(" table: "+self.tname)
225+
print(" header file: ", self.hfile)
224226
print(" kind: ", self.kind)
225227
print(" producers: ", len(self.CErelations))
226228
for cer in self.CErelations:
@@ -326,10 +328,45 @@ def __init__(self, dmname, CErelation, hfile, initCard=None):
326328
self.CErelations.append(CErelation)
327329
self.defines = list()
328330
self.namespaces = list()
331+
self.categories = list()
332+
333+
# set some variables
334+
self.O2path = ""
335+
self.O2Physicspath = ""
336+
self.O2href = ""
337+
self.O2Physicshref = ""
338+
self.delimAO2D = ""
339+
self.delimHelpers = ""
340+
self.delimPWGs = ""
341+
self.delimJoins = ""
342+
# update with values from initCard
329343
if initCard != None:
330344
self.initCard = initCard
331-
self.categories = list()
332-
345+
tmp = initCard.find("O2general/mainDir/O2local")
346+
if tmp != None:
347+
self.O2path = tmp.text.strip()
348+
tmp = initCard.find("O2general/mainDir/O2Physicslocal")
349+
if tmp != None:
350+
self.O2Physicspath = tmp.text.strip()
351+
tmp = initCard.find("O2general/mainDir/O2GitHub")
352+
if tmp != None:
353+
self.O2href = tmp.text.strip()
354+
tmp = initCard.find("O2general/mainDir/O2PhysicsGitHub")
355+
if tmp != None:
356+
self.O2Physicshref = tmp.text.strip()
357+
tmp = initCard.find("O2general/delimAO2D")
358+
if tmp != None:
359+
self.delimAO2D = tmp.text.strip()
360+
tmp = initCard.find("O2general/delimHelpers")
361+
if tmp != None:
362+
self.delimHelpers = tmp.text.strip()
363+
tmp = initCard.find("O2general/delimPWGs")
364+
if tmp != None:
365+
self.delimPWGs = tmp.text.strip()
366+
tmp = initCard.find("O2general/delimJoins")
367+
if tmp != None:
368+
self.delimJoins = tmp.text.strip()
369+
333370
# read the file
334371
lines_in_file = file.readlines()
335372
content = O2DMT.pickContent(lines_in_file)
@@ -520,8 +557,8 @@ def print(self):
520557
for ns in self.namespaces:
521558
ns.print()
522559

523-
def printSingleTable(self, href2u, path2u, tabs, uses, tab2u):
524-
# print the table header
560+
def printSingleTable(self, tabs, uses, tab2u):
561+
# print the table header
525562
tab2u.printHeaderHTML()
526563

527564
# print table comment
@@ -530,6 +567,13 @@ def printSingleTable(self, href2u, path2u, tabs, uses, tab2u):
530567
print(" </div>")
531568

532569
# print header file
570+
if tab2u.hfile.startswith(self.O2path):
571+
href2u = self.O2href
572+
path2u = self.O2path
573+
else:
574+
href2u = self.O2Physicshref
575+
path2u = self.O2Physicspath
576+
533577
hf2u = O2DMT.block(tab2u.hfile.split(path2u)[
534578
1:], False).strip().lstrip("/")
535579
print(" <div>")
@@ -538,7 +582,7 @@ def printSingleTable(self, href2u, path2u, tabs, uses, tab2u):
538582
print(" </div>")
539583

540584
# print extends
541-
if tab2u.kind == 2 or tab2u.kind == 5:
585+
if tab2u.kind == 4 or tab2u.kind == 7:
542586
print(" <div>Extends:")
543587
print(" <ul>")
544588
print(" ", tab2u.toExtendWith)
@@ -566,7 +610,7 @@ def printSingleTable(self, href2u, path2u, tabs, uses, tab2u):
566610
tab2u.printSubHeaderHTML()
567611

568612
# EXTENDED_TABLE and EXTENDED_TABLE_USER are extended
569-
if tab2u.kind == 2 or tab2u.kind == 5:
613+
if tab2u.kind == 4 or tab2u.kind == 7:
570614
# this table has to be extended, find the extending table and
571615
# print all of its columns
572616
einds = [i for i, x in enumerate(tabs) if x.tname == tab2u.toExtendWith]
@@ -582,11 +626,18 @@ def printSingleTable(self, href2u, path2u, tabs, uses, tab2u):
582626
tab2u.printFooterHTML()
583627

584628

585-
def printTables(self, DMtype, href2u, path2u, tabs, uses, CER, tabs2u):
629+
def printTables(self, DMtype, tabs, uses, CER, tabs2u):
586630
print("")
587631
print("#### ", CER[2])
588632

589633
# add source code information if available
634+
if CER[0].startswith(self.O2path):
635+
href2u = self.O2href
636+
path2u = self.O2path
637+
else:
638+
href2u = self.O2Physicshref
639+
path2u = self.O2Physicspath
640+
590641
if DMtype == 1:
591642
if href2u != "":
592643
print("Code file: <a href=\""+href2u+"/"+CER[0].split(path2u)[1] +
@@ -636,7 +687,7 @@ def printTables(self, DMtype, href2u, path2u, tabs, uses, CER, tabs2u):
636687
for tab in tabs2u:
637688
if baseTableName(tab.tname, vPattern) == tname:
638689
print()
639-
self.printSingleTable(href2u, path2u, tabs, uses, tab)
690+
self.printSingleTable(tabs, uses, tab)
640691
continue
641692
print("</div>")
642693

@@ -646,67 +697,17 @@ def printTables(self, DMtype, href2u, path2u, tabs, uses, CER, tabs2u):
646697
print("<div>")
647698
for i in others:
648699
print()
649-
self.printSingleTable(href2u, path2u, tabs, uses, tabs2u[i])
700+
self.printSingleTable(tabs, uses, tabs2u[i])
650701
print("</div>")
651702

652703
else:
653704
# print all tables of given producer
654705
for tab in tabs2u:
655-
self.printSingleTable(href2u, path2u, tabs, uses, tab)
706+
self.printSingleTable(tabs, uses, tab)
656707

657708
print("</div>")
658709

659710
def printHTML(self):
660-
# get some variables
661-
tmp = self.initCard.find("O2general/mainDir/O2local")
662-
if tmp == None:
663-
tmp = ""
664-
else:
665-
tmp = tmp.text.strip()
666-
O2path = tmp
667-
tmp = self.initCard.find("O2general/mainDir/O2Physicslocal")
668-
if tmp == None:
669-
tmp = ""
670-
else:
671-
tmp = tmp.text.strip()
672-
O2Physicspath = tmp
673-
tmp = self.initCard.find("O2general/mainDir/O2GitHub")
674-
if tmp == None:
675-
tmp = ""
676-
else:
677-
tmp = tmp.text.strip()
678-
O2href = tmp
679-
tmp = self.initCard.find("O2general/mainDir/O2PhysicsGitHub")
680-
if tmp == None:
681-
tmp = ""
682-
else:
683-
tmp = tmp.text.strip()
684-
O2Physicshref = tmp
685-
tmp = self.initCard.find("O2general/delimAO2D")
686-
if tmp == None:
687-
tmp = ""
688-
else:
689-
tmp = tmp.text.strip()
690-
delimAO2D = tmp
691-
tmp = self.initCard.find("O2general/delimHelpers")
692-
if tmp == None:
693-
tmp = ""
694-
else:
695-
tmp = tmp.text.strip()
696-
delimHelpers = tmp
697-
tmp = self.initCard.find("O2general/delimPWGs")
698-
if tmp == None:
699-
tmp = ""
700-
else:
701-
tmp = tmp.text.strip()
702-
delimPWGs = tmp
703-
tmp = self.initCard.find("O2general/delimJoins")
704-
if tmp == None:
705-
tmp = ""
706-
else:
707-
tmp = tmp.text.strip()
708-
delimJoins = tmp
709-
710711
# gather all tables and columns
711712
tabs = list()
712713
uses = list()
@@ -723,7 +724,7 @@ def printHTML(self):
723724
# 4. joins
724725

725726
# 1. main producer
726-
print(delimAO2D)
727+
print(self.delimAO2D)
727728
inds = [i for i, x in enumerate(self.CErelations) if x[3] == 'Main']
728729
CER2u = [self.CErelations[i] for i in inds]
729730
# only one Main CER should be available
@@ -733,23 +734,23 @@ def printHTML(self):
733734
for CER in CER2u:
734735
inds = [i for i, x in enumerate(tabs) if CER in x.CErelations]
735736
tabs2u = [tabs[i] for i in inds]
736-
self.printTables(0, O2href, O2path, tabs, uses, CER, tabs2u)
737-
print(delimAO2D)
737+
self.printTables(0, tabs, uses, CER, tabs2u)
738+
print(self.delimAO2D)
738739

739740
# 2. helper tasks
740741
print("")
741-
print(delimHelpers)
742+
print(self.delimHelpers)
742743
inds = [i for i, x in enumerate(self.CErelations) if x[3] == 'Helper']
743744
CER2u = [self.CErelations[i] for i in inds]
744745
for CER in CER2u:
745746
inds = [i for i, x in enumerate(tabs) if CER in x.CErelations]
746747
tabs2u = [tabs[i] for i in inds]
747-
self.printTables(1, O2Physicshref, O2Physicspath, tabs, uses, CER, tabs2u)
748-
print(delimHelpers)
748+
self.printTables(1, tabs, uses, CER, tabs2u)
749+
print(self.delimHelpers)
749750

750751
# 3. PWG tasks
751752
print("")
752-
print(delimPWGs)
753+
print(self.delimPWGs)
753754
inds = [i for i, x in enumerate(self.CErelations) if x[3] == 'PWG']
754755
CERsPWG = [self.CErelations[i] for i in inds]
755756

@@ -765,14 +766,14 @@ def printHTML(self):
765766
for CER in CER2u:
766767
inds = [i for i, x in enumerate(tabs) if CER in x.CErelations]
767768
tabs2u = [tabs[i] for i in inds]
768-
self.printTables(1, O2Physicshref, O2Physicspath, tabs, uses, CER, tabs2u)
769+
self.printTables(1, tabs, uses, CER, tabs2u)
769770

770-
print(delimPWGs)
771+
print(self.delimPWGs)
771772
print("")
772773

773774
# now print the usings
774775
if len(uses) > 0:
775-
print(delimJoins)
776+
print(self.delimJoins)
776777
print("")
777778
print("<a name=\"usings\"></a>")
778779
print("#### List of defined joins and iterators")
@@ -787,7 +788,7 @@ def printHTML(self):
787788
print(" </ul>")
788789
print(" </div>")
789790
print("</div>")
790-
print(delimJoins)
791+
print(self.delimJoins)
791792

792793
# -----------------------------------------------------------------------------
793794
# functions
@@ -833,9 +834,8 @@ def fullDataModelName(nslevel, name):
833834
def tableColumnNames(nslevel, cont, kind=0):
834835

835836
# specification according to kind of table
836-
noff = 3
837-
if kind == 1:
838-
noff = 4
837+
noffs = [3, 4, 4, 5, 3, 3, 3, 3]
838+
noff = noffs[kind]
839839

840840
# split cont with ","
841841
buf = O2DMT.block(cont[:len(cont)-2], False)

0 commit comments

Comments
 (0)