File tree 3 files changed +39
-3
lines changed
3 files changed +39
-3
lines changed Original file line number Diff line number Diff line change @@ -19,3 +19,37 @@ def has_sigstore_materials(files):
19
19
@register .filter
20
20
def has_sbom (files ):
21
21
return any (f .sbom_spdx2_file for f in files )
22
+
23
+
24
+ @register .filter
25
+ def sort_windows (files ):
26
+ if not files :
27
+ return files
28
+
29
+ # Put Windows files in preferred order
30
+ files = list (files )
31
+ windows_files = []
32
+ other_files = []
33
+ for preferred in (
34
+ 'Windows installer (64-bit)' ,
35
+ 'Windows installer (32-bit)' ,
36
+ 'Windows installer (ARM64)' ,
37
+ 'Windows help file' ,
38
+ 'Windows embeddable package (64-bit)' ,
39
+ 'Windows embeddable package (32-bit)' ,
40
+ 'Windows embeddable package (ARM64)' ,
41
+ ):
42
+ for file in files :
43
+ if file .name == preferred :
44
+ windows_files .append (file )
45
+ files .remove (file )
46
+ break
47
+
48
+ # Then append any remaining Windows files
49
+ for file in files :
50
+ if file .name .startswith ('Windows' ):
51
+ windows_files .append (file )
52
+ else :
53
+ other_files .append (file )
54
+
55
+ return other_files + windows_files
Original file line number Diff line number Diff line change 1
1
{% extends "downloads/base.html" %}
2
2
{% load boxes %}
3
3
{% load sitetree %}
4
+ {% load sort_windows from download_tags %}
4
5
5
6
{% block body_attributes %}class="python download"{% endblock %}
6
7
@@ -45,7 +46,7 @@ <h2>Stable Releases</h2>
45
46
{% endif %}
46
47
{% endif %}
47
48
< ul >
48
- {% for f in r.files.all %}
49
+ {% for f in r.files.all|sort_windows %}
49
50
< li > Download < a href ="{{ f.url }} "> {{ f.name }}</ a > </ li >
50
51
{% empty %}
51
52
< li > No files for this release.</ li >
@@ -63,7 +64,7 @@ <h2>Pre-releases</h2>
63
64
< li >
64
65
< a href ="{{ r.get_absolute_url }} "> {{ r.name }} - {{ r.release_date|date }}</ a >
65
66
< ul >
66
- {% for f in r.files.all %}
67
+ {% for f in r.files.all|sort_windows %}
67
68
< li > Download < a href ="{{ f.url }} "> {{ f.name }}</ a > </ li >
68
69
{% empty %}
69
70
< li > No files for this release.</ li >
Original file line number Diff line number Diff line change 3
3
{% load sitetree %}
4
4
{% load has_sigstore_materials from download_tags %}
5
5
{% load has_sbom from download_tags %}
6
+ {% load sort_windows from download_tags %}
6
7
7
8
{% block body_attributes %}class="python downloads"{% endblock %}
8
9
@@ -60,7 +61,7 @@ <h1 class="page-title">Files</h1>
60
61
</ tr >
61
62
</ thead >
62
63
< tbody >
63
- {% for f in release_files %}
64
+ {% for f in release_files|sort_windows %}
64
65
< tr >
65
66
< td > < a href ="{{ f.url }} "> {{ f.name }}</ a > </ td >
66
67
< td > {{ f.os.name }}</ td >
You can’t perform that action at this time.
0 commit comments