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

Side by Side Diff: chrome/test/mini_installer/variable_expander.py

Issue 2834973002: Revert of Enable side-by-side beta and dev channels. (Closed)
Patch Set: Created 3 years, 8 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
« no previous file with comments | « chrome/test/mini_installer/test_installer.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 54
55 55
56 class VariableExpander: 56 class VariableExpander:
57 """Expands variables in strings.""" 57 """Expands variables in strings."""
58 58
59 def __init__(self, mini_installer_path, next_version_mini_installer_path): 59 def __init__(self, mini_installer_path, next_version_mini_installer_path):
60 """Constructor. 60 """Constructor.
61 61
62 The constructor initializes a variable dictionary that maps variables to 62 The constructor initializes a variable dictionary that maps variables to
63 their values. These are the only acceptable variables: 63 their values. These are the only acceptable variables:
64 * $BRAND: the browser brand (e.g., "Google Chrome" or "Chromium").
65 * $CHROME_DIR: the directory of Chrome (or Chromium) from the base 64 * $CHROME_DIR: the directory of Chrome (or Chromium) from the base
66 installation directory. 65 installation directory.
67 * $CHROME_HTML_PROG_ID: 'ChromeHTML' (or 'ChromiumHTM'). 66 * $CHROME_HTML_PROG_ID: 'ChromeHTML' (or 'ChromiumHTM').
68 * $CHROME_LONG_NAME: 'Google Chrome' (or 'Chromium'). 67 * $CHROME_LONG_NAME: 'Google Chrome' (or 'Chromium').
69 * $CHROME_LONG_NAME_BETA: 'Google Chrome Beta' if $BRAND is 'Google 68 * $CHROME_LONG_NAME_SXS: 'Google Chrome SxS' if $SUPPORTS_SXS.
70 * Chrome'.
71 * $CHROME_LONG_NAME_DEV: 'Google Chrome Dev' if $BRAND is 'Google
72 * Chrome'.
73 * $CHROME_LONG_NAME_SXS: 'Google Chrome SxS' if $BRAND is 'Google
74 * Chrome'.
75 * $CHROME_SHORT_NAME: 'Chrome' (or 'Chromium'). 69 * $CHROME_SHORT_NAME: 'Chrome' (or 'Chromium').
76 * $CHROME_SHORT_NAME_BETA: 'ChromeBeta' if $BRAND is 'Google Chrome'. 70 * $CHROME_SHORT_NAME_SXS: 'ChromeCanary' if $SUPPORTS_SXS.
77 * $CHROME_SHORT_NAME_DEV: 'ChromeDev' if $BRAND is 'Google Chrome'.
78 * $CHROME_SHORT_NAME_SXS: 'ChromeCanary' if $BRAND is 'Google Chrome'.
79 * $CHROME_UPDATE_REGISTRY_SUBKEY: the registry key, excluding the root 71 * $CHROME_UPDATE_REGISTRY_SUBKEY: the registry key, excluding the root
80 key, of Chrome for Google Update. 72 key, of Chrome for Google Update.
81 * $CHROME_UPDATE_REGISTRY_SUBKEY_DEV: the registry key, excluding the
82 root key, of Chrome Dev for Google Update.
83 * $CHROME_UPDATE_REGISTRY_SUBKEY_BETA: the registry key, excluding the
84 root key, of Chrome Beta for Google Update.
85 * $CHROME_UPDATE_REGISTRY_SUBKEY_SXS: the registry key, excluding the 73 * $CHROME_UPDATE_REGISTRY_SUBKEY_SXS: the registry key, excluding the
86 root key, of Chrome SxS for Google Update. 74 root key, of Chrome SxS for Google Update.
87 * $LAUNCHER_UPDATE_REGISTRY_SUBKEY: the registry key, excluding the root 75 * $LAUNCHER_UPDATE_REGISTRY_SUBKEY: the registry key, excluding the root
88 key, of the app launcher for Google Update if $BRAND is 'Google 76 key, of the app launcher for Google Update if $SUPPORTS_SXS.
89 * Chrome'.
90 * $LOCAL_APPDATA: the unquoted path to the Local Application Data 77 * $LOCAL_APPDATA: the unquoted path to the Local Application Data
91 folder. 78 folder.
92 * $MINI_INSTALLER: the unquoted path to the mini_installer. 79 * $MINI_INSTALLER: the unquoted path to the mini_installer.
93 * $MINI_INSTALLER_FILE_VERSION: the file version of $MINI_INSTALLER. 80 * $MINI_INSTALLER_FILE_VERSION: the file version of $MINI_INSTALLER.
94 * $NEXT_VERSION_MINI_INSTALLER: the unquoted path to a mini_installer 81 * $NEXT_VERSION_MINI_INSTALLER: the unquoted path to a mini_installer
95 whose version is higher than $MINI_INSTALLER. 82 whose version is higher than $MINI_INSTALLER.
96 * $NEXT_VERSION_MINI_INSTALLER_FILE_VERSION: the file version of 83 * $NEXT_VERSION_MINI_INSTALLER_FILE_VERSION: the file version of
97 $NEXT_VERSION_MINI_INSTALLER. 84 $NEXT_VERSION_MINI_INSTALLER.
98 * $PROGRAM_FILES: the unquoted path to the Program Files folder. 85 * $PROGRAM_FILES: the unquoted path to the Program Files folder.
86 * $SUPPORTS_SXS: a boolean indicating whether or not SxS installs
87 are supported by the mini_installer under test.
99 * $USER_SPECIFIC_REGISTRY_SUFFIX: the output from the function 88 * $USER_SPECIFIC_REGISTRY_SUFFIX: the output from the function
100 _GetUserSpecificRegistrySuffix(). 89 _GetUserSpecificRegistrySuffix().
101 * $VERSION_[XP/SERVER_2003/VISTA/WIN7/WIN8/WIN8_1/WIN10]: a 2-tuple 90 * $VERSION_[XP/SERVER_2003/VISTA/WIN7/WIN8/WIN8_1/WIN10]: a 2-tuple
102 representing the version of the corresponding OS. 91 representing the version of the corresponding OS.
103 * $WINDOWS_VERSION: a 2-tuple representing the current Windows version. 92 * $WINDOWS_VERSION: a 2-tuple representing the current Windows version.
104 93
105 Args: 94 Args:
106 mini_installer_path: The path to a mini_installer. 95 mini_installer_path: The path to a mini_installer.
107 next_version_mini_installer_path: The path to a mini_installer whose 96 next_version_mini_installer_path: The path to a mini_installer whose
108 version is higher than |mini_installer_path|. 97 version is higher than |mini_installer_path|.
(...skipping 19 matching lines...) Expand all
128 'VERSION_WIN7': '(6, 1)', 117 'VERSION_WIN7': '(6, 1)',
129 'VERSION_WIN8': '(6, 2)', 118 'VERSION_WIN8': '(6, 2)',
130 'VERSION_WIN8_1': '(6, 3)', 119 'VERSION_WIN8_1': '(6, 3)',
131 'VERSION_XP': '(5, 1)', 120 'VERSION_XP': '(5, 1)',
132 'WINDOWS_VERSION': '(%s, %s)' % (windows_major_ver, windows_minor_ver) 121 'WINDOWS_VERSION': '(%s, %s)' % (windows_major_ver, windows_minor_ver)
133 } 122 }
134 123
135 mini_installer_product_name = _GetProductName(mini_installer_abspath) 124 mini_installer_product_name = _GetProductName(mini_installer_abspath)
136 if mini_installer_product_name == 'Google Chrome Installer': 125 if mini_installer_product_name == 'Google Chrome Installer':
137 self._variable_mapping.update({ 126 self._variable_mapping.update({
138 'BRAND': 'Google Chrome',
139 'BINARIES_UPDATE_REGISTRY_SUBKEY': ( 127 'BINARIES_UPDATE_REGISTRY_SUBKEY': (
140 'Software\\Google\\Update\\Clients\\' 128 'Software\\Google\\Update\\Clients\\'
141 '{4DC8B4CA-1BDA-483e-B5FA-D3C12E15B62D}'), 129 '{4DC8B4CA-1BDA-483e-B5FA-D3C12E15B62D}'),
142 'CHROME_DIR': 'Google\\Chrome', 130 'CHROME_DIR': 'Google\\Chrome',
143 'CHROME_HTML_PROG_ID': 'ChromeHTML', 131 'CHROME_HTML_PROG_ID': 'ChromeHTML',
144 'CHROME_LONG_NAME': 'Google Chrome', 132 'CHROME_LONG_NAME': 'Google Chrome',
145 'CHROME_SHORT_NAME': 'Chrome', 133 'CHROME_SHORT_NAME': 'Chrome',
146 'CHROME_UPDATE_REGISTRY_SUBKEY': ( 134 'CHROME_UPDATE_REGISTRY_SUBKEY': (
147 'Software\\Google\\Update\\Clients\\' 135 'Software\\Google\\Update\\Clients\\'
148 '{8A69D345-D564-463c-AFF1-A69D9E530F96}'), 136 '{8A69D345-D564-463c-AFF1-A69D9E530F96}'),
149 'CHROME_CLIENT_STATE_KEY': ( 137 'CHROME_CLIENT_STATE_KEY': (
150 'Software\\Google\\Update\\ClientState\\' 138 'Software\\Google\\Update\\ClientState\\'
151 '{8A69D345-D564-463c-AFF1-A69D9E530F96}'), 139 '{8A69D345-D564-463c-AFF1-A69D9E530F96}'),
152 'CHROME_DIR_BETA': 'Google\\Chrome Beta', 140 'SUPPORTS_SXS': True,
153 'CHROME_DIR_DEV': 'Google\\Chrome Dev',
154 'CHROME_DIR_SXS': 'Google\\Chrome SxS', 141 'CHROME_DIR_SXS': 'Google\\Chrome SxS',
155 'CHROME_LONG_NAME_BETA': 'Google Chrome Beta',
156 'CHROME_LONG_NAME_DEV': 'Google Chrome Dev',
157 'CHROME_LONG_NAME_SXS': 'Google Chrome SxS', 142 'CHROME_LONG_NAME_SXS': 'Google Chrome SxS',
158 'CHROME_SHORT_NAME_BETA': 'ChromeBeta',
159 'CHROME_SHORT_NAME_DEV': 'ChromeDev',
160 'CHROME_SHORT_NAME_SXS': 'ChromeCanary', 143 'CHROME_SHORT_NAME_SXS': 'ChromeCanary',
161 'CHROME_UPDATE_REGISTRY_SUBKEY_BETA': (
162 'Software\\Google\\Update\\Clients\\'
163 '{8237E44A-0054-442C-B6B6-EA0509993955}'),
164 'CHROME_UPDATE_REGISTRY_SUBKEY_DEV': (
165 'Software\\Google\\Update\\Clients\\'
166 '{401C381F-E0DE-4B85-8BD8-3F3F14FBDA57}'),
167 'CHROME_UPDATE_REGISTRY_SUBKEY_SXS': ( 144 'CHROME_UPDATE_REGISTRY_SUBKEY_SXS': (
168 'Software\\Google\\Update\\Clients\\' 145 'Software\\Google\\Update\\Clients\\'
169 '{4ea16ac7-fd5a-47c3-875b-dbf4a2008c20}'), 146 '{4ea16ac7-fd5a-47c3-875b-dbf4a2008c20}'),
170 'LAUNCHER_UPDATE_REGISTRY_SUBKEY': ( 147 'LAUNCHER_UPDATE_REGISTRY_SUBKEY': (
171 'Software\\Google\\Update\\Clients\\' 148 'Software\\Google\\Update\\Clients\\'
172 '{FDA71E6F-AC4C-4a00-8B70-9958A68906BF}') 149 '{FDA71E6F-AC4C-4a00-8B70-9958A68906BF}')
173 }) 150 })
174 elif mini_installer_product_name == 'Chromium Installer': 151 elif mini_installer_product_name == 'Chromium Installer':
175 self._variable_mapping.update({ 152 self._variable_mapping.update({
176 'BRAND': 'Chromium',
177 'BINARIES_UPDATE_REGISTRY_SUBKEY': 'Software\\Chromium Binaries', 153 'BINARIES_UPDATE_REGISTRY_SUBKEY': 'Software\\Chromium Binaries',
178 'CHROME_DIR': 'Chromium', 154 'CHROME_DIR': 'Chromium',
179 'CHROME_HTML_PROG_ID': 'ChromiumHTM', 155 'CHROME_HTML_PROG_ID': 'ChromiumHTM',
180 'CHROME_LONG_NAME': 'Chromium', 156 'CHROME_LONG_NAME': 'Chromium',
181 'CHROME_SHORT_NAME': 'Chromium', 157 'CHROME_SHORT_NAME': 'Chromium',
182 'CHROME_UPDATE_REGISTRY_SUBKEY': 'Software\\Chromium', 158 'CHROME_UPDATE_REGISTRY_SUBKEY': 'Software\\Chromium',
183 'CHROME_CLIENT_STATE_KEY': 'Software\\Chromium', 159 'CHROME_CLIENT_STATE_KEY': 'Software\\Chromium',
160 'SUPPORTS_SXS': False
184 }) 161 })
185 else: 162 else:
186 raise KeyError("Unknown mini_installer product name '%s'" % 163 raise KeyError("Unknown mini_installer product name '%s'" %
187 mini_installer_product_name) 164 mini_installer_product_name)
188 165
189 166
190 def Expand(self, str): 167 def Expand(self, str):
191 """Expands variables in the given string. 168 """Expands variables in the given string.
192 169
193 This method resolves only variables defined in the constructor. It does not 170 This method resolves only variables defined in the constructor. It does not
194 resolve environment variables. Any dollar signs that are not part of 171 resolve environment variables. Any dollar signs that are not part of
195 variables must be escaped with $$, otherwise a KeyError or a ValueError will 172 variables must be escaped with $$, otherwise a KeyError or a ValueError will
196 be raised. 173 be raised.
197 174
198 Args: 175 Args:
199 str: A string. 176 str: A string.
200 177
201 Returns: 178 Returns:
202 A new string created by replacing variables with their values. 179 A new string created by replacing variables with their values.
203 """ 180 """
204 return string.Template(str).substitute(self._variable_mapping) 181 return string.Template(str).substitute(self._variable_mapping)
OLDNEW
« no previous file with comments | « chrome/test/mini_installer/test_installer.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698