Fix archive script for python3
Change-Id: Ia9f5da3522c5f774fd7deccc594da6da8e83762c
diff --git a/tools/archive.py b/tools/archive.py
index 24e8e0a..1983f55 100755
--- a/tools/archive.py
+++ b/tools/archive.py
@@ -35,9 +35,9 @@
def GetToolVersion(jar_path):
# TODO(mkroghj) This would not work for r8-lib, maybe use utils.getR8Version.
- output = subprocess.check_output([
+ output = str(subprocess.check_output([
jdk.GetJavaExecutable(), '-jar', jar_path, '--version'
- ])
+ ]))
return output.splitlines()[0].strip()
def GetVersion():
@@ -54,11 +54,11 @@
return subprocess.check_output(['git', 'show', '-s', '--pretty=%d', 'HEAD'])
def GetGitHash():
- return subprocess.check_output(['git', 'rev-parse', 'HEAD']).strip()
+ return str(subprocess.check_output(['git', 'rev-parse', 'HEAD'])).strip()
def IsMain(version):
- branches = subprocess.check_output(['git', 'branch', '-r', '--contains',
- 'HEAD'])
+ branches = str(subprocess.check_output(['git', 'branch', '-r', '--contains',
+ 'HEAD']))
# CL runs from gerrit does not have a branch, we always treat them as main
# commits to archive these to the hash based location
if len(branches) == 0:
diff --git a/tools/create_maven_release.py b/tools/create_maven_release.py
index 01aebe6..e53265c 100755
--- a/tools/create_maven_release.py
+++ b/tools/create_maven_release.py
@@ -230,7 +230,7 @@
dependency_lines = []
collect = False
for line in dependencies.splitlines():
- if 'runtimeClasspath' in line and "'main'" in line:
+ if line and 'runtimeClasspath' in line and "'main'" in line:
collect = True
continue
if collect:
diff --git a/tools/gradle.py b/tools/gradle.py
index 63c92b5..dede2c6 100755
--- a/tools/gradle.py
+++ b/tools/gradle.py
@@ -96,7 +96,7 @@
cmd.extend(args)
utils.PrintCmd(cmd)
with utils.ChangedWorkingDirectory(cwd):
- return subprocess.check_output(cmd, env=GetJavaEnv(env))
+ return str(subprocess.check_output(cmd, env=GetJavaEnv(env)))
def RunGradleWrapperInGetOutput(args, cwd, env=None):
return RunGradleInGetOutput('./gradlew', args, cwd, env=env)