Make fuchsia python scripts work with python3 (flutter/engine#26924)

This commit is contained in:
Chase Latta
2021-06-24 12:11:02 -07:00
committed by GitHub
parent 7a203330e1
commit 6c40a784a2
5 changed files with 13 additions and 13 deletions

2
DEPS
View File

@@ -98,7 +98,7 @@ allowed_hosts = [
]
deps = {
'src': 'https://github.com/flutter/buildroot.git' + '@' + 'fc82ca44f1ae85c5fbfa06bd313477539ca50729',
'src': 'https://github.com/flutter/buildroot.git' + '@' + '275038b8be7196927b0f71770701f3c2c3744860',
# Fuchsia compatibility
#

View File

@@ -43,17 +43,17 @@ def GetBuildIdParts(exec_path, read_elf):
sha1_pattern = re.compile(r'[0-9a-fA-F\-]+')
file_out = subprocess.check_output([read_elf, '-n', exec_path])
build_id_line = file_out.splitlines()[-1].split()
if (build_id_line[0] != 'Build' or
build_id_line[1] != 'ID:' or not
sha1_pattern.match(build_id_line[-1]) or not
if (build_id_line[0] != b'Build' or
build_id_line[1] != b'ID:' or not
sha1_pattern.match(str(build_id_line[-1])) or not
len(build_id_line[-1]) > 2):
raise Exception('Expected the last line of llvm-readelf to match "Build ID <Hex String>" Got: %s' % file_out)
build_id = build_id_line[-1]
return {
'build_id': build_id,
'prefix_dir': build_id[:2],
'exec_name': build_id[2:]
'build_id': build_id.decode('utf-8'),
'prefix_dir': build_id[:2].decode('utf-8'),
'exec_name': build_id[2:].decode('utf-8')
}
@@ -115,7 +115,7 @@ def main():
raise
if not os.path.exists(dbg_prefix_base):
print 'Unable to create directory: %s.' % dbg_prefix_base
print('Unable to create directory: %s.' % dbg_prefix_base)
return 1
dbg_suffix = ''

View File

@@ -56,7 +56,7 @@ def main():
files = open(args.file_list, 'r')
files_to_copy = files.read().split()
num_files = len(files_to_copy) / 2
num_files = len(files_to_copy) // 2
for i in range(num_files):
CopyPath(files_to_copy[i], files_to_copy[num_files + i])

View File

@@ -62,7 +62,7 @@ def GatherArtifacts(src_root, dst_root, create_meta_package=True):
src_full = os.path.join(src_root, src_rel)
dst_full = os.path.join(dst_root, dst_rel)
if not os.path.exists(src_full):
print 'Unable to find artifact: ', str(src_full)
print('Unable to find artifact: ', str(src_full))
sys.exit(1)
CopyPath(src_full, dst_full)

View File

@@ -64,13 +64,13 @@ def main():
i.read()
.replace(
'{{DART_SDK_GIT_REVISION}}',
GetDartSdkGitRevision(args.buildroot))
GetDartSdkGitRevision(args.buildroot).decode('utf-8'))
.replace(
'{{DART_SDK_SEMANTIC_VERSION}}',
GetDartSdkSemanticVersion(args.buildroot))
GetDartSdkSemanticVersion(args.buildroot).decode('utf-8'))
.replace(
'{{FLUTTER_ENGINE_GIT_REVISION}}',
GetFlutterEngineGitRevision(args.buildroot))
GetFlutterEngineGitRevision(args.buildroot).decode('utf-8'))
.replace(
'{{FUCHSIA_SDK_VERSION}}',
GetFuchsiaSdkVersion(args.buildroot)))