1 |
commit: ebb887ee7606ec2dd7b266dd3538e68b31ac3a38 |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Apr 28 16:10:02 2011 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Apr 28 16:10:02 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=ebb887ee |
7 |
|
8 |
emerge: add --misspell-suggestions=n option |
9 |
|
10 |
This will fix bug #363137. |
11 |
|
12 |
--- |
13 |
man/emerge.1 | 8 +++++++- |
14 |
pym/_emerge/depgraph.py | 4 +++- |
15 |
pym/_emerge/help.py | 9 +++++++++ |
16 |
pym/_emerge/main.py | 6 ++++++ |
17 |
4 files changed, 25 insertions(+), 2 deletions(-) |
18 |
|
19 |
diff --git a/man/emerge.1 b/man/emerge.1 |
20 |
index 67f3e47..56823a8 100644 |
21 |
--- a/man/emerge.1 |
22 |
+++ b/man/emerge.1 |
23 |
@@ -1,4 +1,4 @@ |
24 |
-.TH "EMERGE" "1" "Mar 2011" "Portage VERSION" "Portage" |
25 |
+.TH "EMERGE" "1" "Apr 2011" "Portage VERSION" "Portage" |
26 |
.SH "NAME" |
27 |
emerge \- Command\-line interface to the Portage system |
28 |
.SH "SYNOPSIS" |
29 |
@@ -438,6 +438,12 @@ order to avoid excess load. See \fBmake\fR(1) for information about |
30 |
analogous options that should be configured via \fBMAKEOPTS\fR in |
31 |
\fBmake.conf\fR(5). |
32 |
.TP |
33 |
+.BR "\-\-misspell\-suggestions < y | n >" |
34 |
+Enable or disable misspell suggestions. By default, emerge will show |
35 |
+a list of packages with similar names when a package doesn't exist. |
36 |
+The \fIEMERGE_DEFAULT_OPTS\fR variable may be used to disable this |
37 |
+option by default. |
38 |
+.TP |
39 |
.BR "\-\-newuse " (\fB\-N\fR) |
40 |
Tells emerge to include installed packages where USE |
41 |
flags have changed since compilation. This option |
42 |
|
43 |
diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py |
44 |
index 84e7d24..7db5ae3 100644 |
45 |
--- a/pym/_emerge/depgraph.py |
46 |
+++ b/pym/_emerge/depgraph.py |
47 |
@@ -2757,7 +2757,9 @@ class depgraph(object): |
48 |
mask_docs = True |
49 |
else: |
50 |
writemsg_stdout("\nemerge: there are no ebuilds to satisfy "+green(xinfo)+".\n", noiselevel=-1) |
51 |
- if isinstance(myparent, AtomArg): |
52 |
+ if isinstance(myparent, AtomArg) and \ |
53 |
+ self._frozen_config.myopts.get( |
54 |
+ "--misspell-suggestions", "y") != "n": |
55 |
cp = myparent.atom.cp.lower() |
56 |
cat, pkg = portage.catsplit(cp) |
57 |
if cat == "null": |
58 |
|
59 |
diff --git a/pym/_emerge/help.py b/pym/_emerge/help.py |
60 |
index a928a85..fb1e129 100644 |
61 |
--- a/pym/_emerge/help.py |
62 |
+++ b/pym/_emerge/help.py |
63 |
@@ -512,6 +512,15 @@ def help(myopts, havecolor=1): |
64 |
for line in wrap(desc, desc_width): |
65 |
print(desc_indent + line) |
66 |
print() |
67 |
+ print(" " + green("--misspell-suggestions") + " < %s | %s >" % \ |
68 |
+ (turquoise("y"), turquoise("n"))) |
69 |
+ desc = "Enable or disable misspell suggestions. By default, " + \ |
70 |
+ "emerge will show a list of packages with similar names " + \ |
71 |
+ "when a package doesn't exist. The EMERGE_DEFAULT_OPTS " + \ |
72 |
+ "variable may be used to disable this option by default" |
73 |
+ for line in wrap(desc, desc_width): |
74 |
+ print(desc_indent + line) |
75 |
+ print() |
76 |
print(" "+green("--newuse")+" ("+green("-N")+" short option)") |
77 |
desc = "Tells emerge to include installed packages where USE " + \ |
78 |
"flags have changed since compilation. This option " + \ |
79 |
|
80 |
diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py |
81 |
index 6ae267f..82b1444 100644 |
82 |
--- a/pym/_emerge/main.py |
83 |
+++ b/pym/_emerge/main.py |
84 |
@@ -686,6 +686,12 @@ def parse_opts(tmpcmdline, silent=False): |
85 |
"action" : "store" |
86 |
}, |
87 |
|
88 |
+ "--misspell-suggestions": { |
89 |
+ "help" : "enable package name misspell suggestions", |
90 |
+ "type" : "choice", |
91 |
+ "choices" : ("y", "n") |
92 |
+ }, |
93 |
+ |
94 |
"--with-bdeps": { |
95 |
"help":"include unnecessary build time dependencies", |
96 |
"type":"choice", |