Skip to content

Redirect full version archive files to {major}.{minor} - #498

Merged
ewdurbin merged 2 commits into
python:mainfrom
AA-Turner:redirect-archives
Oct 11, 2024
Merged

ewdurbin merged 2 commits into
python:mainfrom
AA-Turner:redirect-archives

Conversation

@AA-Turner

@AA-Turner AA-Turner commented Sep 25, 2024 •

Copy link
Copy Markdown
Member

This aims to redirect archive URLs with full release versions to {major}.{minor}:

  • python-{release}-docs-html.tar.bz2
  • python-{release}-docs-html.zip
  • python-{release}-docs-pdf-a4.tar.bz2
  • python-{release}-docs-pdf-a4.zip
  • python-{release}-docs-pdf-letter.tar.bz2
  • python-{release}-docs-pdf-letter.zip
  • python-{release}-docs-texinfo.tar.bz2
  • python-{release}-docs-texinfo.zip
  • python-{release}-docs-text.tar.bz2
  • python-{release}-docs-text.zip
  • python-{release}-docs.epub

[Edit 26/Sep 18:00 BST -- the new format files are now built on 3.12 and 3.14 for all languages, and 3.13 for English with translations in progress currently (should take ~9 hours), so this can be merged tomorrow at the earliest]

A

Comment on lines +203 to +206
# Map archive URLs to {major}.{minor}
location ~ ^/([a-z-]*/)?(3|3.12|3.13|3.14)/archives/python-(3.12|3.13|3.14)\.\d+((a|b|rc)\d)?-docs(-(html|pdf-a4|pdf-letter|texinfo|text)\.(zip|tar\.bz2)|\.epub)$ {
return 301 https://$host/$1$2/archives/python-$3-docs$6;
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This might be clearer?:

cc @JacobCoffee -- I don't know if you have or know of any guidance on best formatting for these redirect rules.

Suggested change
# Map archive URLs to {major}.{minor}
location ~ ^/([a-z-]*/)?(3|3.12|3.13|3.14)/archives/python-(3.12|3.13|3.14)\.\d+((a|b|rc)\d)?-docs(-(html|pdf-a4|pdf-letter|texinfo|text)\.(zip|tar\.bz2)|\.epub)$ {
return 301 https://$host/$1$2/archives/python-$3-docs$6;
}
# Map archive URLs to {major}.{minor}
location ~ ^/([a-z-]*/)?(3|3.12|3.13|3.14)/archives/python-(3.12|3.13|3.14)\.\d+((a|b|rc)\d)?-docs-(html|pdf-a4|pdf-letter|texinfo|text)\.(zip|tar\.bz2)$ {
return 301 https://$host/$1$2/archives/python-$3-docs-$6.$7;
}
location ~ ^/([a-z-]*/)?(3|3.12|3.13|3.14)/archives/python-(3.12|3.13|3.14)\.\d+((a|b|rc)\d)?-docs\.epub$ {
return 301 https://$host/$1$2/archives/python-$3-docs.epub;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

given the nature of the capture groups i think there isnt much formatting that could save us! it looks pretty good to me, imo

I do think the separation for epub just adds a whole bunch of duplication and could still sit on the original single location block with the rest... but maybe @ewdurbin has more insight

@ewdurbin

Copy link
Copy Markdown
Member

For the sake of understanding... Can you give a few explicit examples of what the redirects desired are? I'm having a hard time working backward from the regex

@AA-Turner

AA-Turner commented Sep 26, 2024 •

Copy link
Copy Markdown
Member Author

The full list of expected filenames is in the opening post, redirecting a {release} version to a {major}.{minor}. This is applied over the full range of possible prefixes on d.p.o (languages & versions).

A

@merwok

merwok commented Oct 1, 2024

Copy link
Copy Markdown
Member

Are these redirects effective if the original URL is not found as a file?
Otherwise I don’t see why redirect a specific release doc to an imprecise one (I may be confused after having just read multiple tickets about docs builds)

@AA-Turner

Copy link
Copy Markdown
Member Author

The redirects are always active regardless of the filesystem -- the issue is that an archive called "3.X.Y" is not the same as the documentation at time of Python 3.X.Y's release. It is simpler to explain when we just present the archives for Python 3.X, and state that they're the current state of the branch -- to get versioned archives, use https://docs.python.org/release/.

A

@AA-Turner
AA-Turner marked this pull request as ready for review October 1, 2024 22:33
@AA-Turner
AA-Turner requested a review from ewdurbin as a code owner October 1, 2024 22:33
@ewdurbin
ewdurbin merged commit 355ffe5 into python:main Oct 11, 2024
ewdurbin added a commit that referenced this pull request Oct 11, 2024
ewdurbin added a commit that referenced this pull request Oct 11, 2024
…519)

Revert "Redirect full version archive files to ``{major}.{minor}`` (#498)"

This reverts commit 355ffe5.
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.

4 participants