OLD | NEW |
1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import base64 | 5 import base64 |
6 import hashlib | 6 import hashlib |
7 import os | 7 import os |
8 import string | 8 import string |
9 import win32api | 9 import win32api |
10 import win32com.client | 10 import win32com.client |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 * $CHROME_SHORT_NAME: 'Chrome' (or 'Chromium'). | 69 * $CHROME_SHORT_NAME: 'Chrome' (or 'Chromium'). |
70 * $CHROME_LONG_NAME: 'Google Chrome' (or 'Chromium'). | 70 * $CHROME_LONG_NAME: 'Google Chrome' (or 'Chromium'). |
71 * $CHROME_DIR: the directory of Chrome (or Chromium) from the base | 71 * $CHROME_DIR: the directory of Chrome (or Chromium) from the base |
72 installation directory. | 72 installation directory. |
73 * $CHROME_UPDATE_REGISTRY_SUBKEY: the registry key, excluding the root | 73 * $CHROME_UPDATE_REGISTRY_SUBKEY: the registry key, excluding the root |
74 key, of Chrome for Google Update. | 74 key, of Chrome for Google Update. |
75 * $CHROME_HTML_PROG_ID: 'ChromeHTML' (or 'ChromiumHTM'). | 75 * $CHROME_HTML_PROG_ID: 'ChromeHTML' (or 'ChromiumHTM'). |
76 * $USER_SPECIFIC_REGISTRY_SUFFIX: the output from the function | 76 * $USER_SPECIFIC_REGISTRY_SUFFIX: the output from the function |
77 _GetUserSpecificRegistrySuffix(). | 77 _GetUserSpecificRegistrySuffix(). |
78 * $WINDOWS_VERSION: a 2-tuple representing the current Windows version. | 78 * $WINDOWS_VERSION: a 2-tuple representing the current Windows version. |
79 * $VERSION_[XP/SERVER_2003/VISTA/WIN7/WIN8/WIN8_1]: a 2-tuple | 79 * $VERSION_[XP/SERVER_2003/VISTA/WIN7/WIN8/WIN8_1/WIN10]: a 2-tuple |
80 representing the version of the corresponding OS. | 80 representing the version of the corresponding OS. |
81 | 81 |
82 Args: | 82 Args: |
83 mini_installer_path: The path to mini_installer.exe. | 83 mini_installer_path: The path to mini_installer.exe. |
84 """ | 84 """ |
85 mini_installer_abspath = os.path.abspath(mini_installer_path) | 85 mini_installer_abspath = os.path.abspath(mini_installer_path) |
86 mini_installer_file_version = _GetFileVersion(mini_installer_abspath) | 86 mini_installer_file_version = _GetFileVersion(mini_installer_abspath) |
87 mini_installer_product_name = _GetProductName(mini_installer_abspath) | 87 mini_installer_product_name = _GetProductName(mini_installer_abspath) |
88 program_files_path = shell.SHGetFolderPath(0, shellcon.CSIDL_PROGRAM_FILES, | 88 program_files_path = shell.SHGetFolderPath(0, shellcon.CSIDL_PROGRAM_FILES, |
89 None, 0) | 89 None, 0) |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 'CHROME_UPDATE_REGISTRY_SUBKEY': chrome_update_registry_subkey, | 122 'CHROME_UPDATE_REGISTRY_SUBKEY': chrome_update_registry_subkey, |
123 'CHROME_HTML_PROG_ID': chrome_html_prog_id, | 123 'CHROME_HTML_PROG_ID': chrome_html_prog_id, |
124 'USER_SPECIFIC_REGISTRY_SUFFIX': user_specific_registry_suffix, | 124 'USER_SPECIFIC_REGISTRY_SUFFIX': user_specific_registry_suffix, |
125 'WINDOWS_VERSION': windows_version, | 125 'WINDOWS_VERSION': windows_version, |
126 'VERSION_XP': '(5, 1)', | 126 'VERSION_XP': '(5, 1)', |
127 'VERSION_SERVER_2003': '(5, 2)', | 127 'VERSION_SERVER_2003': '(5, 2)', |
128 'VERSION_VISTA': '(6, 0)', | 128 'VERSION_VISTA': '(6, 0)', |
129 'VERSION_WIN7': '(6, 1)', | 129 'VERSION_WIN7': '(6, 1)', |
130 'VERSION_WIN8': '(6, 2)', | 130 'VERSION_WIN8': '(6, 2)', |
131 'VERSION_WIN8_1': '(6, 3)', | 131 'VERSION_WIN8_1': '(6, 3)', |
| 132 'VERSION_WIN10': '(10, 0)', |
132 } | 133 } |
133 | 134 |
134 def Expand(self, str): | 135 def Expand(self, str): |
135 """Expands variables in the given string. | 136 """Expands variables in the given string. |
136 | 137 |
137 This method resolves only variables defined in the constructor. It does not | 138 This method resolves only variables defined in the constructor. It does not |
138 resolve environment variables. Any dollar signs that are not part of | 139 resolve environment variables. Any dollar signs that are not part of |
139 variables must be escaped with $$, otherwise a KeyError or a ValueError will | 140 variables must be escaped with $$, otherwise a KeyError or a ValueError will |
140 be raised. | 141 be raised. |
141 | 142 |
142 Args: | 143 Args: |
143 str: A string. | 144 str: A string. |
144 | 145 |
145 Returns: | 146 Returns: |
146 A new string created by replacing variables with their values. | 147 A new string created by replacing variables with their values. |
147 """ | 148 """ |
148 return string.Template(str).substitute(self._variable_mapping) | 149 return string.Template(str).substitute(self._variable_mapping) |
OLD | NEW |