backport android version check fixes from @monkut. Closes #137. Closes #143

This commit is contained in:
Mathieu Virbel 2014-09-22 20:42:21 +02:00
parent fcf0b0aaf2
commit d3948ab0a4

View file

@ -311,9 +311,14 @@ class TargetAndroid(Target):
break break
child.sendline('y') child.sendline('y')
def _process_version_string(self, version_string):
version = [int(i) for i in version_string.split(".")]
return version
def _read_version_subdir(self, *args): def _read_version_subdir(self, *args):
try: try:
versions = os.listdir(join(*args)) versions = [self._process_version_string(v) for v in
os.listdir(join(*args))]
versions.sort() versions.sort()
return versions[-1] return versions[-1]
except: except:
@ -322,11 +327,17 @@ class TargetAndroid(Target):
return '0' return '0'
def _find_latest_package(self, packages, key): def _find_latest_package(self, packages, key):
l = [x for x in packages if x.startswith(key)] package_versions = []
if not l: for p in packages:
if not p.startswith(key):
continue
version_string = p.split(key)[-1]
version = self._process_version_string(version_string)
package_versions.append(version)
if not package_versions:
return return
l.sort() package_versions.sort()
return l[-1] return package_versions[-1]
def _install_android_packages(self): def _install_android_packages(self):
# 3 pass installation. # 3 pass installation.