in tools/build_defs/feature_builder.py [0:0]
def main(unused_argv):
feature = ElementTree.Element("feature")
feature.set("id", FLAGS.id)
feature.set("label", FLAGS.label)
feature.set("version", FLAGS.version)
feature.set("provider-name", FLAGS.provider)
description = ElementTree.SubElement(feature, "description")
if FLAGS.url:
description.set("url", FLAGS.url)
description.text = FLAGS.description
copyright = ElementTree.SubElement(feature, "copyright")
copyright.text = FLAGS.copyright
license = ElementTree.SubElement(feature, "license")
license.set("url", FLAGS.license_url)
with open(FLAGS.license, "r") as f:
license.text = f.read()
_sites(ElementTree.SubElement(feature, "url"), FLAGS.site)
_plugins(feature, FLAGS.plugin)
# Pretty print the resulting tree
output = ElementTree.tostring(feature, "utf-8")
reparsed = minidom.parseString(output)
with open(FLAGS.output, "w") as f:
f.write(reparsed.toprettyxml(indent=" ", encoding="UTF-8"))