Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/pytorch/cpuinfo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarat Dukhan <marat@fb.com>2017-11-28 04:03:18 +0300
committerMarat Dukhan <marat@fb.com>2017-11-28 04:03:18 +0300
commitd5901070ee878dc5b722efbb830a67c3e40b614d (patch)
treeb89551d4aa9f9e2a3dead539ea6e6ae60024ea3f /scripts
parent9bfb1078d6e97c8cc9610454f88309ef5ae6ad56 (diff)
Handle multi-line properties in Android dump
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/android-filesystem-dump.py21
1 files changed, 12 insertions, 9 deletions
diff --git a/scripts/android-filesystem-dump.py b/scripts/android-filesystem-dump.py
index fa21045..6b5a5d1 100755
--- a/scripts/android-filesystem-dump.py
+++ b/scripts/android-filesystem-dump.py
@@ -135,15 +135,18 @@ def adb_shell(commands):
def adb_getprop():
properties = adb_shell(["getprop"])
properties_list = list()
- for prop in properties.splitlines():
- prop = prop.strip()
- if prop:
- key, value = tuple(map(string.strip, prop.split(":", 1)))
- assert key.startswith("[") and key.endswith("]")
- key = key[1:-1]
- assert value.startswith("[") and value.endswith("]")
- value = value[1:-1]
- properties_list.append((key, value))
+ while properties:
+ assert properties.startswith("[")
+ properties = properties[1:]
+ key, properties = properties.split("]", 1)
+ properties = properties.strip()
+ assert properties.startswith(":")
+ properties = properties[1:].strip()
+ assert properties.startswith("[")
+ properties = properties[1:]
+ value, properties = properties.split("]", 1)
+ properties = properties.strip()
+ properties_list.append((key, value))
return properties_list
def dump_device_file(stream, path):