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

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

Issue 631223003: Include chromium version number in policy templates (Closed) Base URL: http://grit-i18n.googlecode.com/svn/trunk/
Patch Set: Created 6 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 | Annotate | Revision Log
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 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 xml.dom import minidom 7 from xml.dom import minidom
8 from grit.format.policy_templates.writers import plist_helper 8 from grit.format.policy_templates.writers import plist_helper
9 from grit.format.policy_templates.writers import xml_formatted_writer 9 from grit.format.policy_templates.writers import xml_formatted_writer
10 10
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 self.AddElement(range_list, element_type, {}, str(item['value'])) 113 self.AddElement(range_list, element_type, {}, str(item['value']))
114 elif policy_type in ('list', 'string-enum-list'): 114 elif policy_type in ('list', 'string-enum-list'):
115 subkeys = self._AddKeyValuePair(dict, 'pfm_subkeys', 'array') 115 subkeys = self._AddKeyValuePair(dict, 'pfm_subkeys', 'array')
116 subkeys_dict = self.AddElement(subkeys, 'dict') 116 subkeys_dict = self.AddElement(subkeys, 'dict')
117 subkeys_type = self._AddKeyValuePair(subkeys_dict, 'pfm_type', 'string') 117 subkeys_type = self._AddKeyValuePair(subkeys_dict, 'pfm_type', 'string')
118 self.AddText(subkeys_type, 'string') 118 self.AddText(subkeys_type, 'string')
119 119
120 def BeginTemplate(self): 120 def BeginTemplate(self):
121 self._plist.attributes['version'] = '1' 121 self._plist.attributes['version'] = '1'
122 dict = self.AddElement(self._plist, 'dict') 122 dict = self.AddElement(self._plist, 'dict')
123 123 if self._GetChromiumVersionString() is not None:
124 self.AddComment(self._plist, self.config['build'] + ' version: ' + \
125 self._GetChromiumVersionString())
124 app_name = plist_helper.GetPlistFriendlyName(self.config['app_name']) 126 app_name = plist_helper.GetPlistFriendlyName(self.config['app_name'])
125 self._AddStringKeyValuePair(dict, 'pfm_name', app_name) 127 self._AddStringKeyValuePair(dict, 'pfm_name', app_name)
126 self._AddStringKeyValuePair(dict, 'pfm_description', '') 128 self._AddStringKeyValuePair(dict, 'pfm_description', '')
127 self._AddStringKeyValuePair(dict, 'pfm_title', '') 129 self._AddStringKeyValuePair(dict, 'pfm_title', '')
128 self._AddStringKeyValuePair(dict, 'pfm_version', '1') 130 self._AddStringKeyValuePair(dict, 'pfm_version', '1')
129 self._AddStringKeyValuePair(dict, 'pfm_domain', 131 self._AddStringKeyValuePair(dict, 'pfm_domain',
130 self.config['mac_bundle_id']) 132 self.config['mac_bundle_id'])
131 133
132 self._array = self._AddKeyValuePair(dict, 'pfm_subkeys', 'array') 134 self._array = self._AddKeyValuePair(dict, 'pfm_subkeys', 'array')
133 135
134 def CreatePlistDocument(self): 136 def CreatePlistDocument(self):
135 dom_impl = minidom.getDOMImplementation('') 137 dom_impl = minidom.getDOMImplementation('')
136 doctype = dom_impl.createDocumentType( 138 doctype = dom_impl.createDocumentType(
137 'plist', 139 'plist',
138 '-//Apple//DTD PLIST 1.0//EN', 140 '-//Apple//DTD PLIST 1.0//EN',
139 'http://www.apple.com/DTDs/PropertyList-1.0.dtd') 141 'http://www.apple.com/DTDs/PropertyList-1.0.dtd')
140 return dom_impl.createDocument(None, 'plist', doctype) 142 return dom_impl.createDocument(None, 'plist', doctype)
141 143
142 def Init(self): 144 def Init(self):
143 self._doc = self.CreatePlistDocument() 145 self._doc = self.CreatePlistDocument()
144 self._plist = self._doc.documentElement 146 self._plist = self._doc.documentElement
145 147
146 def GetTemplateText(self): 148 def GetTemplateText(self):
147 return self.ToPrettyXml(self._doc) 149 return self.ToPrettyXml(self._doc)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698