From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 8BF511581D8 for ; Wed, 4 Dec 2024 19:20:29 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 71F1FE0858; Wed, 4 Dec 2024 19:20:28 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id D79EFE087F for ; Wed, 4 Dec 2024 19:20:27 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id CEB96340C7F for ; Wed, 4 Dec 2024 19:20:26 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id C3B3A12D4 for ; Wed, 4 Dec 2024 19:20:24 +0000 (UTC) From: "Michał Górny" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Michał Górny" Message-ID: <1733339971.16790e10f1823aad3872b84db68978135c051202.mgorny@gentoo> Subject: [gentoo-commits] proj/pkgcore/pkgcheck:master commit in: src/pkgcheck/scripts/ X-VCS-Repository: proj/pkgcore/pkgcheck X-VCS-Files: src/pkgcheck/scripts/argparse_actions.py src/pkgcheck/scripts/pkgcheck_scan.py X-VCS-Directories: src/pkgcheck/scripts/ X-VCS-Committer: mgorny X-VCS-Committer-Name: Michał Górny X-VCS-Revision: 16790e10f1823aad3872b84db68978135c051202 X-VCS-Branch: master Date: Wed, 4 Dec 2024 19:20:24 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 5c9304be-d21f-48a1-8c6f-d69411ceec83 X-Archives-Hash: 24b356852febbe25f48df62cf3ce9ddc commit: 16790e10f1823aad3872b84db68978135c051202 Author: Michał Górny gentoo org> AuthorDate: Wed Dec 4 18:45:45 2024 +0000 Commit: Michał Górny gentoo 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 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.