office-gobmx/solenv/bin/constructors.py
LeSasse e347cff87b tdf#158803 remove unused imports
Change-Id: Ie58bde91e1c96a32f02f64bc0eb8d864d3680e6e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165388
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-03-28 08:52:05 +01:00

26 lines
885 B
Python
Executable file

#!/usr/bin/env python3
# Call $0 <file with a list of component file paths>
# Dumps all the implementing constructors to stdout
import xml.sax
import sys
constructors = list()
class ComponentHandler(xml.sax.ContentHandler):
def startElement(self, tag, attributes):
if tag == "implementation" and "constructor" in attributes:
constructors.append(attributes["constructor"])
if __name__ == "__main__":
parser = xml.sax.make_parser()
parser.setFeature(xml.sax.handler.feature_namespaces, 0)
parser.setContentHandler(ComponentHandler())
for filename in sys.argv[1:]:
with open(filename, "r") as components_listfile:
for line in components_listfile:
for component_filename in line.strip().split():
parser.parse(component_filename)
constructors.sort()
print("\n".join(constructors))