Skip to content

Commit

Permalink
backport android version check fixes from @monkut. Closes #137. Closes
Browse files Browse the repository at this point in the history
  • Loading branch information
tito committed Sep 22, 2014
1 parent fcf0b0a commit d3948ab
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions buildozer/targets/android.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,9 +311,14 @@ def _android_update_sdk(self, packages):
break
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):
try:
versions = os.listdir(join(*args))
versions = [self._process_version_string(v) for v in
os.listdir(join(*args))]
versions.sort()
return versions[-1]
except:
Expand All @@ -322,11 +327,17 @@ def _read_version_subdir(self, *args):
return '0'

def _find_latest_package(self, packages, key):
l = [x for x in packages if x.startswith(key)]
if not l:
package_versions = []
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
l.sort()
return l[-1]
package_versions.sort()
return package_versions[-1]

def _install_android_packages(self):
# 3 pass installation.
Expand Down

0 comments on commit d3948ab

Please sign in to comment.