Skip to content

Commit

Permalink
Sort VERSIONS alphabetically (#12133)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexWaygood authored Jun 12, 2024
1 parent 3ab03de commit 0c3514d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion stdlib/VERSIONS
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ array: 3.0-
ast: 3.0-
asynchat: 3.0-3.11
asyncio: 3.4-
asyncio.mixins: 3.10-
asyncio.exceptions: 3.8-
asyncio.format_helpers: 3.7-
asyncio.mixins: 3.10-
asyncio.runners: 3.7-
asyncio.staggered: 3.8-
asyncio.taskgroups: 3.11-
Expand Down
14 changes: 10 additions & 4 deletions tests/check_typeshed_structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def check_no_symlinks() -> None:

def check_versions_file() -> None:
"""Check that the stdlib/VERSIONS file has the correct format."""
versions = set[str]()
versions = list[str]()
with open("stdlib/VERSIONS", encoding="UTF-8") as f:
data = f.read().splitlines()
for line in data:
Expand All @@ -139,12 +139,18 @@ def check_versions_file() -> None:
raise AssertionError(f"Bad line in VERSIONS: {line}")
module = m.group(1)
assert module not in versions, f"Duplicate module {module} in VERSIONS"
versions.add(module)
versions.append(module)

deduped_versions = set(versions)
assert len(versions) == len(deduped_versions)
sorted_versions = sorted(versions)
assert versions == sorted_versions, f"{versions=}\n\n{sorted_versions=}"

modules = _find_stdlib_modules()
# Sub-modules don't need to be listed in VERSIONS.
extra = {m.split(".")[0] for m in modules} - versions
extra = {m.split(".")[0] for m in modules} - deduped_versions
assert not extra, f"Modules not in versions: {extra}"
extra = versions - modules
extra = deduped_versions - modules
assert not extra, f"Versions not in modules: {extra}"


Expand Down

0 comments on commit 0c3514d

Please sign in to comment.