(file: Path, bump_type: t.Optional[str] = None)
| 93 | |
| 94 | |
| 95 | def _bump_setup_py(file: Path, bump_type: t.Optional[str] = None): |
| 96 | # Load config |
| 97 | content = file.read_text(encoding="utf-8") |
| 98 | _, _, arguments = content.partition("setup(") |
| 99 | |
| 100 | package, version = None, None |
| 101 | for line in arguments.split("\n"): |
| 102 | if "=" not in line: |
| 103 | continue |
| 104 | |
| 105 | arg, val = line.strip().split("=", maxsplit=1) |
| 106 | val = val.replace('"', "").replace(",", "").strip() |
| 107 | if arg == "name": |
| 108 | package = val |
| 109 | |
| 110 | if arg == "version": |
| 111 | version = val |
| 112 | |
| 113 | # Skip the main setup.py |
| 114 | if package == "composio": |
| 115 | return |
| 116 | |
| 117 | if package is None or version is None: |
| 118 | raise ValueError(f"Package or version not found in {file}") |
| 119 | |
| 120 | # Bump version |
| 121 | next_version = _get_version_update( |
| 122 | package=package, |
| 123 | version=version, |
| 124 | bump_type_selector=bump_type, |
| 125 | ) |
| 126 | if next_version is None: |
| 127 | click.echo(f"* Skipping {package}") |
| 128 | return |
| 129 | |
| 130 | click.echo(f"* Bumping {package} {version} -> {next_version}") |
| 131 | content = content.replace(f'version="{version}"', f'version="{next_version}"') |
| 132 | file.write_text(content, encoding="utf-8") |
| 133 | |
| 134 | |
| 135 | def _bump_pyproject_toml(file: Path, bump_type: t.Optional[str] = None): |
no test coverage detected
searching dependent graphs…