(v: str)
| 1018 | |
| 1019 | |
| 1020 | def _normalize_rust_version(v: str) -> str: |
| 1021 | v = v.strip() |
| 1022 | v = re.sub(r"-(alpha|beta|rc)(\d+)$", r"-\1.\2", v) |
| 1023 | if re.search(r"(?i)-(alpha|beta)\.0$", v): |
| 1024 | return v |
| 1025 | if re.search(r"(?i)-(alpha|beta|rc)\.\d+$", v): |
| 1026 | return v |
| 1027 | if re.search(r"(?i)-pre$", v): |
| 1028 | return v |
| 1029 | dev_match = re.search(r"(?i)(?:-dev|\\.dev)(\\d+)$", v) |
| 1030 | if dev_match: |
| 1031 | base = re.sub(r"(?i)(?:-dev|\\.dev)\\d+$", "", v) |
| 1032 | return f"{base}-alpha.{dev_match.group(1)}" |
| 1033 | if re.search(r"(?i)(-snapshot|\\.dev|-dev)$", v): |
| 1034 | base = re.sub(r"(?i)(-snapshot|\\.dev|-dev)$", "", v) |
| 1035 | return f"{base}-alpha.0" |
| 1036 | return v |
| 1037 | |
| 1038 | |
| 1039 | def _parse_args(): |
no test coverage detected