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 <gentoo-commits+bounces-340077-garchives=archives.gentoo.org@lists.gentoo.org>)
	id 1QFTto-0007zM-DS
	for garchives@archives.gentoo.org; Thu, 28 Apr 2011 16:17:04 +0000
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id B302A1C072;
	Thu, 28 Apr 2011 16:16:57 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183])
	by pigeon.gentoo.org (Postfix) with ESMTP id 6FD581C072
	for <gentoo-commits@lists.gentoo.org>; Thu, 28 Apr 2011 16:16:57 +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 ED8841B4032
	for <gentoo-commits@lists.gentoo.org>; Thu, 28 Apr 2011 16:16:56 +0000 (UTC)
Received: from localhost.localdomain (localhost [127.0.0.1])
	by pelican.gentoo.org (Postfix) with ESMTP id 5277180505
	for <gentoo-commits@lists.gentoo.org>; Thu, 28 Apr 2011 16:16:56 +0000 (UTC)
From: "Zac Medico" <zmedico@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" <zmedico@gentoo.org>
Message-ID: <ebb887ee7606ec2dd7b266dd3538e68b31ac3a38.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/depgraph.py 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: ebb887ee7606ec2dd7b266dd3538e68b31ac3a38
Date: Thu, 28 Apr 2011 16:16:56 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: quoted-printable
X-Archives-Salt: 
X-Archives-Hash: c7d03ab3a7ac2b7e51196a60121e4d1c

commit:     ebb887ee7606ec2dd7b266dd3538e68b31ac3a38
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu Apr 28 16:10:02 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu Apr 28 16:10:02 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a=
=3Dcommit;h=3Debb887ee

emerge: add --misspell-suggestions=3Dn option

This will fix bug #363137.

---
 man/emerge.1            |    8 +++++++-
 pym/_emerge/depgraph.py |    4 +++-
 pym/_emerge/help.py     |    9 +++++++++
 pym/_emerge/main.py     |    6 ++++++
 4 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/man/emerge.1 b/man/emerge.1
index 67f3e47..56823a8 100644
--- a/man/emerge.1
+++ b/man/emerge.1
@@ -1,4 +1,4 @@
-.TH "EMERGE" "1" "Mar 2011" "Portage VERSION" "Portage"
+.TH "EMERGE" "1" "Apr 2011" "Portage VERSION" "Portage"
 .SH "NAME"
 emerge \- Command\-line interface to the Portage system
 .SH "SYNOPSIS"
@@ -438,6 +438,12 @@ order to avoid excess load. See \fBmake\fR(1) for in=
formation about
 analogous options that should be configured via \fBMAKEOPTS\fR in
 \fBmake.conf\fR(5).
 .TP
+.BR "\-\-misspell\-suggestions < y | n >"
+Enable or disable misspell suggestions. By default, emerge will show
+a list of packages with similar names when a package doesn't exist.
+The \fIEMERGE_DEFAULT_OPTS\fR variable may be used to disable this
+option by default.
+.TP
 .BR "\-\-newuse " (\fB\-N\fR)
 Tells emerge to include installed packages where USE
 flags have changed since compilation. This option

diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index 84e7d24..7db5ae3 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -2757,7 +2757,9 @@ class depgraph(object):
 			mask_docs =3D True
 		else:
 			writemsg_stdout("\nemerge: there are no ebuilds to satisfy "+green(xi=
nfo)+".\n", noiselevel=3D-1)
-			if isinstance(myparent, AtomArg):
+			if isinstance(myparent, AtomArg) and \
+				self._frozen_config.myopts.get(
+				"--misspell-suggestions", "y") !=3D "n":
 				cp =3D myparent.atom.cp.lower()
 				cat, pkg =3D portage.catsplit(cp)
 				if cat =3D=3D "null":

diff --git a/pym/_emerge/help.py b/pym/_emerge/help.py
index a928a85..fb1e129 100644
--- a/pym/_emerge/help.py
+++ b/pym/_emerge/help.py
@@ -512,6 +512,15 @@ def help(myopts, havecolor=3D1):
 		for line in wrap(desc, desc_width):
 			print(desc_indent + line)
 		print()
+		print("       " + green("--misspell-suggestions") + " < %s | %s >" % \
+			(turquoise("y"), turquoise("n")))
+		desc =3D "Enable or disable misspell suggestions. By default, " + \
+			"emerge will show a list of packages with similar names " + \
+			"when a package doesn't exist. The EMERGE_DEFAULT_OPTS " + \
+			"variable may be used to disable this option by default"
+		for line in wrap(desc, desc_width):
+			print(desc_indent + line)
+		print()
 		print("       "+green("--newuse")+" ("+green("-N")+" short option)")
 		desc =3D "Tells emerge to include installed packages where USE " + \
 			"flags have changed since compilation. This option " + \

diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py
index 6ae267f..82b1444 100644
--- a/pym/_emerge/main.py
+++ b/pym/_emerge/main.py
@@ -686,6 +686,12 @@ def parse_opts(tmpcmdline, silent=3DFalse):
 			"action" : "store"
 		},
=20
+		"--misspell-suggestions": {
+			"help"    : "enable package name misspell suggestions",
+			"type"    : "choice",
+			"choices" : ("y", "n")
+		},
+
 		"--with-bdeps": {
 			"help":"include unnecessary build time dependencies",
 			"type":"choice",