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

Side by Side Diff: grit/format/policy_templates/writers/reg_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 import json 7 import json
8 8
9 from grit.format.policy_templates.writers import template_writer 9 from grit.format.policy_templates.writers import template_writer
10 10
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 example_value_str = 'dword:00000001' 75 example_value_str = 'dword:00000001'
76 else: 76 else:
77 example_value_str = 'dword:00000000' 77 example_value_str = 'dword:00000000'
78 elif policy['type'] in ('int', 'int-enum'): 78 elif policy['type'] in ('int', 'int-enum'):
79 example_value_str = 'dword:%08x' % example_value 79 example_value_str = 'dword:%08x' % example_value
80 else: 80 else:
81 raise Exception('unknown policy type %s:' % policy['type']) 81 raise Exception('unknown policy type %s:' % policy['type'])
82 82
83 list.append('"%s"=%s' % (policy['name'], example_value_str)) 83 list.append('"%s"=%s' % (policy['name'], example_value_str))
84 84
85 def WriteComment(self, comment):
86 self._prefix.append('; ' + comment)
87
85 def WritePolicy(self, policy): 88 def WritePolicy(self, policy):
86 if self.CanBeMandatory(policy): 89 if self.CanBeMandatory(policy):
87 self._WritePolicy(policy, 90 self._WritePolicy(policy,
88 self.config['win_reg_mandatory_key_name'], 91 self.config['win_reg_mandatory_key_name'],
89 self._mandatory) 92 self._mandatory)
90 93
91 def WriteRecommendedPolicy(self, policy): 94 def WriteRecommendedPolicy(self, policy):
92 self._WritePolicy(policy, 95 self._WritePolicy(policy,
93 self.config['win_reg_recommended_key_name'], 96 self.config['win_reg_recommended_key_name'],
94 self._recommended) 97 self._recommended)
95 98
96 def BeginTemplate(self): 99 def BeginTemplate(self):
97 pass 100 pass
98 101
99 def EndTemplate(self): 102 def EndTemplate(self):
100 pass 103 pass
101 104
102 def Init(self): 105 def Init(self):
103 self._mandatory = [] 106 self._mandatory = []
104 self._recommended = [] 107 self._recommended = []
105 self._last_key = {} 108 self._last_key = {}
109 self._prefix = []
106 110
107 def GetTemplateText(self): 111 def GetTemplateText(self):
108 prefix = ['Windows Registry Editor Version 5.00'] 112 self._prefix.append('Windows Registry Editor Version 5.00')
109 all = prefix + self._mandatory + self._recommended 113 if self._GetChromiumVersionString() is not None:
114 self.WriteComment(self.config['build'] + ' version: ' + \
115 self._GetChromiumVersionString())
116 all = self._prefix + self._mandatory + self._recommended
110 return self.NEWLINE.join(all) 117 return self.NEWLINE.join(all)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698