From: Zac Medico <zmedico@gentoo.org>
To: gentoo-portage-dev@lists.gentoo.org
Cc: Zac Medico <zmedico@gentoo.org>
Subject: [gentoo-portage-dev] [PATCH] emerge: use parse_intermixed_args when available (bug 784566)
Date: Tue, 20 Apr 2021 21:34:05 -0700 [thread overview]
Message-ID: <20210421043405.231322-1-zmedico@gentoo.org> (raw)
The included unit test case previously failed with this error:
emerge: error: unrecognized arguments: dev-libs/A
Bug: https://bugs.gentoo.org/784566
Signed-off-by: Zac Medico <zmedico@gentoo.org>
---
lib/_emerge/main.py | 2 +-
lib/portage/tests/emerge/test_simple.py | 10 +++++++++-
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/lib/_emerge/main.py b/lib/_emerge/main.py
index 31e690584..191be6479 100644
--- a/lib/_emerge/main.py
+++ b/lib/_emerge/main.py
@@ -834,7 +834,7 @@ def parse_opts(tmpcmdline, silent=False):
tmpcmdline = insert_optional_args(tmpcmdline)
- myoptions = parser.parse_args(args=tmpcmdline)
+ myoptions = getattr(parser, "parse_intermixed_args", parser.parse_args)(args=tmpcmdline)
if myoptions.alert in true_y:
myoptions.alert = True
diff --git a/lib/portage/tests/emerge/test_simple.py b/lib/portage/tests/emerge/test_simple.py
index 6e282337f..5b110407f 100644
--- a/lib/portage/tests/emerge/test_simple.py
+++ b/lib/portage/tests/emerge/test_simple.py
@@ -1,6 +1,7 @@
# Copyright 2011-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
+import argparse
import subprocess
import portage
@@ -289,7 +290,14 @@ call_has_and_best_version() {
port=binhost_server.server_port,
path=binhost_remote_path)
- test_commands = (
+ test_commands = ()
+
+ if hasattr(argparse.ArgumentParser, "parse_intermixed_args"):
+ test_commands += (
+ emerge_cmd + ("--oneshot", "dev-libs/A", "-v", "dev-libs/A"),
+ )
+
+ test_commands += (
emerge_cmd + ("--usepkgonly", "--root", cross_root, "--quickpkg-direct=y", "--quickpkg-direct-root", "/", "dev-libs/A"),
emerge_cmd + ("--usepkgonly", "--quickpkg-direct=y", "--quickpkg-direct-root", cross_root, "dev-libs/A"),
env_update_cmd,
--
2.26.2
reply other threads:[~2021-04-21 4:34 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210421043405.231322-1-zmedico@gentoo.org \
--to=zmedico@gentoo.org \
--cc=gentoo-portage-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox