()
| 63 | |
| 64 | |
| 65 | def main(): |
| 66 | parser = ArgumentParser(prog="set_core_version") |
| 67 | parser.add_argument("newversion") |
| 68 | |
| 69 | json_list = [ |
| 70 | "deltachat-jsonrpc/typescript/package.json", |
| 71 | "deltachat-rpc-server/npm-package/package.json", |
| 72 | ] |
| 73 | toml_list = [ |
| 74 | "Cargo.toml", |
| 75 | "deltachat-ffi/Cargo.toml", |
| 76 | "deltachat-jsonrpc/Cargo.toml", |
| 77 | "deltachat-rpc-server/Cargo.toml", |
| 78 | "deltachat-repl/Cargo.toml", |
| 79 | "python/pyproject.toml", |
| 80 | "deltachat-rpc-client/pyproject.toml", |
| 81 | ] |
| 82 | try: |
| 83 | opts = parser.parse_args() |
| 84 | except SystemExit: |
| 85 | print() |
| 86 | for x in toml_list: |
| 87 | print(f"{x}: {read_toml_version(x)}") |
| 88 | for x in json_list: |
| 89 | print(f"{x}: {read_json_version(x)}") |
| 90 | print() |
| 91 | raise SystemExit("need argument: new version, example: 1.25.0") |
| 92 | |
| 93 | newversion = opts.newversion |
| 94 | if newversion.count(".") < 2: |
| 95 | raise SystemExit("need at least two dots in version") |
| 96 | |
| 97 | core_toml = read_toml_version("Cargo.toml") |
| 98 | ffi_toml = read_toml_version("deltachat-ffi/Cargo.toml") |
| 99 | assert core_toml == ffi_toml, (core_toml, ffi_toml) |
| 100 | |
| 101 | today = datetime.date.today().isoformat() |
| 102 | |
| 103 | if not newversion.endswith("-dev"): |
| 104 | found = False |
| 105 | for line in Path("CHANGELOG.md").open(): |
| 106 | if line == f"## [{newversion}] - {today}\n": |
| 107 | found = True |
| 108 | if not found: |
| 109 | raise SystemExit( |
| 110 | f"CHANGELOG.md contains no entry for version: {newversion}" |
| 111 | ) |
| 112 | |
| 113 | for toml_filename in toml_list: |
| 114 | replace_toml_version(toml_filename, newversion) |
| 115 | |
| 116 | for json_filename in json_list: |
| 117 | update_package_json(json_filename, newversion) |
| 118 | |
| 119 | with open("release-date.in", "w") as f: |
| 120 | f.write(today) |
| 121 | |
| 122 | print("running cargo check") |
no test coverage detected