(raw: str)
| 36 | |
| 37 | |
| 38 | def msi_version(raw: str) -> str: |
| 39 | # AdvancedInstaller's ProductVersion only accepts numeric X[.Y[.Z[.B]]]. |
| 40 | # Strip Python-style suffixes ("0.7-dev0" -> "0.7"; "1.0.0-rc1" -> "1.0.0") |
| 41 | # and pad to three components so the resulting MSI filename is consistent. |
| 42 | parts = [re.split(r"[^\d]", p, maxsplit=1)[0] for p in raw.split(".")] |
| 43 | if not all(p.isdigit() for p in parts if p): |
| 44 | sys.exit(f"Cannot derive numeric MSI version from {raw!r}") |
| 45 | while len(parts) < 3: |
| 46 | parts.append("0") |
| 47 | return ".".join(parts[:4]) |
| 48 | |
| 49 | |
| 50 | def find_advinst() -> Path: |
no outgoing calls
no test coverage detected