From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1Q2p7c-0005Ol-HM for garchives@archives.gentoo.org; Thu, 24 Mar 2011 18:19:00 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 87D3F1C08E; Thu, 24 Mar 2011 18:18:33 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 47CDA1C08E for ; Thu, 24 Mar 2011 18:18:33 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id BF86C1B4005 for ; Thu, 24 Mar 2011 18:18:32 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 0E9628006A for ; Thu, 24 Mar 2011 18:18:32 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: <39911a4fc3859ae528dfe541ae9d9119291ae0e2.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: man/, pym/_emerge/ X-VCS-Repository: proj/portage X-VCS-Files: man/emerge.1 pym/_emerge/help.py pym/_emerge/main.py X-VCS-Directories: man/ pym/_emerge/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: 39911a4fc3859ae528dfe541ae9d9119291ae0e2 Date: Thu, 24 Mar 2011 18:18:32 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: 209d2d544142792776de16b5a9cf9d2a commit: 39911a4fc3859ae528dfe541ae9d9119291ae0e2 Author: Zac Medico gentoo org> AuthorDate: Thu Mar 24 18:15:47 2011 +0000 Commit: Zac Medico gentoo org> CommitDate: Thu Mar 24 18:15:47 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3D39911a4f emerge: support [ y | n ] for --ask This allows --ask to be enabled via EMERGE_DEFAULT_OPTS, and then temporarily disabled via the command-line. This may be useful for programs that call emerge non-interactively, as in bug #360233. --- man/emerge.1 | 2 +- pym/_emerge/help.py | 4 +++- pym/_emerge/main.py | 17 +++++++++++++++-- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/man/emerge.1 b/man/emerge.1 index 0e3eb13..2693b67 100644 --- a/man/emerge.1 +++ b/man/emerge.1 @@ -270,7 +270,7 @@ configuration, this would result in an effective When displaying USE and other flag output, combines the enabled and disabled lists into one list and sorts the whole list alphabetically. .TP -.BR "\-\-ask " (\fB\-a\fR) +.BR "\-\-ask [ y | n ] (\-a short option)" Before performing the action, display what will take place (server info = for \fB\-\-sync\fR, \fB\-\-pretend\fR output for merge, and so forth), then = ask whether to proceed with the action or abort. Using \fB\-\-ask\fR is mor= e diff --git a/pym/_emerge/help.py b/pym/_emerge/help.py index 020bc42..a120f54 100644 --- a/pym/_emerge/help.py +++ b/pym/_emerge/help.py @@ -280,7 +280,9 @@ def help(myopts, havecolor=3D1): print(" With this option, output such as USE=3D\"dar -bar= -foo\" will instead") print(" be displayed as USE=3D\"-bar dar -foo\"") print() - print(" "+green("--ask")+" ("+green("-a")+" short option)") + print(" " + green("--ask") + \ + " [ %s | %s ] (%s short option)" % \ + (turquoise("y"), turquoise("n"), green("-a"))) desc =3D "Before performing the action, display what will take place (= server info for " + \ "--sync, --pretend output for merge, and so forth), then ask " + \ "whether to proceed with the action or abort. Using --ask is more " = + \ diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py index 1a63bc7..d4b14fc 100644 --- a/pym/_emerge/main.py +++ b/pym/_emerge/main.py @@ -50,7 +50,7 @@ if sys.hexversion >=3D 0x3000000: long =3D int =20 options=3D[ -"--ask", "--alphabetical", +"--alphabetical", "--ask-enter-invalid", "--buildpkgonly", "--changed-use", @@ -77,7 +77,6 @@ options=3D[ =20 shortmapping=3D{ "1":"--oneshot", -"a":"--ask", "B":"--buildpkgonly", "c":"--depclean", "C":"--unmerge", @@ -422,6 +421,7 @@ def insert_optional_args(args): new_args =3D [] =20 default_arg_opts =3D { + '--ask' : y_or_n, '--autounmask' : y_or_n, '--buildpkg' : y_or_n, '--complete-graph' : y_or_n, @@ -456,6 +456,7 @@ def insert_optional_args(args): # Don't make things like "-kn" expand to "-k n" # since existence of -n makes it too ambiguous. short_arg_opts_n =3D { + 'a' : y_or_n, 'b' : y_or_n, 'g' : y_or_n, 'G' : y_or_n, @@ -560,6 +561,13 @@ def parse_opts(tmpcmdline, silent=3DFalse): true_y =3D ("True", "y") argument_options =3D { =20 + "--ask": { + "shortopt" : "-a", + "help" : "prompt before performing any actions", + "type" : "choice", + "choices" : true_y_or_n + }, + "--autounmask": { "help" : "automatically unmask packages", "type" : "choice", @@ -807,6 +815,11 @@ def parse_opts(tmpcmdline, silent=3DFalse): =20 myoptions, myargs =3D parser.parse_args(args=3Dtmpcmdline) =20 + if myoptions.ask in true_y: + myoptions.ask =3D True + else: + myoptions.ask =3D None + if myoptions.autounmask in true_y: myoptions.autounmask =3D True =20