Skip to content

Commit

Permalink
Replace subprocess.check_output with python2.6 friendly version for c…
Browse files Browse the repository at this point in the history
…entos 6
  • Loading branch information
mcraig-ibme committed Jul 17, 2020
1 parent c3c4385 commit 8a7fd8f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ def get_filetext(rootdir, filename):
def git_version():
""" Get the full and python standardized version from Git tags (if possible) """
try:
# Full version includes the Git commit hash
full_version = subprocess.check_output('git describe --dirty', shell=True).decode("utf-8").strip(" \n")
# Full version includes the Git commit hash. Must be Python 2.6 compatible!
full_version = subprocess.Popen(['git', 'describe', '--dirty'], stdout=subprocess.PIPE).communicate()[0].decode("utf-8").strip(" \n")

# Python standardized version in form major.minor.patch.post<build>
version_regex = re.compile(r"v?(\d+\.\d+\.\d+(-\d+)?).*")
Expand All @@ -38,7 +38,7 @@ def git_version():
def git_timestamp():
""" Get the last commit timestamp from Git (if possible)"""
try:
return subprocess.check_output('git log -1 --format=%cd', shell=True).decode("utf-8").strip(" \n")
return subprocess.Popen(['git', 'log', '-1', '--format=%cd'], stdout=subprocess.PIPE).communicate()[0].decode("utf-8").strip(" \n")
except:
# Any failure, return None. We may not be in a Git repo at all
return None
Expand Down

0 comments on commit 8a7fd8f

Please sign in to comment.