forked from p15670423/monkey
common: Pick up version details from deployment.json in common/version.py
This commit is contained in:
parent
2b9b755177
commit
2af3878e81
|
@ -1,11 +1,19 @@
|
||||||
# To get the version from shell, run `python ./version.py` (see `python ./version.py -h` for
|
# To get the version from shell, run `python ./version.py` (see `python ./version.py -h` for
|
||||||
# details).
|
# details).
|
||||||
import argparse
|
import argparse
|
||||||
|
import json
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
MAJOR = "1"
|
deployment_info_file_path = Path(__file__).parent.parent.joinpath(
|
||||||
MINOR = "11"
|
"monkey_island", "cc", "deployment.json"
|
||||||
PATCH = "0"
|
)
|
||||||
|
with open(deployment_info_file_path, "r") as deployment_info_file:
|
||||||
|
deployment_info = json.load(deployment_info_file)
|
||||||
|
MAJOR = deployment_info["version"]["major"]
|
||||||
|
MINOR = deployment_info["version"]["minor"]
|
||||||
|
PATCH = deployment_info["version"]["patch"]
|
||||||
|
|
||||||
|
|
||||||
build_file_path = Path(__file__).parent.joinpath("BUILD")
|
build_file_path = Path(__file__).parent.joinpath("BUILD")
|
||||||
with open(build_file_path, "r") as build_file:
|
with open(build_file_path, "r") as build_file:
|
||||||
BUILD = build_file.read()
|
BUILD = build_file.read()
|
||||||
|
|
Loading…
Reference in New Issue