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

Side by Side Diff: build/android/pylib/device/device_utils.py

Issue 910793002: Allow empty line when parsing properties files. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 | « 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 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 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 a variety of device interactions based on adb. 5 """Provides a variety of device interactions based on adb.
6 6
7 Eventually, this will be based on adb_wrapper. 7 Eventually, this will be based on adb_wrapper.
8 """ 8 """
9 # pylint: disable=unused-argument 9 # pylint: disable=unused-argument
10 10
(...skipping 1028 matching lines...) Expand 10 before | Expand all | Expand 10 after
1039 1039
1040 Returns: 1040 Returns:
1041 True if the device-side property changed and a restart is required as a 1041 True if the device-side property changed and a restart is required as a
1042 result, False otherwise. 1042 result, False otherwise.
1043 1043
1044 Raises: 1044 Raises:
1045 CommandTimeoutError on timeout. 1045 CommandTimeoutError on timeout.
1046 """ 1046 """
1047 def find_property(lines, property_name): 1047 def find_property(lines, property_name):
1048 for index, line in enumerate(lines): 1048 for index, line in enumerate(lines):
1049 if line.strip() == '':
1050 continue
1049 key, value = (s.strip() for s in line.split('=', 1)) 1051 key, value = (s.strip() for s in line.split('=', 1))
1050 if key == property_name: 1052 if key == property_name:
1051 return index, value 1053 return index, value
1052 return None, '' 1054 return None, ''
1053 1055
1054 new_value = 'all' if enabled else '' 1056 new_value = 'all' if enabled else ''
1055 1057
1056 # First ensure the desired property is persisted. 1058 # First ensure the desired property is persisted.
1057 try: 1059 try:
1058 properties = self.ReadFile( 1060 properties = self.ReadFile(
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
1364 Returns: 1366 Returns:
1365 A Parallelizer operating over |devices|. 1367 A Parallelizer operating over |devices|.
1366 """ 1368 """
1367 if not devices: 1369 if not devices:
1368 devices = adb_wrapper.AdbWrapper.GetDevices() 1370 devices = adb_wrapper.AdbWrapper.GetDevices()
1369 devices = [d if isinstance(d, cls) else cls(d) for d in devices] 1371 devices = [d if isinstance(d, cls) else cls(d) for d in devices]
1370 if async: 1372 if async:
1371 return parallelizer.Parallelizer(devices) 1373 return parallelizer.Parallelizer(devices)
1372 else: 1374 else:
1373 return parallelizer.SyncParallelizer(devices) 1375 return parallelizer.SyncParallelizer(devices)
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