From 92008de8d1648f76f265f60776855904af2ec58d Mon Sep 17 00:00:00 2001 From: David Madl Date: Tue, 2 Aug 2016 19:25:56 +0100 Subject: [PATCH 1/2] Add p4a.local_recipes to buildozer.spec to specify a local recipe directory for the build --- buildozer/targets/android_new.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/buildozer/targets/android_new.py b/buildozer/targets/android_new.py index c0a27f2..720e46c 100644 --- a/buildozer/targets/android_new.py +++ b/buildozer/targets/android_new.py @@ -39,6 +39,7 @@ class TargetAndroidNew(TargetAndroid): 'app', 'requirements', '') onlyname = lambda x: x.split('==')[0] dist_name = self.buildozer.config.get('app', 'package.name') + local_recipes = self.buildozer.config.get('app', 'p4a.local_recipes') requirements = ','.join(app_requirements) options = [] @@ -55,6 +56,10 @@ class TargetAndroidNew(TargetAndroid): if self.buildozer.config.getbooldefault('app', 'android.copy_libs', True): options.append("--copy-libs") + # support for recipes in a local directory within the project + if local_recipes: + options.append('--local-recipes') + options.append(local_recipes) available_modules = self._p4a( "create --dist_name={} --bootstrap={} --requirements={} --arch armeabi-v7a {}".format( dist_name, self._p4a_bootstrap, requirements, " ".join(options)), @@ -70,6 +75,7 @@ class TargetAndroidNew(TargetAndroid): def execute_build_package(self, build_cmd): # wrapper from previous old_toolchain to new toolchain dist_name = self.buildozer.config.get('app', 'package.name') + local_recipes = self.buildozer.config.get('app', 'p4a.local_recipes') cmd = [self.p4a_apk_cmd, "--dist_name", dist_name] for args in build_cmd: option, values = args[0], args[1:] @@ -96,6 +102,11 @@ class TargetAndroidNew(TargetAndroid): if self.buildozer.config.getbooldefault('app', 'android.copy_libs', True): cmd.append("--copy-libs") + # support for recipes in a local directory within the project + if local_recipes: + cmd.append('--local-recipes') + cmd.append(local_recipes) + cmd = " ".join(cmd) self._p4a(cmd) From e0de33491286b5f0b6d8caf8ee7c21d1b1683f93 Mon Sep 17 00:00:00 2001 From: David Madl Date: Sat, 13 Aug 2016 16:37:55 +0100 Subject: [PATCH 2/2] realpath and expanduser the p4a.local_recipes config value so a relative path can be used --- buildozer/targets/android_new.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/buildozer/targets/android_new.py b/buildozer/targets/android_new.py index 720e46c..77b8226 100644 --- a/buildozer/targets/android_new.py +++ b/buildozer/targets/android_new.py @@ -39,7 +39,7 @@ class TargetAndroidNew(TargetAndroid): 'app', 'requirements', '') onlyname = lambda x: x.split('==')[0] dist_name = self.buildozer.config.get('app', 'package.name') - local_recipes = self.buildozer.config.get('app', 'p4a.local_recipes') + local_recipes = self.get_local_recipes_dir() requirements = ','.join(app_requirements) options = [] @@ -72,10 +72,14 @@ class TargetAndroidNew(TargetAndroid): def get_dist_dir(self, dist_name): return join(self._build_dir, 'dists', dist_name) + def get_local_recipes_dir(self): + local_recipes = self.buildozer.config.get('app', 'p4a.local_recipes') + return realpath(expanduser(local_recipes)) if local_recipes else None + def execute_build_package(self, build_cmd): # wrapper from previous old_toolchain to new toolchain dist_name = self.buildozer.config.get('app', 'package.name') - local_recipes = self.buildozer.config.get('app', 'p4a.local_recipes') + local_recipes = self.get_local_recipes_dir() cmd = [self.p4a_apk_cmd, "--dist_name", dist_name] for args in build_cmd: option, values = args[0], args[1:]