Verify tab_acknowledgements.md matches the ACKNOWLEDGEMENTS.md body after the H1 and the "Influences" / "How to Get Listed" sections are stripped. The sync_tab_acknowledgements_from_acknowledgements.py script regenerates tab_acknowledgements.md from ACKNOWLEDGEMENTS.md. This check f
()
| 147 | |
| 148 | |
| 149 | def check_tab_acknowledgements_in_sync() -> int: |
| 150 | """Verify tab_acknowledgements.md matches the ACKNOWLEDGEMENTS.md body |
| 151 | after the H1 and the "Influences" / "How to Get Listed" sections are |
| 152 | stripped. |
| 153 | |
| 154 | The sync_tab_acknowledgements_from_acknowledgements.py script regenerates |
| 155 | tab_acknowledgements.md from ACKNOWLEDGEMENTS.md. This check fails the |
| 156 | build if the two have drifted. |
| 157 | """ |
| 158 | |
| 159 | if not repo_path(SYNC_TAB_ACKNOWLEDGEMENTS_SCRIPT).is_file(): |
| 160 | print( |
| 161 | f"No sync script found at {display_path(SYNC_TAB_ACKNOWLEDGEMENTS_SCRIPT)}. " |
| 162 | "Skipping tab_acknowledgements.md / ACKNOWLEDGEMENTS.md sync check." |
| 163 | ) |
| 164 | return 0 |
| 165 | |
| 166 | if ( |
| 167 | not repo_path(TAB_ACKNOWLEDGEMENTS_MD).is_file() |
| 168 | or not repo_path(ACKNOWLEDGEMENTS_MD).is_file() |
| 169 | ): |
| 170 | print( |
| 171 | "FAILED: Expected ACKNOWLEDGEMENTS.md and tab_acknowledgements.md " |
| 172 | "to both exist for the sync check." |
| 173 | ) |
| 174 | return 1 |
| 175 | |
| 176 | original_tab_contents = read_bytes(TAB_ACKNOWLEDGEMENTS_MD) |
| 177 | exit_code = 0 |
| 178 | |
| 179 | try: |
| 180 | subprocess.run( |
| 181 | [sys.executable, str(repo_path(SYNC_TAB_ACKNOWLEDGEMENTS_SCRIPT))], |
| 182 | cwd=repo_root(), |
| 183 | check=True, |
| 184 | ) |
| 185 | |
| 186 | regenerated_tab = read_bytes(TAB_ACKNOWLEDGEMENTS_MD) |
| 187 | expected_lines = raw_text_lines(original_tab_contents) |
| 188 | actual_lines = raw_text_lines(regenerated_tab) |
| 189 | |
| 190 | if expected_lines != actual_lines: |
| 191 | print_diff( |
| 192 | "FAILED: tab_acknowledgements.md is out of sync with " |
| 193 | "ACKNOWLEDGEMENTS.md. Run " |
| 194 | "scripts/sync_tab_acknowledgements_from_acknowledgements.py to regenerate it.", |
| 195 | expected_lines=expected_lines, |
| 196 | actual_lines=actual_lines, |
| 197 | expected_name="committed tab_acknowledgements.md", |
| 198 | actual_name="regenerated tab_acknowledgements.md", |
| 199 | ) |
| 200 | exit_code = 1 |
| 201 | except subprocess.CalledProcessError as exc: |
| 202 | print( |
| 203 | f"FAILED: sync_tab_acknowledgements_from_acknowledgements.py exited with status {exc.returncode}." |
| 204 | ) |
| 205 | exit_code = 1 |
| 206 | except Exception as exc: |
no test coverage detected