-
-
Notifications
You must be signed in to change notification settings - Fork 955
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Removed usage of Python's deprecated distutils.version package.
The distutils package was formally deprecated in Python 3.10 and removed in Python 3.12.
- Loading branch information
Showing
4 changed files
with
26 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
from distutils.version import StrictVersion | ||
|
||
from django import template | ||
from django.utils.safestring import mark_safe | ||
from django.utils.version import get_version_tuple | ||
from pygments import highlight | ||
from pygments.formatters.html import HtmlFormatter | ||
from pygments.lexers import get_lexer_by_name | ||
|
@@ -46,7 +45,7 @@ def get_all_doc_versions(context, url=None): | |
versions.append(release.version) | ||
|
||
# Save the versions into the context | ||
versions = sorted(StrictVersion(x) for x in versions if x != "dev") | ||
versions = sorted(get_version_tuple(x) for x in versions if x != "dev") | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
trojjer
|
||
return [str(x) for x in versions] + ["dev"] | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from django.utils.regex_helper import _lazy_re_compile | ||
|
||
version_component_re = _lazy_re_compile(r"(\d+|[a-z]+|\.)") | ||
|
||
|
||
def get_loose_version_tuple(version): | ||
""" | ||
Return a tuple of version numbers (e.g. (1, 2, 3, 'b', 2)) from the version | ||
string (e.g. '1.2.3b2'). | ||
""" | ||
version_numbers = [] | ||
for item in version_component_re.split(version): | ||
if item and item != ".": | ||
try: | ||
component = int(item) | ||
except ValueError: | ||
component = item | ||
version_numbers.append(component) | ||
return tuple(version_numbers) |
Hi. Could this change in the templatetag have broken the rendering of the version picker? Not seen this before; all the
href
strings are the same and text is the representation of a tuple.