allow custom source folders in buildozer.spec

This commit is contained in:
Ryan Pessa 2015-03-07 12:21:45 -06:00
parent 3dda7f2d8e
commit c99b1190fe
3 changed files with 27 additions and 1 deletions

View file

@ -35,6 +35,10 @@ version.filename = %(source.dir)s/main.py
# comma seperated e.g. requirements = sqlite3,kivy
requirements = kivy
# (str) Custom source folders for requirements
# Sets custom source for any requirements with recipes
# requirements.source.kivy = ../../kivy
# (list) Garden requirements
#garden_requirements =

View file

@ -464,6 +464,17 @@ class TargetAndroid(Target):
if not exists(dist_dir):
need_compile = 1
source_dirs = {'P4A_{}_DIR'.format(name[20:]):
realpath(expanduser(value))
for name, value in self.buildozer.config.items('app')
if name.startswith('requirements.source.')}
if source_dirs:
need_compile = 1
self.buildozer.environ.update(source_dirs)
self.buildozer.info('Using custom source dirs:\n {}'.format(
'\n '.join(['{} = {}'.format(k, v)
for k, v in source_dirs.items()])))
if not need_compile:
self.buildozer.info('Distribution already compiled, pass.')
return

View file

@ -9,7 +9,7 @@ if sys.platform != 'darwin':
import plistlib
from buildozer import BuildozerCommandException
from buildozer.target import Target, no_config
from os.path import join, basename
from os.path import join, basename, expanduser, realpath
from getpass import getpass
PHP_TEMPLATE = '''
@ -128,6 +128,17 @@ class TargetIos(Target):
if last_requirements != ios_requirements:
need_compile = 1
source_dirs = {'{}_DIR'.format(name[20:]):
realpath(expanduser(value))
for name, value in self.buildozer.config.items('app')
if name.startswith('requirements.source.')}
if source_dirs:
need_compile = 1
self.buildozer.environ.update(source_dirs)
self.buildozer.info('Using custom source dirs:\n {}'.format(
'\n '.join(['{} = {}'.format(k, v)
for k, v in source_dirs.items()])))
if not need_compile:
self.buildozer.info('Distribution already compiled, pass.')
return