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