From 80ff73f6fbe3c97690a3adb62bf5be8d8cbccc13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fatih=20A=C5=9F=C4=B1c=C4=B1?= Date: Thu, 17 Jun 2010 18:02:35 +0000 Subject: [PATCH] cli/build: Code style fixes Minor string changes are also included in this commit. --- pisi/cli/build.py | 157 +++++++++++++++++++++++++++++++++------------- 1 file changed, 114 insertions(+), 43 deletions(-) diff --git a/pisi/cli/build.py b/pisi/cli/build.py index 6a23aa89..4efc9439 100644 --- a/pisi/cli/build.py +++ b/pisi/cli/build.py @@ -1,6 +1,6 @@ # -*- coding:utf-8 -*- # -# Copyright (C) 2005 - 2007, TUBITAK/UEKAE +# Copyright (C) 2005-2010, TUBITAK/UEKAE # # This program is free software; you can redistribute it and/or modify it under # the terms of the GNU General Public License as published by the Free @@ -21,8 +21,8 @@ import pisi.api import pisi.cli.command as command import pisi.context as ctx -class Build(command.Command): - __doc__ = _("""Build PiSi packages + +usage = _("""Build PiSi packages Usage: build [ | ] ... @@ -32,6 +32,11 @@ fetch all necessary files and build the package for you. Alternatively, you can give the name of a source package to be downloaded from a repository containing sources. """) + + +class Build(command.Command): + + __doc__ = usage __metaclass__ = command.autocommand def __init__(self, args): @@ -40,58 +45,122 @@ to be downloaded from a repository containing sources. name = ("build", "bi") - package_formats = ('1.0', '1.1') + package_formats = ("1.0", "1.1") def options(self): - self.add_steps_options() group = optparse.OptionGroup(self.parser, _("build options")) self.add_options(group) self.parser.add_option_group(group) def add_options(self, group): - group.add_option("--ignore-build-no", action="store_true", - default=False, - help=_("Do not take build no into account.")) - group.add_option("-q", "--quiet", action="store_true", default=False, - help=_("Run pisi build operation without printing extra debug information")) - group.add_option("--ignore-dependency", action="store_true", - default=False, - help=_("Do not take dependency information into account")) - group.add_option("-O", "--output-dir", action="store", default=None, - help=_("Output directory for produced packages")) + group.add_option("--ignore-build-no", + action="store_true", + default=False, + help=_("Do not take build no into account.")) + + group.add_option("-q", "--quiet", + action="store_true", + default=False, + help=_("Run pisi build operation without printing " + "extra debug information")) + + group.add_option("--ignore-dependency", + action="store_true", + default=False, + help=_("Do not take dependency information into " + "account")) + + group.add_option("-O", "--output-dir", + action="store", + default=None, + help=_("Output directory for produced packages")) + group.add_option("--ignore-action-errors", action="store_true", default=False, help=_("Bypass errors from ActionsAPI")) - group.add_option("--ignore-safety", action="store_true", - default=False, help=_("Bypass safety switch")) - group.add_option("--ignore-check", action="store_true", - default=False, help=_("Bypass testing step")) - group.add_option("--create-static", action="store_true", - default=False, help=_("Create a static package with ar files")) - group.add_option("-F", "--package-format", action="store", default='1.1', - help=_("PiSi binary package formats: '1.0', '1.1' (default)")) - group.add_option("--use-quilt", action="store_true", default=False, - help=_("Use quilt patch management system instead of GNU patch")) - group.add_option("--ignore-sandbox", action="store_true", default=False, - help=_("Do not constrain build process inside the build folder")) + + group.add_option("--ignore-safety", + action="store_true", + default=False, + help=_("Bypass safety switch")) + + group.add_option("--ignore-check", + action="store_true", + default=False, + help=_("Bypass testing step")) + + group.add_option("--create-static", + action="store_true", + default=False, + help=_("Create a static package with ar files")) + + group.add_option("-F", "--package-format", + action="store", + default="1.1", + help=_("PiSi binary package formats: " + "'1.0', '1.1' (default)")) + + group.add_option("--use-quilt", + action="store_true", + default=False, + help=_("Use quilt patch management system " + "instead of GNU patch")) + + group.add_option("--ignore-sandbox", + action="store_true", + default=False, + help=_("Do not constrain build process inside " + "the build folder")) def add_steps_options(self): group = optparse.OptionGroup(self.parser, _("build steps")) - group.add_option("--fetch", dest="until", action="store_const", - const="fetch", help=_("Break build after fetching the source archive")) - group.add_option("--unpack", dest="until", action="store_const", - const="unpack", help=_("Break build after unpacking the source archive, checking sha1sum and applying patches")) - group.add_option("--setup", dest="until", action="store_const", - const="setup", help=_("Break build after running configure step")) - group.add_option("--build", dest="until", action="store_const", - const="build", help=_("Break build after running compile step")) - group.add_option("--check", dest="until", action="store_const", - const="check", help=_("Break build after running check step")) - group.add_option("--install", dest="until", action="store_const", - const="install", help=_("Break build after running install step")) - group.add_option("--package", dest="until", action="store_const", - const="package", help=_("create PiSi package")) + + group.add_option("--fetch", + dest="until", + action="store_const", + const="fetch", + help=_("Break build after fetching the source " + "archive")) + + group.add_option("--unpack", + dest="until", + action="store_const", + const="unpack", + help=_("Break build after unpacking the source " + "archive, checking sha1sum and applying " + "patches")) + + group.add_option("--setup", + dest="until", + action="store_const", + const="setup", + help=_("Break build after running configure step")) + + group.add_option("--build", + dest="until", + action="store_const", + const="build", + help=_("Break build after running compile step")) + + group.add_option("--check", + dest="until", + action="store_const", + const="check", + help=_("Break build after running check step")) + + group.add_option("--install", + dest="until", + action="store_const", + const="install", + help=_("Break build after running install step")) + + group.add_option("--package", + dest="until", + action="store_const", + const="package", + help=_("Create PiSi package")) + self.parser.add_option_group(group) def run(self): @@ -105,10 +174,12 @@ to be downloaded from a repository containing sources. self.init() if ctx.get_option('package_format') not in Build.package_formats: - raise pisi.Error(_('package_format must be one of %s ') % pisi.util.strlist(Build.package_formats)) + raise pisi.Error(_("Package format must be one of %s ") + % pisi.util.strlist(Build.package_formats)) if ctx.get_option('output_dir'): - ctx.ui.info(_('Output directory: %s') % ctx.config.options.output_dir) + ctx.ui.info(_('Output directory: %s') + % ctx.config.options.output_dir) else: ctx.ui.info(_('Outputting packages in the working directory.')) ctx.config.options.output_dir = '.'