Skip to content

Commit

Permalink
fix(pypi): get ci environment
Browse files Browse the repository at this point in the history
  • Loading branch information
NewFuture committed May 1, 2019
1 parent 5e8f7bf commit 36c4636
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,12 @@
long_description = f.read()

# Get version from environment vars
# `TRAVIS_TAG` from Travis
# `BUILD_SOURCEBRANCHNAME` from azure
version = environ['TRAVIS_TAG'] or environ['BUILD_SOURCEBRANCHNAME']
if hasattr(environ,'TRAVIS_TAG'):
version = environ['TRAVIS_TAG'] # `TRAVIS_TAG` from Travis
elif hasattr(environ,'BUILD_SOURCEBRANCHNAME'):
version = environ['BUILD_SOURCEBRANCHNAME'] # `BUILD_SOURCEBRANCHNAME` from azure pipelines
else:
raise Exception("This setup script should be run in CI/CD environment (TravisCI or AzurePipelines)")
version = version.strip('v').strip('V')

# Arguments marked as "Required" below must be included for upload to PyPI.
Expand Down

0 comments on commit 36c4636

Please sign in to comment.