forked from jrl-umi3218/jrl-cmakemodules
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pixi.py
executable file
·30 lines (25 loc) · 802 Bytes
/
pixi.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#! /usr/bin/env python3
import sys
try:
import tomlkit
except ImportError as e:
print(
"tomlkit not found. Please make sure to install the package.\n"
"If it is already installed, make sure that it is included in the search path."
)
raise e
def update_pixi_version(version):
with open("pixi.toml") as f:
doc = tomlkit.load(f)
if "project" not in doc or "version" not in doc["project"]:
print("pixi.toml doesn't contain project / version")
return
doc["project"]["version"] = version
with open("pixi.toml", "w") as f:
tomlkit.dump(doc, f)
if __name__ == "__main__":
if len(sys.argv) == 2:
update_pixi_version(sys.argv[1])
else:
print("you must provide the version as argument.")
exit(1)