Skip to content

Commit

Permalink
Get correct version by git describe
Browse files Browse the repository at this point in the history
When the pdc module is imported into another git repo, the version
reported is the version from that repo, not from PDC.
  • Loading branch information
lubomir committed Aug 6, 2015
1 parent 25fd317 commit cd704b1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pdc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@

VERSION = "0.5.0-0.1.beta"

old_cwd = os.getcwd()
os.chdir(os.path.dirname(os.path.dirname(__file__)))
# NOTE(xchu): use `git describe` when under git repository.
if os.system('git rev-parse 2> /dev/null > /dev/null') == 0:
pipe = subprocess.Popen("git describe",
pipe = subprocess.Popen("git describe --tags",
shell=True,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
Expand All @@ -31,6 +33,8 @@
else:
VERSION = version_list[0] + '-' + version_list[1].replace('-', '.')

os.chdir(old_cwd)


def get_version():
"""
Expand Down

0 comments on commit cd704b1

Please sign in to comment.