33from collections import defaultdict
44
55
6+ # doxygen XML parsing #################################################################################################
7+
8+
69def parse_index_xml ():
710 root = etree .parse (os .path .join (DOXYGEN_XML_DIR , 'index.xml' ))
811 compounds = defaultdict (dict )
@@ -35,6 +38,26 @@ def parse_index_xml():
3538 return compounds
3639
3740
41+ def find_all_includes ():
42+ for ctype in ("class" , "struct" , "namespace" ):
43+ for compound in DOXYGEN_DATA [ctype ].values ():
44+ compound_xml = etree .parse (os .path .join (DOXYGEN_XML_DIR , compound ["refid" ] + '.xml' ))
45+ for location in compound_xml .findall (".//*[@id]/location" ):
46+ parent = location .getparent ()
47+ if parent .get ("id" ) == compound ["refid" ]:
48+ member = compound
49+ else :
50+ name = parent .find ("name" )
51+ if name .text not in compound ["members" ]:
52+ print ("got location for unknown object" , compound ["refid" ], parent .get ("id" ), name .text )
53+ continue
54+ else :
55+ member = compound ["members" ][name .text ][parent .get ("id" )]
56+ member ["file" ] = location .get ("declfile" , location .get ("file" ))
57+
58+
59+ # doc strings / help messages##########################################################################################
60+
3861def pythonize_docstrings (klass , name ):
3962 data = DOXYGEN_DATA ["class" ][klass .__cpp_name__ ] # TODO do the same for namespace members
4063 url = DOXYGEN_URL % (data ["refid" ], "" )
@@ -61,23 +84,7 @@ def pythonize_docstrings(klass, name):
6184 pass
6285
6386
64- def find_all_includes ():
65- for ctype in ("class" , "struct" , "namespace" ):
66- for compound in DOXYGEN_DATA [ctype ].values ():
67- compound_xml = etree .parse (os .path .join (DOXYGEN_XML_DIR , compound ["refid" ] + '.xml' ))
68- for location in compound_xml .findall (".//*[@id]/location" ):
69- parent = location .getparent ()
70- if parent .get ("id" ) == compound ["refid" ]:
71- member = compound
72- else :
73- name = parent .find ("name" )
74- if name .text not in compound ["members" ]:
75- print ("got location for unknown object" , compound ["refid" ], parent .get ("id" ), name .text )
76- continue
77- else :
78- member = compound ["members" ][name .text ][parent .get ("id" )]
79- member ["file" ] = location .get ("declfile" , location .get ("file" ))
80-
87+ # helpful "attribute not found" errors ################################################################################
8188
8289def find_include (* names ):
8390 if len (names ) == 1 :
@@ -141,6 +148,8 @@ def helpful_getattribute(ns, name):
141148 type(ns ).__getattribute__ = helpful_getattribute
142149
143150
151+ # __main__ and imported use ###########################################################################################
152+
144153if "OGDF_DOC_DIR" in os .environ :
145154 from lxml import etree
146155
0 commit comments