From 640840f3bfb82ae2723fa05a9d67b74a78a8fc13 Mon Sep 17 00:00:00 2001 From: Riccardo Magliocchetti Date: Mon, 11 Mar 2024 17:03:42 +0100 Subject: [PATCH] setup: take a post version from environment variable Make it possible to add a post version (per PEP-440) to the current agent version at build time. This will be useful because we want to continuously build the agent on CI and avoid version conflicts when publishing to test pypi. So when returning the agent version add anything that has been passed in ELASTIC_CI_POST_VERSION environment variable as post version. Refs #1994 --- setup.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 23ebec33e..a88cdeb5b 100644 --- a/setup.py +++ b/setup.py @@ -100,7 +100,11 @@ def get_version(): for line in version_file: if line.startswith("__version__"): version_tuple = ast.literal_eval(line.split(" = ")[1]) - return ".".join(map(str, version_tuple)) + version_str = ".".join(map(str, version_tuple)) + post_version = os.getenv("ELASTIC_CI_POST_VERSION") + if post_version: + return f"{version_str}.post{post_version}" + return version_str return "unknown"