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

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

Issue 2747023002: Cleanup machine based on the state in configuration file for mini installer test.
Patch Set: refactor to use visitor pattern Created 3 years, 9 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') | chrome/test/mini_installer/verifier.py » ('j') | 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 'CHROME_SHORT_NAME': 'Chromium', 157 'CHROME_SHORT_NAME': 'Chromium',
158 'CHROME_UPDATE_REGISTRY_SUBKEY': 'Software\\Chromium', 158 'CHROME_UPDATE_REGISTRY_SUBKEY': 'Software\\Chromium',
159 'CHROME_CLIENT_STATE_KEY': 'Software\\Chromium', 159 'CHROME_CLIENT_STATE_KEY': 'Software\\Chromium',
160 'SUPPORTS_SXS': False 160 'SUPPORTS_SXS': False
161 }) 161 })
162 else: 162 else:
163 raise KeyError("Unknown mini_installer product name '%s'" % 163 raise KeyError("Unknown mini_installer product name '%s'" %
164 mini_installer_product_name) 164 mini_installer_product_name)
165 165
166 166
167 def Expand(self, str): 167 def Expand(self, input_string):
168 """Expands variables in the given string. 168 """Expands variables in the given string.
169 169
170 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
171 resolve environment variables. Any dollar signs that are not part of 171 resolve environment variables. Any dollar signs that are not part of
172 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
173 be raised. 173 be raised.
174 174
175 Args: 175 Args:
176 str: A string. 176 input_string: A string with variables.
177 177
178 Returns: 178 Returns:
179 A new string created by replacing variables with their values. 179 A new string created by replacing variables with their values.
180 """ 180 """
181 return string.Template(str).substitute(self._variable_mapping) 181 return string.Template(input_string).substitute(self._variable_mapping)
OLDNEW
« no previous file with comments | « chrome/test/mini_installer/test_installer.py ('k') | chrome/test/mini_installer/verifier.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698