Fix py3 compatibility for webrtc_version_updater
Bug: webrtc:13607 Change-Id: I5890dc86286b0a6ece793655bcda15315d415b39 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/252060 Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Commit-Queue: Christoffer Jansson <jansson@google.com> Cr-Commit-Position: refs/heads/main@{#36046}
This commit is contained in:

committed by
WebRTC LUCI CQ

parent
9bbfe9e5e0
commit
f1e4a66e94
@ -30,7 +30,7 @@ def FindSrcDirPath():
|
||||
UPDATE_BRANCH_NAME = 'webrtc_version_update'
|
||||
CHECKOUT_SRC_DIR = FindSrcDirPath()
|
||||
|
||||
NOTIFY_EMAIL = 'mbonadei@webrtc.org'
|
||||
NOTIFY_EMAIL = 'webrtc-trooper@webrtc.org'
|
||||
|
||||
|
||||
def _RemovePreviousUpdateBranch():
|
||||
@ -47,7 +47,8 @@ def _RemovePreviousUpdateBranch():
|
||||
def _GetLastAuthor():
|
||||
"""Returns a string with the author of the last commit."""
|
||||
author = subprocess.check_output(
|
||||
['git', 'log', '-1', '--pretty=format:"%an"']).splitlines()
|
||||
['git', 'log', '-1', '--pretty=format:"%an"'],
|
||||
universal_newlines=True).splitlines()
|
||||
return author
|
||||
|
||||
|
||||
@ -57,7 +58,8 @@ def _GetBranches():
|
||||
'active' is a string with name of the currently active branch, while
|
||||
'branches' is the list of all branches.
|
||||
"""
|
||||
lines = subprocess.check_output(['git', 'branch']).splitlines()
|
||||
lines = subprocess.check_output(['git', 'branch'],
|
||||
universal_newlines=True).splitlines()
|
||||
branches = []
|
||||
active = ''
|
||||
for line in lines:
|
||||
@ -78,8 +80,8 @@ def _CreateUpdateBranch():
|
||||
|
||||
|
||||
def _UpdateWebRTCVersion(filename):
|
||||
with open(filename) as f:
|
||||
content = f.read()
|
||||
with open(filename, 'rb') as f:
|
||||
content = f.read().decode('utf-8')
|
||||
d = datetime.datetime.utcnow()
|
||||
# pylint: disable=line-too-long
|
||||
new_content = re.sub(
|
||||
@ -89,12 +91,13 @@ def _UpdateWebRTCVersion(filename):
|
||||
content,
|
||||
flags=re.MULTILINE)
|
||||
# pylint: enable=line-too-long
|
||||
with open(filename, 'w') as f:
|
||||
f.write(new_content)
|
||||
with open(filename, 'wb') as f:
|
||||
f.write(new_content.encode('utf-8'))
|
||||
|
||||
|
||||
def _IsTreeClean():
|
||||
stdout = subprocess.check_output(['git', 'status', '--porcelain'])
|
||||
stdout = subprocess.check_output(['git', 'status', '--porcelain'],
|
||||
universal_newlines=True)
|
||||
if len(stdout) == 0:
|
||||
return True
|
||||
return False
|
||||
|
Reference in New Issue
Block a user