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(