bump_version.py 655 B

12345678910111213141516171819202122
  1. import toml
  2. import pathlib
  3. import argparse
  4. root_path = pathlib.Path(__file__).parent.parent.resolve()
  5. def update_version(version):
  6. with open(root_path.joinpath("Cargo.toml")) as f:
  7. cargo = toml.load(f)
  8. old_version = cargo["package"]["version"]
  9. print(f"bump fate_crypto version from `{old_version}` to `{version}`")
  10. cargo["package"]["version"] = version
  11. with open(root_path.joinpath("Cargo.toml"), "w") as f:
  12. toml.dump(cargo, f)
  13. if __name__ == "__main__":
  14. parse = argparse.ArgumentParser("bump version")
  15. parse.add_argument("version", type=str)
  16. args = parse.parse_args()
  17. update_version(args.version)