From 14fb039b99fbf9ec534c2b9e83ced1df0b16dfb5 Mon Sep 17 00:00:00 2001 From: Fabian Kreutz Date: Sat, 6 Jul 2013 17:12:25 +0300 Subject: [PATCH 1/8] Europython sprint outcome: enable download of 64bit NDK version --- buildozer/targets/android.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/buildozer/targets/android.py b/buildozer/targets/android.py index 812069758..fe1af73e4 100644 --- a/buildozer/targets/android.py +++ b/buildozer/targets/android.py @@ -16,6 +16,7 @@ import traceback +import os from pipes import quote from sys import platform, executable from buildozer.target import Target @@ -230,16 +231,19 @@ def _install_android_ndk(self): self.buildozer.info('Android NDK is missing, downloading') if platform in ('win32', 'cygwin'): + architecture = None archive = 'android-ndk-r{0}-windows.zip' elif platform in ('darwin', ): - archive = 'android-ndk-r{0}-darwin-x86.tar.bz2' + architecture = os.uname()[4] + archive = 'android-ndk-r{0}-darwin-{1}.tar.bz2' elif platform in ('linux2', 'linux3'): - archive = 'android-ndk-r{0}-linux-x86.tar.bz2' + architecture = os.uname()[4] + archive = 'android-ndk-r{0}-linux-{1}.tar.bz2' else: raise SystemError('Unsupported platform: {0}'.format(platform)) unpacked = 'android-ndk-r{0}' - archive = archive.format(self.android_ndk_version) + archive = archive.format(self.android_ndk_version, architecture) unpacked = unpacked.format(self.android_ndk_version) url = 'http://dl.google.com/android/ndk/' self.buildozer.download(url, archive, From fb7950bef8daf8ac5a75ca67379398fed1720f7b Mon Sep 17 00:00:00 2001 From: Fabian Kreutz Date: Sat, 6 Jul 2013 17:12:57 +0300 Subject: [PATCH 2/8] Europython sprint: Typo and better error message for missing version definition --- buildozer/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/buildozer/__init__.py b/buildozer/__init__.py index f44071f08..628e589f4 100644 --- a/buildozer/__init__.py +++ b/buildozer/__init__.py @@ -498,7 +498,8 @@ def get_version(self): match = search(regex, data) if not match: raise Exception( - 'Unable to found capture version in {0}'.format(fn)) + 'Unable to find capture version in {0}\n' + ' (looking for `{1}`)'.format(fn, regex)) version = match.groups()[0] self.debug('Captured version: {0}'.format(version)) return version From 6a698c659688d0cacaee9f610c39ed630d1cae4f Mon Sep 17 00:00:00 2001 From: Fabian Kreutz Date: Sat, 6 Jul 2013 17:10:46 +0300 Subject: [PATCH 3/8] Europython sprint: put internally provided ant into os-path --- buildozer/targets/android.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/buildozer/targets/android.py b/buildozer/targets/android.py index fe1af73e4..42b84720d 100644 --- a/buildozer/targets/android.py +++ b/buildozer/targets/android.py @@ -88,23 +88,28 @@ def check_requirements(self): except: traceback.print_exc() self.android_cmd = join(self.android_sdk_dir, 'tools', 'android.bat') - self.ant_cmd = join(self.apache_ant_dir, 'bin', 'ant.bat') self.adb_cmd = join(self.android_sdk_dir, 'platform-tools', 'adb.exe') self.javac_cmd = self._locate_java('javac.exe') self.keytool_cmd = self._locate_java('keytool.exe') elif platform in ('darwin', ): self.android_cmd = join(self.android_sdk_dir, 'tools', 'android') - self.ant_cmd = join(self.apache_ant_dir, 'bin', 'ant') self.adb_cmd = join(self.android_sdk_dir, 'platform-tools', 'adb') self.javac_cmd = self._locate_java('javac') self.keytool_cmd = self._locate_java('keytool') else: self.android_cmd = join(self.android_sdk_dir, 'tools', 'android') - self.ant_cmd = join(self.apache_ant_dir, 'bin', 'ant') self.adb_cmd = join(self.android_sdk_dir, 'platform-tools', 'adb') self.javac_cmd = self._locate_java('javac') self.keytool_cmd = self._locate_java('keytool') + # Need to add internally installed ant to path for external tools + # like adb to use + path = [join(self.apache_ant_dir, 'bin')] + if 'PATH' in self.buildozer.environ: + path.append(self.buildozer.environ['PATH']) + else: + path.append(os.environ['PATH']) + self.buildozer.environ['PATH'] = ':'.join(path) checkbin = self.buildozer.checkbin checkbin('Git git', 'git') checkbin('Cython cython', 'cython') From 9a625e4ceb18bce4946b36eb9d2903b341842397 Mon Sep 17 00:00:00 2001 From: Fabian Kreutz Date: Sat, 6 Jul 2013 17:43:01 +0300 Subject: [PATCH 4/8] Europython sprint: Fix for prior ndk-url fix: uname()[4] for 32bit is not x86 --- buildozer/targets/android.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/buildozer/targets/android.py b/buildozer/targets/android.py index 42b84720d..bebc3735b 100644 --- a/buildozer/targets/android.py +++ b/buildozer/targets/android.py @@ -236,17 +236,18 @@ def _install_android_ndk(self): self.buildozer.info('Android NDK is missing, downloading') if platform in ('win32', 'cygwin'): - architecture = None - archive = 'android-ndk-r{0}-windows.zip' + is_64 = False # TODO: figure out bittiness + archive = 'android-ndk-r{0}-windows-{1}.tar.gz' elif platform in ('darwin', ): - architecture = os.uname()[4] + is_64 = (os.uname()[4] == 'x86_64') archive = 'android-ndk-r{0}-darwin-{1}.tar.bz2' elif platform in ('linux2', 'linux3'): - architecture = os.uname()[4] + is_64 = (os.uname()[4] == 'x86_64') archive = 'android-ndk-r{0}-linux-{1}.tar.bz2' else: raise SystemError('Unsupported platform: {0}'.format(platform)) + architecture = 'x86_64' if is_64 else 'x86' unpacked = 'android-ndk-r{0}' archive = archive.format(self.android_ndk_version, architecture) unpacked = unpacked.format(self.android_ndk_version) From 41412541204dede4f983847c88b8e18d0be3e61c Mon Sep 17 00:00:00 2001 From: Mathieu Virbel Date: Sat, 6 Jul 2013 17:24:02 +0200 Subject: [PATCH 5/8] fix adb devices by using the self.adb_cmd --- buildozer/targets/android.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildozer/targets/android.py b/buildozer/targets/android.py index 4d710182a..a0040ac6c 100644 --- a/buildozer/targets/android.py +++ b/buildozer/targets/android.py @@ -471,7 +471,7 @@ def serials(self): serial = environ.get('ANDROID_SERIAL') if serial: return serial.split(',') - l = self.buildozer.cmd('adb devices', + l = self.buildozer.cmd('{} devices'.format(self.adb_cmd), get_stdout=True)[0].splitlines()[1:-1] serials = [] for serial in l: From a4ea97ac037900a1d8fd12fc1ae95c7be1a2cf37 Mon Sep 17 00:00:00 2001 From: Mathieu Virbel Date: Sat, 6 Jul 2013 17:28:00 +0200 Subject: [PATCH 6/8] avoid start message of adb --- buildozer/targets/android.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/buildozer/targets/android.py b/buildozer/targets/android.py index a0040ac6c..d98af06d3 100644 --- a/buildozer/targets/android.py +++ b/buildozer/targets/android.py @@ -475,6 +475,8 @@ def serials(self): get_stdout=True)[0].splitlines()[1:-1] serials = [] for serial in l: + if serial.startswith('*'): + continue serials.append(serial.split()[0]) self._serials = serials return serials From 4fe929694757fbccae04c79feee57bcc7e5ce26e Mon Sep 17 00:00:00 2001 From: Mathieu Virbel Date: Sat, 6 Jul 2013 17:29:19 +0200 Subject: [PATCH 7/8] avoid start message of adb --- buildozer/targets/android.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/buildozer/targets/android.py b/buildozer/targets/android.py index d98af06d3..f7d0877e6 100644 --- a/buildozer/targets/android.py +++ b/buildozer/targets/android.py @@ -472,10 +472,10 @@ def serials(self): if serial: return serial.split(',') l = self.buildozer.cmd('{} devices'.format(self.adb_cmd), - get_stdout=True)[0].splitlines()[1:-1] + get_stdout=True)[0].splitlines() serials = [] for serial in l: - if serial.startswith('*'): + if serial.startswith('*') or serial.startswith('List '): continue serials.append(serial.split()[0]) self._serials = serials From 8290aed23bbe7d87d5080caf73207a8e73781aff Mon Sep 17 00:00:00 2001 From: Mathieu Virbel Date: Sat, 6 Jul 2013 17:30:34 +0200 Subject: [PATCH 8/8] avoid empty lines when checking adb serials --- buildozer/targets/android.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/buildozer/targets/android.py b/buildozer/targets/android.py index f7d0877e6..7deaaa30e 100644 --- a/buildozer/targets/android.py +++ b/buildozer/targets/android.py @@ -475,6 +475,8 @@ def serials(self): get_stdout=True)[0].splitlines() serials = [] for serial in l: + if not serial: + continue if serial.startswith('*') or serial.startswith('List '): continue serials.append(serial.split()[0])