avoid multiple execution of build() and prepare_for_build() method

This commit is contained in:
Mathieu Virbel 2012-12-19 18:27:28 +01:00
parent 5a9cfb1b2e
commit 1ba027e85d

View file

@ -349,6 +349,9 @@ class Buildozer(object):
self.target.run_commands(args) self.target.run_commands(args)
def prepare_for_build(self): def prepare_for_build(self):
if hasattr(self.target, '_build_prepared'):
return
self.log('Preparing build') self.log('Preparing build')
self.log('Ensure build layout') self.log('Ensure build layout')
@ -366,13 +369,22 @@ class Buildozer(object):
self.log('Compile platform') self.log('Compile platform')
self.target.compile_platform() self.target.compile_platform()
# flag to prevent multiple build
self.target._build_prepared = True
def build(self): def build(self):
if hasattr(self.target, '_build_done'):
return
self.log('Build the application') self.log('Build the application')
self.build_application() self.build_application()
self.log('Package the application') self.log('Package the application')
self.target.build_package() self.target.build_package()
# flag to prevent multiple build
self.target._build_done = True
def cmd_init(self, *args): def cmd_init(self, *args):
'''Create a initial buildozer.spec in the current directory '''Create a initial buildozer.spec in the current directory
''' '''