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 (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 3DAF615802E for ; Mon, 24 Jun 2024 18:05:22 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id EA71E2BC0AD; Mon, 24 Jun 2024 18:05:20 +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 4BFF72BC0AD for ; Mon, 24 Jun 2024 18:05:20 +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 4B60A335CB4 for ; Mon, 24 Jun 2024 18:05:19 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id AC0BF1D36 for ; Mon, 24 Jun 2024 18:05:17 +0000 (UTC) From: "Matt Turner" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Matt Turner" Message-ID: <1717772563.345d92e0e17f0b179e5d27381cc2395786cdd856.mattst88@gentoo> Subject: [gentoo-commits] proj/gentoolkit:master commit in: bin/ X-VCS-Repository: proj/gentoolkit X-VCS-Files: bin/merge-driver-ekeyword X-VCS-Directories: bin/ X-VCS-Committer: mattst88 X-VCS-Committer-Name: Matt Turner X-VCS-Revision: 345d92e0e17f0b179e5d27381cc2395786cdd856 X-VCS-Branch: master Date: Mon, 24 Jun 2024 18:05:17 +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: 69304202-626c-474e-89cf-8c96914879d7 X-Archives-Hash: d3208e9fa30497b8d325135f228f56b9 commit: 345d92e0e17f0b179e5d27381cc2395786cdd856 Author: Matt Turner gentoo org> AuthorDate: Tue May 28 02:34:38 2024 +0000 Commit: Matt Turner gentoo org> CommitDate: Fri Jun 7 15:02:43 2024 +0000 URL: https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=345d92e0 bin/merge-driver-ekeyword: Don't sys.exit() from main() Makes unit testing easier. Signed-off-by: Matt Turner gentoo.org> bin/merge-driver-ekeyword | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bin/merge-driver-ekeyword b/bin/merge-driver-ekeyword index 70c9b3a..9a7a666 100755 --- a/bin/merge-driver-ekeyword +++ b/bin/merge-driver-ekeyword @@ -113,7 +113,7 @@ def apply_keyword_changes(ebuild: str, pathname: str, def main(argv: Sequence[str]) -> int: if len(argv) != 5: - sys.exit(-1) + return -1 O = argv[1] # %O - filename of original A = argv[2] # %A - filename of our current version @@ -124,20 +124,20 @@ def main(argv: Sequence[str]) -> int: if changes := keyword_changes(O, B): # Apply %O -> %B changes to %A result = apply_keyword_changes(A, P, changes) - sys.exit(result) + return result # Get changes to KEYWORDS= from %O to %A elif changes := keyword_changes(O, A): # Apply %O -> %A changes to %B result = apply_keyword_changes(B, P, changes) # Merged file should be left in %A shutil.move(B, A) - sys.exit(result) + return result else: try: os.execlp("git", "git", "merge-file", "-L", "HEAD", "-L", "base", "-L", "ours", A, O, B) except OSError: - sys.exit(-1) + return -1 if __name__ == "__main__": - main(sys.argv) + sys.exit(main(sys.argv))