aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2019-10-27 11:58:37 -0700
committerZac Medico <zmedico@gentoo.org>2019-10-27 12:11:40 -0700
commit6d519a589a9656a511b369c223e27e2f8d8437de (patch)
treebb2206e60d3a59a83c3db5a7b3b8d82643c84bc5
parentfetch: respect try_mirrors parameter for local mirrors (diff)
downloadportage-6d519a589a9656a511b369c223e27e2f8d8437de.tar.gz
portage-6d519a589a9656a511b369c223e27e2f8d8437de.tar.bz2
portage-6d519a589a9656a511b369c223e27e2f8d8437de.zip
emerge: fix error message for unknown options (bug 673400)
Do not use parse_known_args to parse positional arguments, since that causes unknown options to be handled like unknown positional arguments. Bug: https://bugs.gentoo.org/673400 Signed-off-by: Zac Medico <zmedico@gentoo.org>
-rw-r--r--lib/_emerge/main.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/_emerge/main.py b/lib/_emerge/main.py
index 486664c84..0d2c45a4f 100644
--- a/lib/_emerge/main.py
+++ b/lib/_emerge/main.py
@@ -299,7 +299,6 @@ def _find_bad_atoms(atoms, less_strict=False):
def parse_opts(tmpcmdline, silent=False):
myaction=None
myopts = {}
- myfiles=[]
actions = frozenset([
"clean", "check-news", "config", "depclean", "help",
@@ -810,9 +809,11 @@ def parse_opts(tmpcmdline, silent=False):
parser.add_argument(dest=myopt.lstrip("--").replace("-", "_"),
*args, **kwargs)
+ parser.add_argument('positional_args', nargs='*')
+
tmpcmdline = insert_optional_args(tmpcmdline)
- myoptions, myargs = parser.parse_known_args(args=tmpcmdline)
+ myoptions = parser.parse_args(args=tmpcmdline)
if myoptions.alert in true_y:
myoptions.alert = True
@@ -1165,9 +1166,7 @@ def parse_opts(tmpcmdline, silent=False):
if myaction is None and myoptions.deselect is True:
myaction = 'deselect'
- myfiles += myargs
-
- return myaction, myopts, myfiles
+ return myaction, myopts, myoptions.positional_args
def profile_check(trees, myaction):
if myaction in ("help", "info", "search", "sync", "version"):