Skip to content

Commit

Permalink
Revert "roomservice: Use ElementTree.indent()"
Browse files Browse the repository at this point in the history
Revert submission 402436

Reason for revert: Breaks build

Reverted changes: /q/submissionid:402436

Change-Id: Ia53f8a2c2a39ee437c334c5157a2f7dc5aed44ac
  • Loading branch information
Chirayu Desai committed Sep 13, 2024
1 parent 76b04d2 commit 2d402ed
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion build/tools/roomservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,22 @@ def exists_in_tree(lm, path):
return True
return False

# in-place prettyprint formatter
def indent(elem, level=0):
i = "\n" + level*" "
if len(elem):
if not elem.text or not elem.text.strip():
elem.text = i + " "
if not elem.tail or not elem.tail.strip():
elem.tail = i
for elem in elem:
indent(elem, level+1)
if not elem.tail or not elem.tail.strip():
elem.tail = i
else:
if level and (not elem.tail or not elem.tail.strip()):
elem.tail = i

def get_manifest_path():
'''Find the current manifest path
In old versions of repo this is at .repo/manifest.xml
Expand Down Expand Up @@ -191,7 +207,7 @@ def add_to_manifest(repositories):
print("Adding dependency: %s -> %s" % (project.attrib["name"], project.attrib["path"]))
lm.append(project)

ElementTree.indent(lm)
indent(lm, 0)
raw_xml = ElementTree.tostring(lm).decode()
raw_xml = '<?xml version="1.0" encoding="UTF-8"?>\n' + raw_xml

Expand Down

0 comments on commit 2d402ed

Please sign in to comment.