diff --git a/buildozer/__init__.py b/buildozer/__init__.py index 5698bde..3f97acf 100644 --- a/buildozer/__init__.py +++ b/buildozer/__init__.py @@ -133,6 +133,9 @@ class Buildozer(object): self.info('Check application requirements') self.check_application_requirements() + self.info('Check garden requirements') + self.check_garden_requirements() + self.info('Compile platform') self.target.compile_platform() @@ -386,6 +389,27 @@ class Buildozer(object): env=self.env_venv, cwd=self.buildozer_dir) + def check_garden_requirements(self): + '''Ensure required garden packages are available to be included. + ''' + garden_requirements = self.config.getlist('app', + 'garden_requirements', '') + + if self.state.get('cache.gardenlibs', '') == garden_requirements: + self.debug('Garden requirements already installed, pass') + return + + for requirement in garden_requirements: + self._install_garden_package(requirement) + + self.state['cache.gardenlibs'] = garden_requirements + + def _install_garden_package(self, package): + self._ensure_virtualenv() + self.debug('Install garden package {} in virtualenv'.format(package)) + self.cmd('garden install {}'.format(package), + env=self.env_venv) + def _ensure_virtualenv(self): if hasattr(self, 'venv'): return diff --git a/buildozer/default.spec b/buildozer/default.spec index 96dc2ad..4b7eda0 100644 --- a/buildozer/default.spec +++ b/buildozer/default.spec @@ -34,6 +34,9 @@ version.filename = %(source.dir)s/main.py # (list) Application requirements requirements = kivy +# (list) Garden requirements +#garden_requirements + # (str) Presplash of the application #presplash.filename = %(source.dir)s/data/presplash.png