| 728 | |
| 729 | |
| 730 | def _update_rust_version(lines, v): |
| 731 | in_workspace_package = False |
| 732 | in_workspace_dependencies = False |
| 733 | for index, line in enumerate(lines): |
| 734 | stripped = line.strip() |
| 735 | if stripped == "[workspace.package]": |
| 736 | in_workspace_package = True |
| 737 | in_workspace_dependencies = False |
| 738 | continue |
| 739 | if stripped == "[workspace.dependencies]": |
| 740 | in_workspace_dependencies = True |
| 741 | in_workspace_package = False |
| 742 | continue |
| 743 | if stripped.startswith("[") and stripped.endswith("]"): |
| 744 | in_workspace_package = False |
| 745 | in_workspace_dependencies = False |
| 746 | if in_workspace_package and stripped.startswith("version = "): |
| 747 | lines[index] = f'version = "{v}"\n' |
| 748 | continue |
| 749 | if in_workspace_dependencies and re.match(r"\s*fory(-core|-derive)?\s*=", line): |
| 750 | lines[index] = re.sub( |
| 751 | r'(version\s*=\s*")([^"]+)(")', |
| 752 | r"\g<1>" + v + r"\3", |
| 753 | line, |
| 754 | ) |
| 755 | return lines |
| 756 | |
| 757 | |
| 758 | def _update_python_version(lines, v: str): |