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 7F05115838C for ; Fri, 26 Jan 2024 19:17:36 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id B1E5CE29FE; Fri, 26 Jan 2024 19:17:35 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (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 959FAE29FE for ; Fri, 26 Jan 2024 19:17:35 +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 C2A95343374 for ; Fri, 26 Jan 2024 19:17:34 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id B3C561133 for ; Fri, 26 Jan 2024 19:17:32 +0000 (UTC) From: "Arthur Zamarin" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Arthur Zamarin" Message-ID: <1706296647.07519289999445518f9883eb2329af71d91b0aa5.arthurzam@gentoo> Subject: [gentoo-commits] proj/pkgcore/snakeoil:master commit in: src/snakeoil/dist/ X-VCS-Repository: proj/pkgcore/snakeoil X-VCS-Files: src/snakeoil/dist/sphinxext.py X-VCS-Directories: src/snakeoil/dist/ X-VCS-Committer: arthurzam X-VCS-Committer-Name: Arthur Zamarin X-VCS-Revision: 07519289999445518f9883eb2329af71d91b0aa5 X-VCS-Branch: master Date: Fri, 26 Jan 2024 19:17:32 +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: 2f4c12d1-2ae4-43db-ace9-768884788e57 X-Archives-Hash: 409077f776d347a670acdd0132360bfd commit: 07519289999445518f9883eb2329af71d91b0aa5 Author: Brian Harring gmail com> AuthorDate: Fri Jan 26 04:59:26 2024 +0000 Commit: Arthur Zamarin gentoo org> CommitDate: Fri Jan 26 19:17:27 2024 +0000 URL: https://gitweb.gentoo.org/proj/pkgcore/snakeoil.git/commit/?id=07519289 fix(sphinx_ext): email is optional. It's not obvious, but both name and email are optional for authors. NFC what one does with an author field lacking both, but that's for the PEP authors to resolve. We have authors in the pkgcore project that don't have email listed, which now breaks html generation. Thus this change. The only hanky point here is that if it's just email, we output that w/out the usual `<{email}>` brackets per standards. Signed-off-by: Brian Harring gmail.com> Signed-off-by: Arthur Zamarin gentoo.org> src/snakeoil/dist/sphinxext.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/snakeoil/dist/sphinxext.py b/src/snakeoil/dist/sphinxext.py index 7d04c49d..36d63e23 100644 --- a/src/snakeoil/dist/sphinxext.py +++ b/src/snakeoil/dist/sphinxext.py @@ -30,9 +30,19 @@ def prepare_scripts_man(repo_dir: Path, man_pages: list[tuple]): with open(repo_dir / 'pyproject.toml', 'rb') as file: pyproj = tomllib.load(file) - authors_list = [ - f'{author["name"]} <{author["email"]}>' for author in pyproj['project']['authors'] - ] + authors_list: list[str] = [] + for author in pyproj['project']['authors']: + name, email = author.get('name'), author.get('email') + if name: + if email: + authors_list.append(f'{name} <{email}>') + else: + authors_list.append(name) + elif email: + authors_list.append(email) + else: + # no name or contact info, so ignore it. + continue for i, man_page in enumerate(man_pages): if man_page[3] is None: