Skip to content

Commit

Permalink
updateBuildTag: convert proc.stdout.read() to str.
Browse files Browse the repository at this point in the history
In python2.7, proc.stdout.read() returns a str type. On python3.x, it
returns bytes.

Without this change, building with python3.x (python3.5 tested) as
/usr/bin/python will result in the following error:

Traceback (most recent call last):
  File "./updateBuildTag.py", line 76, in <module>
    updateBuildTag(sys.argv)
  File "./updateBuildTag.py", line 62, in updateBuildTag
    cmd_build_tag = cmd_build_tag+" "+commit_id
TypeError: Can't convert 'bytes' object to str implicitly

Signed-off-by: Marty E. Plummer <hanetzer@startmail.com>
  • Loading branch information
hanetzer committed May 10, 2019
1 parent eca6ff1 commit 7506346
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/build/updateBuildTag.py
Expand Up @@ -51,14 +51,14 @@ def updateBuildTag(argv):

tag_exist_cmd = "git log | grep \"Release notes for sbe\"| awk '{ print $NF }'"
proc = subprocess.Popen(tag_exist_cmd, shell=True, stdout=subprocess.PIPE)
build_tag = proc.stdout.read()
build_tag = str(proc.stdout.read())
if ( build_tag ):
cmd_build_tag = cmd_build_tag+" "+build_tag

else:
commit_id_cmd = "git log |grep commit -m1 |awk '{ print $NF }' |awk '{print substr ($0, 0, 17)}'"
proc = subprocess.Popen(commit_id_cmd, shell=True, stdout=subprocess.PIPE)
commit_id = proc.stdout.read()
commit_id = str(proc.stdout.read())
cmd_build_tag = cmd_build_tag+" "+commit_id

proc = subprocess.Popen(cmd_build_tag, shell=True, stdout=subprocess.PIPE)
Expand All @@ -68,7 +68,7 @@ def updateBuildTag(argv):
proc = subprocess.Popen(cmd_build_time, shell=True, stdout=subprocess.PIPE)
cmd_temp = "id -un"
proc = subprocess.Popen(cmd_temp, shell=True, stdout=subprocess.PIPE)
cmd_build_user = cmd_build_user+" "+proc.stdout.read()
cmd_build_user = cmd_build_user+" "+str(proc.stdout.read())
proc = subprocess.Popen(cmd_build_user, shell=True, stdout=subprocess.PIPE)
cmd_build_host = cmd_build_host+" "+socket.gethostname()
proc = subprocess.Popen(cmd_build_host, shell=True, stdout=subprocess.PIPE)
Expand Down

0 comments on commit 7506346

Please sign in to comment.