Leave a comment when removing a prop

post_process_prop.py doesn't simply drop a line when deleting a prop.
Instead, it makes the line as comment and leave a comment to clearly
mark that the prop was force removed. This is to aid the debugging.

Bug: 117892318
Test: m

Change-Id: I53c05800ff71d431a56dc370bcfe8bfc95c03bfc
This commit is contained in:
Jiyong Park
2020-05-26 03:30:02 +09:00
parent bb26c6f2bf
commit cc49c6b8cd

View File

@@ -108,7 +108,10 @@ class PropList:
self.props[index].value = value self.props[index].value = value
def delete(self, name): def delete(self, name):
self.props = [p for p in self.props if p.name != name] index = next((i for i,p in enumerate(self.props) if p.name == name), -1)
if index != -1:
new_comment = "# removed by post_process_props.py\n#" + str(self.props[index])
self.props[index] = Prop.from_line(new_comment)
def write(self, filename): def write(self, filename):
with open(filename, 'w+') as f: with open(filename, 'w+') as f: