File tree 3 files changed +34
-8
lines changed
3 files changed +34
-8
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ python3 ./build_docs.py --quick --build-root ./build_root --www-root ./www --log
17
17
```
18
18
19
19
If you don't need to build all translations of all branches, add
20
- ` --language en --branch main ` .
20
+ ` --language en --branches main ` .
21
21
22
22
23
23
# Check current version
Original file line number Diff line number Diff line change @@ -139,16 +139,19 @@ def title(self):
139
139
return f"Python { self .name } ({ self .status } )"
140
140
141
141
@staticmethod
142
- def filter (versions , branch = None ):
142
+ def filter (versions , branches = None ):
143
143
"""Filter the given versions.
144
144
145
- If *branch * is given, only *versions* matching *branch * are returned.
145
+ If *branches * is given, only *versions* matching *branches * are returned.
146
146
147
147
Else all live versions are returned (this means no EOL and no
148
148
security-fixes branches).
149
149
"""
150
- if branch :
151
- return [v for v in versions if branch in (v .name , v .branch_or_tag )]
150
+ if branches :
151
+ return [
152
+ v for v in versions if v .name in branches or v .branch_or_tag in branches
153
+ ]
154
+
152
155
return [v for v in versions if v .status not in ("EOL" , "security-fixes" )]
153
156
154
157
@staticmethod
@@ -518,9 +521,11 @@ def parse_args():
518
521
)
519
522
parser .add_argument (
520
523
"-b" ,
521
- "--branch" ,
524
+ "--branch" , # Deprecated
525
+ "--branches" ,
526
+ nargs = "*" ,
522
527
metavar = "3.12" ,
523
- help = "Version to build (defaults to all maintained branches)." ,
528
+ help = "Versions to build (defaults to all maintained branches)." ,
524
529
)
525
530
parser .add_argument (
526
531
"-r" ,
Original file line number Diff line number Diff line change @@ -35,7 +35,28 @@ def test_filter_one() -> None:
35
35
]
36
36
37
37
# Act
38
- filtered = Version .filter (versions , "3.13" )
38
+ filtered = Version .filter (versions , [ "3.13" ] )
39
39
40
40
# Assert
41
41
assert filtered == [Version ("3.13" , status = "security" )]
42
+
43
+
44
+ def test_filter_multiple () -> None :
45
+ # Arrange
46
+ versions = [
47
+ Version ("3.14" , status = "feature" ),
48
+ Version ("3.13" , status = "bugfix" ),
49
+ Version ("3.12" , status = "bugfix" ),
50
+ Version ("3.11" , status = "security" ),
51
+ Version ("3.10" , status = "security" ),
52
+ Version ("3.9" , status = "security" ),
53
+ ]
54
+
55
+ # Act
56
+ filtered = Version .filter (versions , ["3.13" , "3.14" ])
57
+
58
+ # Assert
59
+ assert filtered == [
60
+ Version ("3.14" , status = "feature" ),
61
+ Version ("3.13" , status = "security" ),
62
+ ]
You can’t perform that action at this time.
0 commit comments