def build(args): """ the entry point for all build subcommand tasks """ builder = None fail = False try: manifest = None with open(args.manifest, 'r') as fh: manifest = fh.read() buildspec = BuildSpec(manifest, args.version, args.type) builder = giftwrap.builder.create_builder(buildspec) def _signal_handler(*args): LOG.info("Process interrrupted. Cleaning up.") builder.cleanup() sys.exit() signal.signal(signal.SIGINT, _signal_handler) builder.build() except Exception as e: LOG.exception("Oops something went wrong: %s", e) fail = True builder.cleanup() if fail: sys.exit(-1)
def _signal_handler(*args): LOG.info("Process interrrupted. Cleaning up.") builder.cleanup() sys.exit()