Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: grit/format/policy_templates/writers/android_policy_writer.py

Issue 1392383004: Add the missing version number comment for AndroidPolicyWriter (Closed) Base URL: https://chromium.googlesource.com/external/grit-i18n.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2015 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2015 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 6
7 from grit.format.policy_templates.writers import xml_formatted_writer 7 from grit.format.policy_templates.writers import xml_formatted_writer
8 from xml.dom import minidom 8 from xml.dom import minidom
9 from xml.sax import saxutils as xml_escape 9 from xml.sax import saxutils as xml_escape
10 10
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 items = policy.get('items') 81 items = policy.get('items')
82 if items is not None: 82 if items is not None:
83 entries = [ item['caption'] for item in items ] 83 entries = [ item['caption'] for item in items ]
84 values = [ item['value'] for item in items ] 84 values = [ item['value'] for item in items ]
85 self.AddStringArrayResource(name + 'Entries', entries) 85 self.AddStringArrayResource(name + 'Entries', entries)
86 self.AddStringArrayResource(name + 'Values', values) 86 self.AddStringArrayResource(name + 'Values', values)
87 87
88 def BeginTemplate(self): 88 def BeginTemplate(self):
89 comment_text = 'DO NOT MODIFY THIS FILE DIRECTLY!\n' \ 89 comment_text = 'DO NOT MODIFY THIS FILE DIRECTLY!\n' \
90 'IT IS GENERATED FROM policy_templates.json.' 90 'IT IS GENERATED FROM policy_templates.json.'
91 if self._GetChromiumVersionString():
92 comment_text += "\n" + self.config["build"] + " version: "\
93 + self._GetChromiumVersionString()
Joao da Silva 2015/11/02 14:37:41 Can you add a test for this
91 comment_node = self._doc.createComment(comment_text) 94 comment_node = self._doc.createComment(comment_text)
92 self._doc.insertBefore(comment_node, self._resources) 95 self._doc.insertBefore(comment_node, self._resources)
93 96
94 def Init(self): 97 def Init(self):
95 impl = minidom.getDOMImplementation() 98 impl = minidom.getDOMImplementation()
96 self._doc = impl.createDocument(None, 'resources', None) 99 self._doc = impl.createDocument(None, 'resources', None)
97 self._resources = self._doc.documentElement 100 self._resources = self._doc.documentElement
98 101
99 def GetTemplateText(self): 102 def GetTemplateText(self):
100 return self.ToPrettyXml(self._doc) 103 return self.ToPrettyXml(self._doc)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698