public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/pkgcore/pkgcheck:master commit in: src/pkgcheck/scripts/
Date: Wed,  4 Dec 2024 19:20:24 +0000 (UTC)	[thread overview]
Message-ID: <1733339971.16790e10f1823aad3872b84db68978135c051202.mgorny@gentoo> (raw)

commit:     16790e10f1823aad3872b84db68978135c051202
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Wed Dec  4 18:45:45 2024 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Wed Dec  4 19:19:31 2024 +0000
URL:        https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=16790e10

fix argument parsing with Python 3.12.8

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 src/pkgcheck/scripts/argparse_actions.py | 8 +++++++-
 src/pkgcheck/scripts/pkgcheck_scan.py    | 8 +++++++-
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/pkgcheck/scripts/argparse_actions.py b/src/pkgcheck/scripts/argparse_actions.py
index 02053cf9..4507e10f 100644
--- a/src/pkgcheck/scripts/argparse_actions.py
+++ b/src/pkgcheck/scripts/argparse_actions.py
@@ -216,7 +216,13 @@ class ChecksetArgs(arghparse.CommaSeparatedNegations):
             args.append(f"--checks={checks}")
         keywords = ",".join(enabled_keywords | {f"-{x}" for x in disabled_keywords})
         args.append(f"--keywords={keywords}")
-        parser._parse_known_args(args, namespace)
+        # Python 3.12.8 introduced obligatory intermixed arg.  The same
+        # commit adds _parse_known_args2 function, so use that to determine
+        # if we need to pass that.
+        if hasattr(parser, "_parse_known_args2"):
+            parser._parse_known_args(args, namespace, intermixed=False)
+        else:
+            parser._parse_known_args(args, namespace)
 
 
 class ScopeArgs(arghparse.CommaSeparatedNegations):

diff --git a/src/pkgcheck/scripts/pkgcheck_scan.py b/src/pkgcheck/scripts/pkgcheck_scan.py
index 7c11f810..7e554aab 100644
--- a/src/pkgcheck/scripts/pkgcheck_scan.py
+++ b/src/pkgcheck/scripts/pkgcheck_scan.py
@@ -375,7 +375,13 @@ def _setup_scan(parser, namespace, args):
         patch("pkgcheck.scripts.argparse_actions.ChecksetArgs.__call__", lambda *a, **k: None),
         patch("pkgcheck.scripts.argparse_actions.ExitArgs.__call__", lambda *a, **k: None),
     ):
-        namespace, _ = parser._parse_known_args(args, namespace)
+        # Python 3.12.8 introduced obligatory intermixed arg.  The same
+        # commit adds _parse_known_args2 function, so use that to determine
+        # if we need to pass that.
+        if hasattr(parser, "_parse_known_args2"):
+            namespace, _ = parser._parse_known_args(args, namespace, intermixed=False)
+        else:
+            namespace, _ = parser._parse_known_args(args, namespace)
 
     # Get the current working directory for repo detection and restriction
     # creation, fallback to the root dir if it's be removed out from under us.


             reply	other threads:[~2024-12-04 19:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-04 19:20 Michał Górny [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-06-29 15:41 [gentoo-commits] proj/pkgcore/pkgcheck:master commit in: src/pkgcheck/scripts/ Arthur Zamarin
2023-05-11 18:08 Arthur Zamarin

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=1733339971.16790e10f1823aad3872b84db68978135c051202.mgorny@gentoo \
    --to=mgorny@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-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