Allow specifying garden packages in buildozer.spec

This commit is contained in:
Ian Foote 2013-09-17 21:35:48 +01:00
parent 549fbff80b
commit 097073827f
2 changed files with 27 additions and 0 deletions

View file

@ -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

View file

@ -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