Chromium Code Reviews| 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 |