diff options
| -rwxr-xr-x | cdist | 37 |
1 files changed, 21 insertions, 16 deletions
@@ -1047,27 +1047,32 @@ def main(): if args.target is None: raise Error('you must specify -t or --target') - target = target_factory(args) + target = None + try: + target = target_factory(args) - if target.platform == 'linux' and target.detail != "appimage": - if target.distro != 'arch': - output_dir = os.path.join(args.output, '%s-%s-%d' % (target.distro, target.version, target.bits)) + if target.platform == 'linux' and target.detail != "appimage": + if target.distro != 'arch': + output_dir = os.path.join(args.output, '%s-%s-%d' % (target.distro, target.version, target.bits)) + else: + output_dir = os.path.join(args.output, '%s-%d' % (target.distro, target.bits)) else: - output_dir = os.path.join(args.output, '%s-%d' % (target.distro, target.bits)) - else: - output_dir = args.output + output_dir = args.output - makedirs(output_dir) - - # Start with the options passed on the command line - options = copy.copy(argument_options(args)) - # Fill in the defaults - tree = globals.trees.get(args.project, args.checkout, target) - tree.add_defaults(options) + makedirs(output_dir) - target.package(args.project, args.checkout, output_dir, options) + # Start with the options passed on the command line + options = copy.copy(argument_options(args)) + # Fill in the defaults + tree = globals.trees.get(args.project, args.checkout, target) + tree.add_defaults(options) + target.package(args.project, args.checkout, output_dir, options) + except Error as e: + if target is not None and not args.keep: + target.cleanup() + raise - if not args.keep: + if target is not None and not args.keep: target.cleanup() elif globals.command == 'release': |
