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

Side by Side Diff: build/android/pylib/android_commands.py

Issue 278853002: Remove temporary temporary file deletion (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 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 """Provides an interface to communicate with the device via the adb command. 5 """Provides an interface to communicate with the device via the adb command.
6 6
7 Assumes adb binary is currently on system path. 7 Assumes adb binary is currently on system path.
8 """ 8 """
9 # pylint: disable-all 9 # pylint: disable-all
10 10
(...skipping 1142 matching lines...) Expand 10 before | Expand all | Expand 10 after
1153 return command_runner(command) 1153 return command_runner(command)
1154 else: 1154 else:
1155 logging.warning('Could not access protected file: %s' % filename) 1155 logging.warning('Could not access protected file: %s' % filename)
1156 return [] 1156 return []
1157 1157
1158 def SetProtectedFileContents(self, filename, contents): 1158 def SetProtectedFileContents(self, filename, contents):
1159 """Writes |contents| to the protected file specified by |filename|. 1159 """Writes |contents| to the protected file specified by |filename|.
1160 1160
1161 This is less efficient than SetFileContents. 1161 This is less efficient than SetFileContents.
1162 """ 1162 """
1163 # TODO(skyostil): Remove this once it has been through all the bots.
1164 for file_name in (AndroidCommands._TEMP_FILE_BASE_FMT,
1165 AndroidCommands._TEMP_SCRIPT_FILE_BASE_FMT):
1166 self.RunShellCommand('rm ' + self.GetExternalStorage() + '/' +
1167 file_name.replace('%d', '*'))
1168
1169 temp_file = self._GetDeviceTempFileName(AndroidCommands._TEMP_FILE_BASE_FMT) 1163 temp_file = self._GetDeviceTempFileName(AndroidCommands._TEMP_FILE_BASE_FMT)
1170 temp_script = self._GetDeviceTempFileName( 1164 temp_script = self._GetDeviceTempFileName(
1171 AndroidCommands._TEMP_SCRIPT_FILE_BASE_FMT) 1165 AndroidCommands._TEMP_SCRIPT_FILE_BASE_FMT)
1172 1166
1173 try: 1167 try:
1174 # Put the contents in a temporary file 1168 # Put the contents in a temporary file
1175 self.SetFileContents(temp_file, contents) 1169 self.SetFileContents(temp_file, contents)
1176 # Create a script to copy the file contents to its final destination 1170 # Create a script to copy the file contents to its final destination
1177 self.SetFileContents(temp_script, 'cat %s > %s' % (temp_file, filename)) 1171 self.SetFileContents(temp_script, 'cat %s > %s' % (temp_file, filename))
1178 1172
(...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after
1975 """ 1969 """
1976 def __init__(self, output): 1970 def __init__(self, output):
1977 self._output = output 1971 self._output = output
1978 1972
1979 def write(self, data): 1973 def write(self, data):
1980 data = data.replace('\r\r\n', '\n') 1974 data = data.replace('\r\r\n', '\n')
1981 self._output.write(data) 1975 self._output.write(data)
1982 1976
1983 def flush(self): 1977 def flush(self):
1984 self._output.flush() 1978 self._output.flush()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698