public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Arthur Zamarin" <arthurzam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/pkgcore/snakeoil:master commit in: src/snakeoil/dist/
Date: Fri, 26 Jan 2024 19:17:32 +0000 (UTC)	[thread overview]
Message-ID: <1706296647.07519289999445518f9883eb2329af71d91b0aa5.arthurzam@gentoo> (raw)

commit:     07519289999445518f9883eb2329af71d91b0aa5
Author:     Brian Harring <ferringb <AT> gmail <DOT> com>
AuthorDate: Fri Jan 26 04:59:26 2024 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> 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 <ferringb <AT> gmail.com>
Signed-off-by: Arthur Zamarin <arthurzam <AT> 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:


             reply	other threads:[~2024-01-26 19:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-26 19:17 Arthur Zamarin [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-03-24 11:08 [gentoo-commits] proj/pkgcore/snakeoil:master commit in: src/snakeoil/dist/ Arthur Zamarin
2022-12-09 13:30 Arthur Zamarin
2022-12-09 13:30 Arthur Zamarin
2022-12-09 11:51 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=1706296647.07519289999445518f9883eb2329af71d91b0aa5.arthurzam@gentoo \
    --to=arthurzam@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