Skip to content

Commit 279c284

Browse files
committed
Azure Pipeline: Add version detection from tags in setup.py
1 parent 8e9fd70 commit 279c284

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

setup.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
66
# For development and local builds use this version number, but for real builds replace it
77
# with the tag found in the environment
88
package_version = "4.0.0.dev0"
9-
for variable_name in ['BITBUCKET_TAG']:
10-
package_version = os.environ.get(variable_name, package_version)
11-
package_version = package_version.lstrip('v')
9+
if 'BITBUCKET_TAG' in os.environ:
10+
package_version = os.environ['BITBUCKET_TAG'].lstrip('v')
11+
elif 'BUILD_SOURCEBRANCH' in os.environ:
12+
full_tag_prefix = 'refs/tags/v'
13+
package_version = os.environ['BUILD_SOURCEBRANCH'][len(full_tag_prefix):]
1214

1315

1416
setup(

0 commit comments

Comments
 (0)