Skip to content
Prev Previous commit
Next Next commit
Infra: Support mailing list info pages as well as archives
  • Loading branch information
CAM-Gerlach committed Apr 17, 2022
commit f9d14d3cbcc1150dcde010fb193a340e9e15c357
11 changes: 11 additions & 0 deletions pep_sphinx_extensions/pep_processor/transforms/pep_headers.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,23 @@ def _process_list_url(list_url: str) -> tuple[str, str]:
if len(parts) > 6 and parts[6] in {"message", "thread"}:
url_type = parts[6]

# Mailman3 list info structure is
# https://mail.python.org/mailman3/lists/<list_name>.python.org/
elif "mailman3" in parts:
list_name = (
parts[parts.index("mailman3") + 2].removesuffix(".python.org"))

# Pipermail (Mailman) archive structure is
# https://mail.python.org/pipermail/<list_name>/<month>-<year>/<id>
elif "pipermail" in parts:
list_name = parts[parts.index("pipermail") + 1]
url_type = "message" if len(parts) > 6 else "list"

# Mailman listinfo structure is
# https://mail.python.org/mailman/listinfo/<list_name>
elif "listinfo" in parts:
list_name = parts[parts.index("listinfo") + 1]

# Not a link to a mailing list, message or thread
else:
raise ValueError("Not a link to a mailing list, message or thread")
Expand Down