add initial .spec tokens checks
This commit is contained in:
parent
f297fd5ac2
commit
d7e7d748b1
1 changed files with 36 additions and 0 deletions
|
@ -117,6 +117,10 @@ class Buildozer(object):
|
||||||
# flag to prevent multiple build
|
# flag to prevent multiple build
|
||||||
self.target._build_done = True
|
self.target._build_done = True
|
||||||
|
|
||||||
|
#
|
||||||
|
# Log functions
|
||||||
|
#
|
||||||
|
|
||||||
def log(self, level, msg):
|
def log(self, level, msg):
|
||||||
if level > self.log_level:
|
if level > self.log_level:
|
||||||
return
|
return
|
||||||
|
@ -135,6 +139,10 @@ class Buildozer(object):
|
||||||
def error(self, msg):
|
def error(self, msg):
|
||||||
self.log(0, msg)
|
self.log(0, msg)
|
||||||
|
|
||||||
|
#
|
||||||
|
# Internal check methods
|
||||||
|
#
|
||||||
|
|
||||||
def checkbin(self, msg, fn):
|
def checkbin(self, msg, fn):
|
||||||
self.debug('Search for {0}'.format(msg))
|
self.debug('Search for {0}'.format(msg))
|
||||||
if exists(fn):
|
if exists(fn):
|
||||||
|
@ -218,6 +226,34 @@ class Buildozer(object):
|
||||||
'''Ensure the spec file is 'correct'.
|
'''Ensure the spec file is 'correct'.
|
||||||
'''
|
'''
|
||||||
self.info('Check configuration tokens')
|
self.info('Check configuration tokens')
|
||||||
|
get = self.config.getdefault
|
||||||
|
errors = []
|
||||||
|
adderror = errors.append
|
||||||
|
if not get('app', 'title', ''):
|
||||||
|
adderror('[app] "title" is missing')
|
||||||
|
if not get('app', 'package.name', ''):
|
||||||
|
adderror('[app] "package.name" is missing')
|
||||||
|
if not get('app', 'source.dir', ''):
|
||||||
|
adderror('[app] "source.dir" is missing')
|
||||||
|
|
||||||
|
version = get('app', 'version', '')
|
||||||
|
version_regex = get('app', 'version.regex', '')
|
||||||
|
if not version and not version_regex:
|
||||||
|
adderror('[app] One of "version" or "version.regex" must be set')
|
||||||
|
if version and version_regex:
|
||||||
|
adderror('[app] Conflict between "version" and "version.regex"'
|
||||||
|
', only one can be used.')
|
||||||
|
if version_regex and not get('app', 'version.filename', ''):
|
||||||
|
adderror('[app] "version.filename" is missing'
|
||||||
|
', required by "version.regex"')
|
||||||
|
|
||||||
|
if errors:
|
||||||
|
self.error('{0} errors found in the buildozer.spec'.format(
|
||||||
|
len(errors)))
|
||||||
|
for error in errors:
|
||||||
|
print error
|
||||||
|
exit(1)
|
||||||
|
|
||||||
|
|
||||||
def check_build_layout(self):
|
def check_build_layout(self):
|
||||||
'''Ensure the build (local and global) directory layout and files are
|
'''Ensure the build (local and global) directory layout and files are
|
||||||
|
|
Loading…
Reference in a new issue