(version: str)
| 155 | |
| 156 | |
| 157 | def update_version(version: str) -> None: |
| 158 | # 1. Replace "In Progress" in HISTORY.md |
| 159 | replace_in_file( |
| 160 | "HISTORY.md", |
| 161 | dict( |
| 162 | pattern=r"# In Progress\n", |
| 163 | repl=f"# TileDB v{version} Release Notes\n", |
| 164 | ), |
| 165 | ) |
| 166 | |
| 167 | # 2. replace major, minor, patch in tiledb/sm/c_api/tiledb_version.h |
| 168 | major, minor, patch = version.split(".") |
| 169 | logging.info(f"Updating 'tiledb_version.h' to {major}.{minor}.{patch}") |
| 170 | replace_in_file( |
| 171 | "tiledb/sm/c_api/tiledb_version.h", |
| 172 | dict( |
| 173 | pattern=r"#define TILEDB_VERSION_MAJOR \d+\n", |
| 174 | repl=f"#define TILEDB_VERSION_MAJOR {major}\n", |
| 175 | ), |
| 176 | dict( |
| 177 | pattern=r"#define TILEDB_VERSION_MINOR \d+\n", |
| 178 | repl=f"#define TILEDB_VERSION_MINOR {minor}\n", |
| 179 | ), |
| 180 | dict( |
| 181 | pattern=r"#define TILEDB_VERSION_PATCH \d+\n", |
| 182 | repl=f"#define TILEDB_VERSION_PATCH {patch}\n", |
| 183 | ), |
| 184 | ) |
| 185 | |
| 186 | # 3. replace version and release in doc/source/conf.py |
| 187 | logging.info(f"Updating 'sphinx conf.py' to {major}.{minor}.{patch}") |
| 188 | replace_in_file( |
| 189 | sphinx_conf_file, |
| 190 | dict( |
| 191 | pattern=r"version = '\d+\.\d+'\n", |
| 192 | repl=f"version = '{major}.{minor}'\n", |
| 193 | ), |
| 194 | dict( |
| 195 | pattern=r"release = '\d+\.\d+\.\d+'\n", |
| 196 | repl=f"release = '{major}.{minor}.{patch}'\n", |
| 197 | ), |
| 198 | ) |
| 199 | |
| 200 | |
| 201 | def replace_in_file(path: str, *replacement_kwargs: Dict[str, Any]) -> None: |
no test coverage detected