File tree Expand file tree Collapse file tree 3 files changed +34
-8
lines changed Expand file tree Collapse file tree 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
1717```
1818
1919If you don't need to build all translations of all branches, add
20- ` --language en --branch main ` .
20+ ` --language en --branches main ` .
2121
2222
2323# Check current version
Original file line number Diff line number Diff line change @@ -139,16 +139,19 @@ def title(self):
139139 return f"Python { self .name } ({ self .status } )"
140140
141141 @staticmethod
142- def filter (versions , branch = None ):
142+ def filter (versions , branches = None ):
143143 """Filter the given versions.
144144
145- If *branch * is given, only *versions* matching *branch * are returned.
145+ If *branches * is given, only *versions* matching *branches * are returned.
146146
147147 Else all live versions are returned (this means no EOL and no
148148 security-fixes branches).
149149 """
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+
152155 return [v for v in versions if v .status not in ("EOL" , "security-fixes" )]
153156
154157 @staticmethod
@@ -518,9 +521,11 @@ def parse_args():
518521 )
519522 parser .add_argument (
520523 "-b" ,
521- "--branch" ,
524+ "--branch" , # Deprecated
525+ "--branches" ,
526+ nargs = "*" ,
522527 metavar = "3.12" ,
523- help = "Version to build (defaults to all maintained branches)." ,
528+ help = "Versions to build (defaults to all maintained branches)." ,
524529 )
525530 parser .add_argument (
526531 "-r" ,
Original file line number Diff line number Diff line change @@ -35,7 +35,28 @@ def test_filter_one() -> None:
3535 ]
3636
3737 # Act
38- filtered = Version .filter (versions , "3.13" )
38+ filtered = Version .filter (versions , [ "3.13" ] )
3939
4040 # Assert
4141 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