mirror of
https://github.com/ARM-software/devlib.git
synced 2024-10-06 10:50:51 +01:00
commit
df4d06bc7f
@ -101,6 +101,10 @@ class Target(object):
|
|||||||
def abi(self): # pylint: disable=no-self-use
|
def abi(self): # pylint: disable=no-self-use
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
@property
|
||||||
|
def supported_abi(self):
|
||||||
|
return [self.abi]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@memoized
|
@memoized
|
||||||
def cpuinfo(self):
|
def cpuinfo(self):
|
||||||
@ -828,6 +832,30 @@ class AndroidTarget(Target):
|
|||||||
def abi(self):
|
def abi(self):
|
||||||
return self.getprop()['ro.product.cpu.abi'].split('-')[0]
|
return self.getprop()['ro.product.cpu.abi'].split('-')[0]
|
||||||
|
|
||||||
|
@property
|
||||||
|
@memoized
|
||||||
|
def supported_abi(self):
|
||||||
|
props = self.getprop()
|
||||||
|
result = [props['ro.product.cpu.abi']]
|
||||||
|
if 'ro.product.cpu.abi2' in props:
|
||||||
|
result.append(props['ro.product.cpu.abi2'])
|
||||||
|
if 'ro.product.cpu.abilist' in props:
|
||||||
|
for abi in props['ro.product.cpu.abilist'].split(','):
|
||||||
|
if abi not in result:
|
||||||
|
result.append(abi)
|
||||||
|
|
||||||
|
mapped_result = []
|
||||||
|
for supported_abi in result:
|
||||||
|
for abi, architectures in ABI_MAP.iteritems():
|
||||||
|
found = False
|
||||||
|
if supported_abi in architectures and abi not in mapped_result:
|
||||||
|
mapped_result.append(abi)
|
||||||
|
found = True
|
||||||
|
break
|
||||||
|
if not found and supported_abi not in mapped_result:
|
||||||
|
mapped_result.append(supported_abi)
|
||||||
|
return mapped_result
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@memoized
|
@memoized
|
||||||
def os_version(self):
|
def os_version(self):
|
||||||
|
@ -27,7 +27,7 @@ import re
|
|||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
|
||||||
from devlib.exception import TargetError, HostError, DevlibError
|
from devlib.exception import TargetError, HostError, DevlibError
|
||||||
from devlib.utils.misc import check_output, which, memoized
|
from devlib.utils.misc import check_output, which, memoized, ABI_MAP
|
||||||
from devlib.utils.misc import escape_single_quotes, escape_double_quotes
|
from devlib.utils.misc import escape_single_quotes, escape_double_quotes
|
||||||
|
|
||||||
|
|
||||||
@ -124,6 +124,7 @@ class ApkInfo(object):
|
|||||||
self.label = None
|
self.label = None
|
||||||
self.version_name = None
|
self.version_name = None
|
||||||
self.version_code = None
|
self.version_code = None
|
||||||
|
self.native_code = None
|
||||||
self.parse(path)
|
self.parse(path)
|
||||||
|
|
||||||
def parse(self, apk_path):
|
def parse(self, apk_path):
|
||||||
@ -143,6 +144,19 @@ class ApkInfo(object):
|
|||||||
elif line.startswith('launchable-activity:'):
|
elif line.startswith('launchable-activity:'):
|
||||||
match = self.name_regex.search(line)
|
match = self.name_regex.search(line)
|
||||||
self.activity = match.group('name')
|
self.activity = match.group('name')
|
||||||
|
elif line.startswith('native-code'):
|
||||||
|
apk_abis = [entry.strip() for entry in line.split(':')[1].split("'") if entry.strip()]
|
||||||
|
mapped_abis = []
|
||||||
|
for apk_abi in apk_abis:
|
||||||
|
found = False
|
||||||
|
for abi, architectures in ABI_MAP.iteritems():
|
||||||
|
if apk_abi in architectures:
|
||||||
|
mapped_abis.append(abi)
|
||||||
|
found = True
|
||||||
|
break
|
||||||
|
if not found:
|
||||||
|
mapped_abis.append(apk_abi)
|
||||||
|
self.native_code = mapped_abis
|
||||||
else:
|
else:
|
||||||
pass # not interested
|
pass # not interested
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ from devlib.exception import HostError, TimeoutError
|
|||||||
|
|
||||||
# ABI --> architectures list
|
# ABI --> architectures list
|
||||||
ABI_MAP = {
|
ABI_MAP = {
|
||||||
'armeabi': ['armeabi', 'armv7', 'armv7l', 'armv7el', 'armv7lh'],
|
'armeabi': ['armeabi', 'armv7', 'armv7l', 'armv7el', 'armv7lh', 'armeabi-v7a'],
|
||||||
'arm64': ['arm64', 'armv8', 'arm64-v8a', 'aarch64'],
|
'arm64': ['arm64', 'armv8', 'arm64-v8a', 'aarch64'],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user