def interrupt_build_and_wait(f):
""" decorator that ensures that a build of the categorised installed apps
is interrupted before a new build commences.
expects self._build_in_progress and self._halt_build as properties
"""
def wrapper(*args, **kwargs):
self = args[0]
if self._build_in_progress:
LOG.debug('Waiting for build to exit...')
self._halt_build = True
GObject.timeout_add(200, lambda: wrapper(*args, **kwargs))
return False
# ready now
self._halt_build = False
f(*args, **kwargs)
return False
return wrapper
评论列表
文章目录