1 |
commit: 6d519a589a9656a511b369c223e27e2f8d8437de |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Oct 27 18:58:37 2019 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Oct 27 19:11:40 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=6d519a58 |
7 |
|
8 |
emerge: fix error message for unknown options (bug 673400) |
9 |
|
10 |
Do not use parse_known_args to parse positional arguments, since that |
11 |
causes unknown options to be handled like unknown positional arguments. |
12 |
|
13 |
Bug: https://bugs.gentoo.org/673400 |
14 |
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org> |
15 |
|
16 |
lib/_emerge/main.py | 9 ++++----- |
17 |
1 file changed, 4 insertions(+), 5 deletions(-) |
18 |
|
19 |
diff --git a/lib/_emerge/main.py b/lib/_emerge/main.py |
20 |
index 486664c84..0d2c45a4f 100644 |
21 |
--- a/lib/_emerge/main.py |
22 |
+++ b/lib/_emerge/main.py |
23 |
@@ -299,7 +299,6 @@ def _find_bad_atoms(atoms, less_strict=False): |
24 |
def parse_opts(tmpcmdline, silent=False): |
25 |
myaction=None |
26 |
myopts = {} |
27 |
- myfiles=[] |
28 |
|
29 |
actions = frozenset([ |
30 |
"clean", "check-news", "config", "depclean", "help", |
31 |
@@ -810,9 +809,11 @@ def parse_opts(tmpcmdline, silent=False): |
32 |
parser.add_argument(dest=myopt.lstrip("--").replace("-", "_"), |
33 |
*args, **kwargs) |
34 |
|
35 |
+ parser.add_argument('positional_args', nargs='*') |
36 |
+ |
37 |
tmpcmdline = insert_optional_args(tmpcmdline) |
38 |
|
39 |
- myoptions, myargs = parser.parse_known_args(args=tmpcmdline) |
40 |
+ myoptions = parser.parse_args(args=tmpcmdline) |
41 |
|
42 |
if myoptions.alert in true_y: |
43 |
myoptions.alert = True |
44 |
@@ -1165,9 +1166,7 @@ def parse_opts(tmpcmdline, silent=False): |
45 |
if myaction is None and myoptions.deselect is True: |
46 |
myaction = 'deselect' |
47 |
|
48 |
- myfiles += myargs |
49 |
- |
50 |
- return myaction, myopts, myfiles |
51 |
+ return myaction, myopts, myoptions.positional_args |
52 |
|
53 |
def profile_check(trees, myaction): |
54 |
if myaction in ("help", "info", "search", "sync", "version"): |