Merge "vndk-def: Fix check-dep --check-apk in Python 2"
This commit is contained in:
@@ -2694,6 +2694,13 @@ def scan_apk_dep(graph, system_dirs, vendor_dirs):
|
|||||||
libnames = _build_lib_names_dict(graph)
|
libnames = _build_lib_names_dict(graph)
|
||||||
results = []
|
results = []
|
||||||
|
|
||||||
|
if str is bytes:
|
||||||
|
def decode(string): # PY2
|
||||||
|
return string.decode('mutf-8').encode('utf-8')
|
||||||
|
else:
|
||||||
|
def decode(string): # PY3
|
||||||
|
return string.decode('mutf-8')
|
||||||
|
|
||||||
for ap, path in _enumerate_paths(system_dirs, vendor_dirs):
|
for ap, path in _enumerate_paths(system_dirs, vendor_dirs):
|
||||||
# Read the dex file from various file formats
|
# Read the dex file from various file formats
|
||||||
try:
|
try:
|
||||||
@@ -2704,7 +2711,7 @@ def scan_apk_dep(graph, system_dirs, vendor_dirs):
|
|||||||
strings = set()
|
strings = set()
|
||||||
for string in dex_string_iter:
|
for string in dex_string_iter:
|
||||||
try:
|
try:
|
||||||
strings.add(string.decode('mutf-8'))
|
strings.add(decode(string))
|
||||||
except UnicodeSurrogateDecodeError:
|
except UnicodeSurrogateDecodeError:
|
||||||
pass
|
pass
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
|
|||||||
Reference in New Issue
Block a user