Skip to content

Commit

Permalink
Fix wscript for non-git builds
Browse files Browse the repository at this point in the history
Issue: #16

Signed-off-by: Jiří Janoušek <[email protected]>
  • Loading branch information
jiri-janousek committed Jun 2, 2017
1 parent ab8df5f commit 84c7f34
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions wscript
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,15 @@ REVISION_SNAPSHOT = "snapshot"


def get_git_version():
import os
import subprocess
try:
output = subprocess.Popen(["git", "describe", "--tags", "--long"], stdout=subprocess.PIPE).communicate()[0]
return output.decode("utf-8").strip().split("-")
except Exception as e:
return VERSION, "0", REVISION_SNAPSHOT
if os.path.isdir(".git"):
try:
output = subprocess.check_output(["git", "describe", "--tags", "--long"])
return output.decode("utf-8").strip().split("-")
except Exception as e:
print(e)
return VERSION, "0", REVISION_SNAPSHOT

def add_version_info(ctx):
bare_version, n_commits, revision_id = get_git_version()
Expand Down

0 comments on commit 84c7f34

Please sign in to comment.