Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 | |
| 8 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
| |
| 9 | |
| 7 def GetConfigurationForBuild(defines): | 10 def GetConfigurationForBuild(defines): |
| 8 '''Returns a configuration dictionary for the given build that contains | 11 '''Returns a configuration dictionary for the given build that contains |
| 9 build-specific settings and information. | 12 build-specific settings and information. |
| 10 | 13 |
| 11 Args: | 14 Args: |
| 12 defines: Definitions coming from the build system. | 15 defines: Definitions coming from the build system. |
| 13 | 16 |
| 14 Raises: | 17 Raises: |
| 15 Exception: If 'defines' contains an unknown build-type. | 18 Exception: If 'defines' contains an unknown build-type. |
| 16 ''' | 19 ''' |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 47 'win_mandatory_category_path': ['google', 'googlechrome'], | 50 'win_mandatory_category_path': ['google', 'googlechrome'], |
| 48 'win_recommended_category_path': ['google', 'googlechrome_recommended'], | 51 'win_recommended_category_path': ['google', 'googlechrome_recommended'], |
| 49 'admx_namespace': 'Google.Policies.Chrome', | 52 'admx_namespace': 'Google.Policies.Chrome', |
| 50 'admx_prefix': 'chrome', | 53 'admx_prefix': 'chrome', |
| 51 'linux_policy_path': '/etc/opt/chrome/policies/', | 54 'linux_policy_path': '/etc/opt/chrome/policies/', |
| 52 } | 55 } |
| 53 else: | 56 else: |
| 54 raise Exception('Unknown build') | 57 raise Exception('Unknown build') |
| 55 if 'version' in defines: | 58 if 'version' in defines: |
| 56 config['version'] = defines['version'] | 59 config['version'] = defines['version'] |
| 60 else: | |
| 61 version = _parseVersionFile(VERSION_FILE) | |
|
Joao da Silva
2015/11/02 14:37:41
Why isn't the version found in the defines? Should
| |
| 62 if version: | |
| 63 config['version'] = version | |
| 57 config['win_group_policy_class'] = 'Both' | 64 config['win_group_policy_class'] = 'Both' |
| 58 config['win_supported_os'] = 'SUPPORTED_WINXPSP2' | 65 config['win_supported_os'] = 'SUPPORTED_WINXPSP2' |
| 59 if 'mac_bundle_id' in defines: | 66 if 'mac_bundle_id' in defines: |
| 60 config['mac_bundle_id'] = defines['mac_bundle_id'] | 67 config['mac_bundle_id'] = defines['mac_bundle_id'] |
| 61 return config | 68 return config |
| 69 | |
| 70 def _parseVersionFile(path): | |
| 71 versions = {} | |
| 72 keys = ["MAJOR", "MINOR", "BUILD", "PATCH"] | |
| 73 try: | |
| 74 version_file_content = open(path).readlines() | |
| 75 for line in version_file_content: | |
| 76 name, value = line.strip().split('=') | |
| 77 versions[name] = value | |
| 78 return ".".join([versions[key] for key in keys]) | |
| 79 except IOError: | |
| 80 return None | |
| OLD | NEW |