Skip to content

Commit 3c408da

Browse files
committed
cleanup
1 parent af8fc1f commit 3c408da

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

.evergreen/scripts/generate_config.py

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,6 @@
2323
CPYTHONS = ["3.9", "3.10", "3.11", "3.12", "3.13"]
2424
PYPYS = ["pypy3.9", "pypy3.10"]
2525
ALL_PYTHONS = CPYTHONS + PYPYS
26-
ALL_WIN_PYTHONS = CPYTHONS.copy()
27-
ALL_WIN_PYTHONS = ALL_WIN_PYTHONS + [f"32-bit {p}" for p in ALL_WIN_PYTHONS]
28-
AUTHS = ["noauth", "auth"]
29-
SSLS = ["nossl", "ssl"]
30-
AUTH_SSLS = list(product(AUTHS, SSLS))
31-
TOPOLOGIES = ["standalone", "replica_set", "sharded_cluster"]
32-
C_EXTS = ["without c extensions", "with c extensions"]
3326
BATCHTIME_WEEK = 10080
3427
HOSTS = dict()
3528

@@ -55,6 +48,7 @@ def create_variant(
5548
host: str | None = None,
5649
**kwargs: Any,
5750
) -> BuildVariant:
51+
"""Create a build variant for the given inputs."""
5852
task_refs = [EvgTaskRef(name=n) for n in task_names]
5953
kwargs.setdefault("expansions", dict())
6054
expansions = kwargs.pop("expansions")
@@ -75,6 +69,7 @@ def create_variant(
7569

7670

7771
def get_python_binary(python: str, host: str) -> str:
72+
"""Get the appropriate python binary given a python version and host"""
7873
if host == "win64":
7974
is_32 = python.startswith("32-bit")
8075
if is_32:
@@ -94,7 +89,8 @@ def get_python_binary(python: str, host: str) -> str:
9489
raise ValueError(f"no match found for python {python} on {host}")
9590

9691

97-
def get_display(base: str, host: str, version: str, python: str) -> str:
92+
def get_display_name(base: str, host: str, version: str, python: str) -> str:
93+
"""Get the display name of a variant."""
9894
if version not in ["rapid", "latest"]:
9995
version = f"v{version}"
10096
if not python.startswith("pypy"):
@@ -103,12 +99,18 @@ def get_display(base: str, host: str, version: str, python: str) -> str:
10399

104100

105101
def get_pairs(versions: list[str], pythons: list[str]) -> str:
102+
"""Get pairs of versions and pythons, ensuring that we hit all of each.
103+
The shorter list will repeat until the full length of the longer list.
104+
"""
106105
values = []
106+
i = 0
107107
for version, python in zip_longest(versions, pythons):
108108
if version is None:
109-
values.append((versions[0], python))
109+
values.append((versions[i % len(versions)], python))
110+
i += 1
110111
elif python is None:
111-
values.append((version, pythons[0]))
112+
values.append((version, pythons[i % len(pythons)]))
113+
i += 1
112114
else:
113115
values.append((version, python))
114116
return values
@@ -137,7 +139,7 @@ def create_ocsp_variants() -> list[BuildVariant]:
137139
host = "rhel8"
138140
variant = create_variant(
139141
[".ocsp"],
140-
get_display(base_display, host, version, python),
142+
get_display_name(base_display, host, version, python),
141143
python=python,
142144
batchtime=batchtime,
143145
host=host,
@@ -146,18 +148,17 @@ def create_ocsp_variants() -> list[BuildVariant]:
146148
variants.append(variant)
147149

148150
# OCSP tests on Windows and MacOS.
151+
# MongoDB servers on these hosts do not staple OCSP responses and only support RSA.
149152
for host, version in product(["win64", "macos"], ["4.4", "8.0"]):
150-
# MongoDB servers do not staple OCSP responses and only support RSA.
151-
task_names = [".ocsp-rsa !.ocsp-staple"]
152153
expansions = base_expansions.copy()
153154
expansions["VERSION"] = version
154155
if version == "4.4":
155156
python = CPYTHONS[0]
156157
else:
157158
python = CPYTHONS[-1]
158159
variant = create_variant(
159-
task_names,
160-
get_display(base_display, host, version, python),
160+
[".ocsp-rsa !.ocsp-staple"],
161+
get_display_name(base_display, host, version, python),
161162
python=python,
162163
host=host,
163164
expansions=expansions,

0 commit comments

Comments
 (0)