Created
August 4, 2015 06:38
-
-
Save ecarreras/9f44fedd277bc7d26877 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_version(): | |
import os | |
import subprocess | |
try: | |
try: | |
version = subprocess.check_output([ | |
'git', 'describe', '--tags' | |
]).strip() | |
except subprocess.CalledProcessError: | |
version = __import__('pkg_resources') \ | |
.get_distribution(__name__).version | |
except Exception, e: | |
version = 'unknown' | |
return version |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment