From 279c284fd7dded4563e3a0ae467d1f584d96ff91 Mon Sep 17 00:00:00 2001 From: Adam Douglass Date: Fri, 3 Apr 2020 11:48:20 -0400 Subject: [PATCH] Azure Pipeline: Add version detection from tags in setup.py --- setup.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 4bbaeccc..f180e6f5 100644 --- a/setup.py +++ b/setup.py @@ -6,9 +6,11 @@ # For development and local builds use this version number, but for real builds replace it # with the tag found in the environment package_version = "4.0.0.dev0" -for variable_name in ['BITBUCKET_TAG']: - package_version = os.environ.get(variable_name, package_version) - package_version = package_version.lstrip('v') +if 'BITBUCKET_TAG' in os.environ: + package_version = os.environ['BITBUCKET_TAG'].lstrip('v') +elif 'BUILD_SOURCEBRANCH' in os.environ: + full_tag_prefix = 'refs/tags/v' + package_version = os.environ['BUILD_SOURCEBRANCH'][len(full_tag_prefix):] setup(