Skip to content

Minor tweaks to doc-redirects#81

Merged
ckreibich merged 3 commits intomasterfrom
topic/christian/doc-redirects-tweaks
Mar 13, 2026
Merged

Minor tweaks to doc-redirects#81
ckreibich merged 3 commits intomasterfrom
topic/christian/doc-redirects-tweaks

Conversation

@ckreibich
Copy link
Member

These make it easier to use doc-redirects scan and its output.

@ckreibich ckreibich force-pushed the topic/christian/doc-redirects-tweaks branch from 1253be8 to 542a39c Compare March 12, 2026 20:43
@ckreibich ckreibich requested a review from evantypanski March 12, 2026 20:49
Copy link
Member

@evantypanski evantypanski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool!

def make_absolute_path(path: str) -> str:
"""Ensures that a given path starts with os.sep."""
if not path.startswith(os.sep):
return os.sep + path
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

os.sep isn't correct for URLs. Probably want a literal / for those that want to use this tool on Windows.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, true. If people use this on Windows they are likely going to have more problems though, since the scan command (from which this function gets invoked) operates in the file system world. I tried to stick to pathlib but don't know what these paths will end up looking like on Windows.

A good way to handle this is to ensure that the Redirect class URL-ifies its inputs properly. I'll table that for now, though, but let me put a note in the code.

RTD uses absolute paths (on top of the language/version prefix) for its path
redirects, so it's easier to work with our inferred ones if they follow that
pattern.
… dir

This simplifies running the scan command without needing to think about
--zeekroot.
@ckreibich ckreibich force-pushed the topic/christian/doc-redirects-tweaks branch from 542a39c to f3190cc Compare March 13, 2026 18:25
@ckreibich ckreibich merged commit 6bebf48 into master Mar 13, 2026
3 of 17 checks passed
@ckreibich ckreibich deleted the topic/christian/doc-redirects-tweaks branch March 13, 2026 18:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants