Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions tools/check-invariants.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,14 +203,17 @@ def check_the_version_agrees(version):
A copy that disagrees sends someone looking for a difference between their
device and the documentation that is not there.
"""
# Each copy, with the pattern that should carry the version.
# Each copy, with the pattern that should carry the version, and whether
# only the first match is a copy. The changelog keeps every earlier release
# below the newest one, and those headings are history, not copies: only the
# newest heading has to name the version being built.
copies = [
("README.md", r'^>\s*\*\*Status:\*\*\s*(\S+)', "the status line"),
("CHANGELOG.md", r'^##\s*\[?(\d+\.\d+\.\d+)\]?', "the newest heading"),
("README.md", r'^>\s*\*\*Status:\*\*\s*(\S+)', "the status line", False),
("CHANGELOG.md", r'^##\s*\[?(\d+\.\d+\.\d+)\]?', "the newest heading", True),
("docs/api/device-interface.md", r'"version":\s*"([^"]+)"',
"the device.describe example"),
"the device.describe example", False),
]
for relative, pattern, what in copies:
for relative, pattern, what, first_only in copies:
path = os.path.join(ROOT, relative)
with open(path, encoding="utf-8") as handle:
text = handle.read()
Expand All @@ -219,6 +222,8 @@ def check_the_version_agrees(version):
fail(0, path, "%s does not state a version, so it cannot be checked "
"against PROJECT_VER (%s)." % (what, version))
continue
if first_only:
seen = seen[:1]
for other in sorted(set(seen)):
if other != version:
fail(0, path, "%s says %s; PROJECT_VER is %s, and PROJECT_VER is "
Expand Down
Loading