summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jiyong Park <jiyong@google.com> 2020-05-26 03:30:02 +0900
committer Jiyong Park <jiyong@google.com> 2020-06-08 10:09:12 +0900
commitcc49c6b8cd1ebe2ee59ec04f51755d065ea33c75 (patch)
treecb638abca775b3919c26bde0dbb4183e41ec0414
parentbb26c6f2bfde3eb97589e3f27eb848c778ef9b29 (diff)
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
-rwxr-xr-xtools/post_process_props.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/post_process_props.py b/tools/post_process_props.py
index b2210416c3..4fa15bcd61 100755
--- a/tools/post_process_props.py
+++ b/tools/post_process_props.py
@@ -108,7 +108,10 @@ class PropList:
self.props[index].value = value
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):
with open(filename, 'w+') as f: