def run(self, ctx): argv = ctx.command_argv p = ctx.options_context.parser o, a = p.parse_args(argv) if o.help: p.print_help() return pkg = ctx.pkg format = o.format archive_root = "%s-%s" % (pkg.name, pkg.version) if not o.output_file: archive_name = archive_basename(pkg) + _FORMATS[format]["ext"] else: output = op.basename(o.output_file) if output != o.output_file: raise bento.errors.BentoError("Invalid output file: should not contain any directory") archive_name = output s = StringIO() write_pkg_info(ctx.pkg, s) n = ctx.build_node.make_node("PKG_INFO") n.parent.mkdir() n.write(s.getvalue()) ctx.register_source_node(n, "PKG_INFO") # XXX: find a better way to pass archive name from other commands (used # by distcheck ATM) self.archive_root, self.archive_node = create_archive(archive_name, archive_root, ctx._node_pkg, ctx.top_node, ctx.run_node, o.format, o.output_dir)
def run(self, ctx): argv = ctx.get_command_arguments() p = ctx.options_context.parser o, a = p.parse_args(argv) if o.help: p.print_help() return bento_script = ctx.top_node.find_node(BENTO_SCRIPT) if not o.output: pkg_info = "PKG-INFO" else: pkg_info = o.output pkg = PackageDescription.from_file(bento_script.abspath()) fid = open(pkg_info, "w") try: write_pkg_info(pkg, fid) finally: fid.close()
def run(self, ctx): argv = ctx.command_argv p = ctx.options_context.parser o, a = p.parse_args(argv) if o.help: p.print_help() return bento_script = ctx.top_node.find_node(BENTO_SCRIPT) if not o.output: pkg_info = "PKG-INFO" else: pkg_info = o.output pkg = PackageDescription.from_file(bento_script.abspath()) fid = open(pkg_info, "w") try: write_pkg_info(pkg, fid) finally: fid.close()
def run(self, ctx): o, a = self.parser.parse_args(ctx.cmd_opts) if o.help: self.parser.print_help() return if len(a) < 1: raise UsageException("%s: error: %s subcommand require an argument" \ % (SCRIPT_NAME, "parse")) else: filename = a[0] if not o.output: pkg_info = "PKG-INFO" else: pkg_info = o.output pkg = PackageDescription.from_file(filename) fid = open(pkg_info, "w") try: write_pkg_info(pkg, fid) finally: fid.close()