zulip_tools: Shell out to python to get true ZULIP_VERSION.

Parsing veryion.py will not get extended version information from git.
This commit is contained in:
Alex Vandiver 2023-01-30 20:26:46 +00:00 committed by Tim Abbott
parent 41aadc8c63
commit 418e51cc5b
1 changed files with 8 additions and 5 deletions

View File

@ -108,10 +108,13 @@ def get_deploy_root() -> str:
def parse_version_from(deploy_path: str) -> str:
with open(os.path.join(deploy_path, "version.py")) as f:
result = re.search('ZULIP_VERSION = "(.*)"', f.read())
if result:
return result.groups()[0]
try:
return subprocess.check_output(
[sys.executable, "-c", "from version import ZULIP_VERSION; print(ZULIP_VERSION)"],
cwd=deploy_path,
text=True,
).strip()
except subprocess.CalledProcessError:
return "0.0.0"