add ability for not checking the configuration for some commands.

This commit is contained in:
Mathieu Virbel 2013-07-23 12:31:42 +02:00
parent 9711f15fe8
commit 420989928a
3 changed files with 17 additions and 4 deletions

View file

@ -47,7 +47,6 @@ USE_COLOR = 'NO_COLOR' not in environ
LOG_LEVELS_C = (RED, BLUE, BLACK)
LOG_LEVELS_T = 'EID'
class BuildozerException(Exception):
'''
Exception raised for general situations buildozer cannot process.
@ -105,7 +104,6 @@ class Buildozer(object):
self.target = m.get_target(self)
self.check_build_layout()
self.check_configuration_tokens()
self.target.check_configuration_tokens()
def prepare_for_build(self):
'''Prepare the build.

View file

@ -1,5 +1,9 @@
from sys import exit
def no_config(f):
f.__no_config = True
return f
class Target(object):
def __init__(self, buildozer):
@ -63,12 +67,22 @@ class Target(object):
if last_command:
result.append(last_command)
config_check = False
for item in result:
command, args = item[0], item[1:]
if not hasattr(self, 'cmd_{0}'.format(command)):
self.buildozer.error('Unknow command {0}'.format(command))
exit(1)
getattr(self, 'cmd_{0}'.format(command))(args)
func = getattr(self, 'cmd_{0}'.format(command))
need_config_check = not hasattr(func, '__no_config')
if need_config_check and not config_check:
config_check = True
self.check_configuration_tokens()
func(args)
def cmd_clean(self, *args):
self.buildozer.clean_platform()

View file

@ -4,7 +4,7 @@ iOS target, based on kivy-ios project. (not working yet.)
import plistlib
from buildozer import BuildozerCommandException
from buildozer.target import Target
from buildozer.target import Target, no_config
from os.path import join, basename
from getpass import getpass
@ -305,6 +305,7 @@ class TargetIos(Target):
super(TargetIos, self).check_configuration_tokens(errors)
@no_config
def cmd_list_identities(self, *args):
'''List the available identities to use for signing.
'''