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

Unified Diff: grit/format/policy_templates/writer_configuration.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 side-by-side diff with in-line comments
Download patch
Index: grit/format/policy_templates/writer_configuration.py
diff --git a/grit/format/policy_templates/writer_configuration.py b/grit/format/policy_templates/writer_configuration.py
index db9613b2eca0d71a9feaad870526b549f2b7f8be..ca9396addf2184d091ccf7df261cb90d1836fe0f 100644
--- a/grit/format/policy_templates/writer_configuration.py
+++ b/grit/format/policy_templates/writer_configuration.py
@@ -4,6 +4,9 @@
# found in the LICENSE file.
+
+VERSION_FILE="../chrome/VERSION"
Joao da Silva 2015/11/02 14:37:41 The right way to do this would be to take the Chro
+
def GetConfigurationForBuild(defines):
'''Returns a configuration dictionary for the given build that contains
build-specific settings and information.
@@ -54,8 +57,24 @@ def GetConfigurationForBuild(defines):
raise Exception('Unknown build')
if 'version' in defines:
config['version'] = defines['version']
+ else:
+ version = _parseVersionFile(VERSION_FILE)
Joao da Silva 2015/11/02 14:37:41 Why isn't the version found in the defines? Should
+ if version:
+ config['version'] = version
config['win_group_policy_class'] = 'Both'
config['win_supported_os'] = 'SUPPORTED_WINXPSP2'
if 'mac_bundle_id' in defines:
config['mac_bundle_id'] = defines['mac_bundle_id']
return config
+
+def _parseVersionFile(path):
+ versions = {}
+ keys = ["MAJOR", "MINOR", "BUILD", "PATCH"]
+ try:
+ version_file_content = open(path).readlines()
+ for line in version_file_content:
+ name, value = line.strip().split('=')
+ versions[name] = value
+ return ".".join([versions[key] for key in keys])
+ except IOError:
+ return None

Powered by Google App Engine
This is Rietveld 408576698